[PATCH/RFC] m68k/bitops: Make bitmap data pointer of atomic ops volatile

From: Geert Uytterhoeven
Date: Mon Jun 06 2011 - 16:08:07 EST


This fixes a.o.

drivers/ide/ide-io.c: In function âide_lock_hostâ:
drivers/ide/ide-io.c:415: warning: passing argument 2 of â__constant_test_and_set_bitâ discards qualifiers from pointer target type
drivers/ide/ide-io.c:415: warning: passing argument 2 of â__generic_test_and_set_bitâ discards qualifiers from pointer target type

Suggested-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
Signed-off-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
---
I'm not 100% sure whether all of these should be volatile.
We're only getting compiler warnings for calls to test_and_set_bit().

arch/m68k/include/asm/bitops_mm.h | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/arch/m68k/include/asm/bitops_mm.h b/arch/m68k/include/asm/bitops_mm.h
index 89cf5b8..2d31d5f 100644
--- a/arch/m68k/include/asm/bitops_mm.h
+++ b/arch/m68k/include/asm/bitops_mm.h
@@ -27,7 +27,8 @@

#define __test_and_set_bit(nr,vaddr) test_and_set_bit(nr,vaddr)

-static inline int __constant_test_and_set_bit(int nr, unsigned long *vaddr)
+static inline int __constant_test_and_set_bit(int nr,
+ volatile unsigned long *vaddr)
{
char *p = (char *)vaddr + (nr ^ 31) / 8;
char retval;
@@ -39,7 +40,8 @@ static inline int __constant_test_and_set_bit(int nr, unsigned long *vaddr)
return retval;
}

-static inline int __generic_test_and_set_bit(int nr, unsigned long *vaddr)
+static inline int __generic_test_and_set_bit(int nr,
+ volatile unsigned long *vaddr)
{
char retval;

@@ -76,7 +78,8 @@ static inline void __generic_set_bit(int nr, volatile unsigned long *vaddr)

#define __test_and_clear_bit(nr,vaddr) test_and_clear_bit(nr,vaddr)

-static inline int __constant_test_and_clear_bit(int nr, unsigned long *vaddr)
+static inline int __constant_test_and_clear_bit(int nr,
+ volatile unsigned long *vaddr)
{
char *p = (char *)vaddr + (nr ^ 31) / 8;
char retval;
@@ -88,7 +91,8 @@ static inline int __constant_test_and_clear_bit(int nr, unsigned long *vaddr)
return retval;
}

-static inline int __generic_test_and_clear_bit(int nr, unsigned long *vaddr)
+static inline int __generic_test_and_clear_bit(int nr,
+ volatile unsigned long *vaddr)
{
char retval;

@@ -131,7 +135,8 @@ static inline void __generic_clear_bit(int nr, volatile unsigned long *vaddr)
#define __test_and_change_bit(nr,vaddr) test_and_change_bit(nr,vaddr)
#define __change_bit(nr,vaddr) change_bit(nr,vaddr)

-static inline int __constant_test_and_change_bit(int nr, unsigned long *vaddr)
+static inline int __constant_test_and_change_bit(int nr,
+ volatile unsigned long *vaddr)
{
char *p = (char *)vaddr + (nr ^ 31) / 8;
char retval;
@@ -143,7 +148,8 @@ static inline int __constant_test_and_change_bit(int nr, unsigned long *vaddr)
return retval;
}

-static inline int __generic_test_and_change_bit(int nr, unsigned long *vaddr)
+static inline int __generic_test_and_change_bit(int nr,
+ volatile unsigned long *vaddr)
{
char retval;

@@ -158,14 +164,14 @@ static inline int __generic_test_and_change_bit(int nr, unsigned long *vaddr)
__constant_change_bit(nr, vaddr) : \
__generic_change_bit(nr, vaddr))

-static inline void __constant_change_bit(int nr, unsigned long *vaddr)
+static inline void __constant_change_bit(int nr, volatile unsigned long *vaddr)
{
char *p = (char *)vaddr + (nr ^ 31) / 8;
__asm__ __volatile__ ("bchg %1,%0"
: "+m" (*p) : "di" (nr & 7));
}

-static inline void __generic_change_bit(int nr, unsigned long *vaddr)
+static inline void __generic_change_bit(int nr, volatile unsigned long *vaddr)
{
__asm__ __volatile__ ("bfchg %1{%0:#1}"
: : "d" (nr^31), "o" (*vaddr) : "memory");
--
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/