]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/asm-avr32/system.h
[XFS] Fix build failure after enabling CONFIG_XFS_DEBUG
[linux-2.6-omap-h63xx.git] / include / asm-avr32 / system.h
index a8236bacc8789133c573885d3065ba97005eebc3..9702c2213e1e74d979fb914b286cfbfac8c1609d 100644 (file)
@@ -35,8 +35,8 @@
 #include <asm/ocd.h>
 #define finish_arch_switch(prev)                       \
        do {                                            \
-               __mtdr(DBGREG_PID, prev->pid);          \
-               __mtdr(DBGREG_PID, current->pid);       \
+               ocd_write(PID, prev->pid);              \
+               ocd_write(PID, current->pid);           \
        } while(0)
 #endif
 
@@ -73,11 +73,16 @@ extern struct task_struct *__switch_to(struct task_struct *,
 
 extern void __xchg_called_with_bad_pointer(void);
 
-#ifdef __CHECKER__
-extern unsigned long __builtin_xchg(void *ptr, unsigned long x);
-#endif
+static inline unsigned long xchg_u32(u32 val, volatile u32 *m)
+{
+       u32 ret;
 
-#define xchg_u32(val, m) __builtin_xchg((void *)m, val)
+       asm volatile("xchg %[ret], %[m], %[val]"
+                       : [ret] "=&r"(ret), "=m"(*m)
+                       : "m"(*m), [m] "r"(m), [val] "r"(val)
+                       : "memory");
+       return ret;
+}
 
 static inline unsigned long __xchg(unsigned long x,
                                       volatile void *ptr,
@@ -140,6 +145,29 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
                                   (unsigned long)(new),        \
                                   sizeof(*(ptr))))
 
+#include <asm-generic/cmpxchg-local.h>
+
+static inline unsigned long __cmpxchg_local(volatile void *ptr,
+                                     unsigned long old,
+                                     unsigned long new, int size)
+{
+       switch (size) {
+       case 4:
+               return __cmpxchg_u32(ptr, old, new);
+       default:
+               return __cmpxchg_local_generic(ptr, old, new, size);
+       }
+
+       return old;
+}
+
+#define cmpxchg_local(ptr, old, new)                                   \
+       ((typeof(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(old),   \
+                                  (unsigned long)(new),                \
+                                  sizeof(*(ptr))))
+
+#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
+
 struct pt_regs;
 void NORET_TYPE die(const char *str, struct pt_regs *regs, long err);
 void _exception(long signr, struct pt_regs *regs, int code,