aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-avr32/atomic.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-avr32/atomic.h')
-rw-r--r--include/asm-avr32/atomic.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/asm-avr32/atomic.h b/include/asm-avr32/atomic.h
index e0b9c44c126c..c40b6032c480 100644
--- a/include/asm-avr32/atomic.h
+++ b/include/asm-avr32/atomic.h
@@ -41,7 +41,7 @@ static inline int atomic_sub_return(int i, atomic_t *v)
41 " stcond %1, %0\n" 41 " stcond %1, %0\n"
42 " brne 1b" 42 " brne 1b"
43 : "=&r"(result), "=o"(v->counter) 43 : "=&r"(result), "=o"(v->counter)
44 : "m"(v->counter), "ir"(i) 44 : "m"(v->counter), "rKs21"(i)
45 : "cc"); 45 : "cc");
46 46
47 return result; 47 return result;
@@ -58,7 +58,7 @@ static inline int atomic_add_return(int i, atomic_t *v)
58{ 58{
59 int result; 59 int result;
60 60
61 if (__builtin_constant_p(i)) 61 if (__builtin_constant_p(i) && (i >= -1048575) && (i <= 1048576))
62 result = atomic_sub_return(-i, v); 62 result = atomic_sub_return(-i, v);
63 else 63 else
64 asm volatile( 64 asm volatile(
@@ -101,7 +101,7 @@ static inline int atomic_sub_unless(atomic_t *v, int a, int u)
101 " mov %1, 1\n" 101 " mov %1, 1\n"
102 "1:" 102 "1:"
103 : "=&r"(tmp), "=&r"(result), "=o"(v->counter) 103 : "=&r"(tmp), "=&r"(result), "=o"(v->counter)
104 : "m"(v->counter), "ir"(a), "ir"(u) 104 : "m"(v->counter), "rKs21"(a), "rKs21"(u)
105 : "cc", "memory"); 105 : "cc", "memory");
106 106
107 return result; 107 return result;
@@ -121,7 +121,7 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
121{ 121{
122 int tmp, result; 122 int tmp, result;
123 123
124 if (__builtin_constant_p(a)) 124 if (__builtin_constant_p(a) && (a >= -1048575) && (a <= 1048576))
125 result = atomic_sub_unless(v, -a, u); 125 result = atomic_sub_unless(v, -a, u);
126 else { 126 else {
127 result = 0; 127 result = 0;