From 3f698a1cf08cc02911cdb2ca3217be77eeba794b Mon Sep 17 00:00:00 2001
From: Kurt Mahan <kmahan@freescale.com>
Date: Tue, 27 Nov 2007 23:17:53 -0700
Subject: [PATCH] Change inline assembly memory params.

For various routines change how the assembly memory pointer
is passed in.

LTIBName: mcfv4e-inline-memory-params
Signed-off-by: Kurt Mahan <kmahan@freescale.com>
---
 include/asm-m68k/bitops.h |   68 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 67 insertions(+), 1 deletions(-)

--- a/include/asm-m68k/bitops.h
+++ b/include/asm-m68k/bitops.h
@@ -465,7 +465,7 @@ static inline int ext2_find_next_bit(con
    __constant_coldfire_test_and_set_bit(nr, vaddr) :	\
    __generic_coldfire_test_and_set_bit(nr, vaddr))
 
-
+#if 0
 static __inline__ int __constant_coldfire_test_and_set_bit(int nr,
 	volatile void *vaddr)
 {
@@ -477,6 +477,17 @@ static __inline__ int __constant_coldfir
 	     : "di" (nr & 7));
 	return retval;
 }
+#else
+static __inline__ int __constant_coldfire_test_and_set_bit(int nr,volatile void * vaddr)
+{
+	char retval;
+	volatile char *p = &((volatile char *)vaddr)[(nr^31) >> 3];
+	__asm__ __volatile__ ("bset %2,(%4); sne %0"
+	     : "=d" (retval), "=m" (*p)
+	     : "di" (nr & 7), "m" (*p), "a" (p));
+	return retval;
+}
+#endif
 
 static __inline__ int __generic_coldfire_test_and_set_bit(int nr,
 	volatile void *vaddr)
@@ -496,6 +507,7 @@ static __inline__ int __generic_coldfire
    __constant_coldfire_set_bit(nr, vaddr) :	\
    __generic_coldfire_set_bit(nr, vaddr))
 
+#if 0
 static __inline__ void __constant_coldfire_set_bit(int nr,
 	volatile void *vaddr)
 {
@@ -503,6 +515,14 @@ static __inline__ void __constant_coldfi
 	__asm__ __volatile__ ("bset %1,%0"
 	     : "+QUd" (*p) : "di" (nr & 7));
 }
+#else
+static __inline__ void __constant_coldfire_set_bit(int nr, volatile void * vaddr)
+{
+	volatile char *p = &((volatile char *)vaddr)[(nr^31) >> 3];
+	__asm__ __volatile__ ("bset %1,(%3)"
+	     : "=m" (*p) : "di" (nr & 7), "m" (*p), "a" (p));
+}
+#endif
 
 static __inline__ void __generic_coldfire_set_bit(int nr, volatile void *vaddr)
 {
@@ -518,6 +538,7 @@ static __inline__ void __generic_coldfir
    __constant_coldfire_test_and_clear_bit(nr, vaddr) :	\
    __generic_coldfire_test_and_clear_bit(nr, vaddr))
 
+#if 0
 static __inline__ int __constant_coldfire_test_and_clear_bit(int nr,
 	volatile void *vaddr)
 {
@@ -530,6 +551,19 @@ static __inline__ int __constant_coldfir
 
 	return retval;
 }
+#else
+static __inline__ int __constant_coldfire_test_and_clear_bit(int nr, volatile void *vaddr)
+{
+	char retval;
+	volatile char *p = &((volatile char *)vaddr)[(nr^31) >> 3];
+
+	__asm__ __volatile__ ("bclr %2,(%4); sne %0"
+	     : "=d" (retval), "=m" (*p)
+	     : "id" (nr & 7), "m" (*p), "a" (p));
+
+	return retval;
+}
+#endif
 
 static __inline__ int __generic_coldfire_test_and_clear_bit(int nr,
 	volatile void *vaddr)
@@ -556,6 +590,7 @@ static __inline__ int __generic_coldfire
    __constant_coldfire_clear_bit(nr, vaddr) :	\
    __generic_coldfire_clear_bit(nr, vaddr))
 
+#if 0
 static __inline__ void __constant_coldfire_clear_bit(int nr,
 	volatile void *vaddr)
 {
@@ -563,6 +598,14 @@ static __inline__ void __constant_coldfi
 	__asm__ __volatile__ ("bclr %1,%0"
 	     : "+QUd" (*p) : "id" (nr & 7));
 }
+#else
+static __inline__ void __constant_coldfire_clear_bit(int nr, volatile void * vaddr)
+{
+	volatile char *p = &((volatile char *)vaddr)[(nr^31) >> 3];
+	__asm__ __volatile__ ("bclr %1,(%3)"
+	     : "=m" (*p) : "id" (nr & 7), "m" (*p), "a" (p));
+}
+#endif
 
 static __inline__ void __generic_coldfire_clear_bit(int nr,
 	volatile void *vaddr)
@@ -579,6 +622,7 @@ static __inline__ void __generic_coldfir
    __constant_coldfire_test_and_change_bit(nr, vaddr) :	\
    __generic_coldfire_test_and_change_bit(nr, vaddr))
 
+#if 0
 static __inline__ int __constant_coldfire_test_and_change_bit(int nr,
 	volatile void *vaddr)
 {
@@ -591,6 +635,19 @@ static __inline__ int __constant_coldfir
 
 	return retval;
 }
+#else
+static __inline__ int __constant_coldfire_test_and_change_bit(int nr, volatile void * vaddr)
+{
+	char retval;
+	volatile char *p = &((volatile char *)vaddr)[(nr^31) >> 3];
+
+	__asm__ __volatile__ ("bchg %2,(%4); sne %0"
+	     : "=d" (retval), "=m" (*p)
+	     : "id" (nr & 7), "m" (*p), "a" (p));
+
+	return retval;
+}
+#endif
 
 static __inline__ int __generic_coldfire_test_and_change_bit(int nr,
 	volatile void *vaddr)
@@ -612,6 +669,7 @@ static __inline__ int __generic_coldfire
    __constant_coldfire_change_bit(nr, vaddr) :	\
    __generic_coldfire_change_bit(nr, vaddr))
 
+#if 0
 static __inline__ void __constant_coldfire_change_bit(int nr,
 	volatile void *vaddr)
 {
@@ -619,6 +677,14 @@ static __inline__ void __constant_coldfi
 	__asm__ __volatile__ ("bchg %1,%0"
 	     : "+QUd" (*p) : "id" (nr & 7));
 }
+#else
+static __inline__ void __constant_coldfire_change_bit(int nr, volatile void * vaddr)
+{
+	volatile char *p = &((volatile char *)vaddr)[(nr^31) >> 3];
+	__asm__ __volatile__ ("bchg %1,(%3)"
+	     : "=m" (*p) : "id" (nr & 7), "m" (*p), "a" (p));
+}
+#endif
 
 static __inline__ void __generic_coldfire_change_bit(int nr,
 	volatile void *vaddr)
