[Concept,06/21] ext4l: sandbox: Use volatile in set_bit() etc.

Message ID 20260108185149.1995917-7-sjg@u-boot.org
State New
Headers
Series ext4l: Add Kconfig options to reduce binary size (part P) |

Commit Message

Simon Glass Jan. 8, 2026, 6:51 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Other archs use a volatile address so update sandbox to match. This will
prevent warnings in common code.

Update the ext4 stub functions too.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 arch/sandbox/include/asm/bitops.h | 6 +++---
 fs/ext4l/stub.c                   | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
  

Patch

diff --git a/arch/sandbox/include/asm/bitops.h b/arch/sandbox/include/asm/bitops.h
index f27d5e98c56..2fdc0116da0 100644
--- a/arch/sandbox/include/asm/bitops.h
+++ b/arch/sandbox/include/asm/bitops.h
@@ -34,11 +34,11 @@ 
 /*
  * Function prototypes to keep gcc -Wall happy.
  */
-extern void set_bit(int nr, void *addr);
+extern void set_bit(int nr, volatile void *addr);
 
-extern void clear_bit(int nr, void *addr);
+extern void clear_bit(int nr, volatile void *addr);
 
-extern void change_bit(int nr, void *addr);
+extern void change_bit(int nr, volatile void *addr);
 
 static inline void __change_bit(int nr, void *addr)
 {
diff --git a/fs/ext4l/stub.c b/fs/ext4l/stub.c
index af0bb045d5f..2084faa3b50 100644
--- a/fs/ext4l/stub.c
+++ b/fs/ext4l/stub.c
@@ -79,21 +79,21 @@  typedef struct journal_s journal_t;
  * Bit operations - sandbox declares these extern but doesn't implement them.
  * These work on bitmaps where nr is the absolute bit number.
  */
-void set_bit(int nr, void *addr)
+void set_bit(int nr, volatile void *addr)
 {
 	unsigned long *p = (unsigned long *)addr + (nr / BITS_PER_LONG);
 
 	*p |= (1UL << (nr % BITS_PER_LONG));
 }
 
-void clear_bit(int nr, void *addr)
+void clear_bit(int nr, volatile void *addr)
 {
 	unsigned long *p = (unsigned long *)addr + (nr / BITS_PER_LONG);
 
 	*p &= ~(1UL << (nr % BITS_PER_LONG));
 }
 
-void change_bit(int nr, void *addr)
+void change_bit(int nr, volatile void *addr)
 {
 	unsigned long *p = (unsigned long *)addr + (nr / BITS_PER_LONG);