]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - arch/x86/include/asm/preempt.h
Merge remote-tracking branch 'asoc/topic/dmaengine' into asoc-next
[karo-tx-linux.git] / arch / x86 / include / asm / preempt.h
index 17f2186457012eb77fcb2f6ca2183d1b0a062384..ec1f3c6511506ee1f0ff5240a9ff95d0e6fa68c1 100644 (file)
@@ -24,7 +24,13 @@ static __always_inline int preempt_count(void)
 
 static __always_inline void preempt_count_set(int pc)
 {
-       raw_cpu_write_4(__preempt_count, pc);
+       int old, new;
+
+       do {
+               old = raw_cpu_read_4(__preempt_count);
+               new = (old & PREEMPT_NEED_RESCHED) |
+                       (pc & ~PREEMPT_NEED_RESCHED);
+       } while (raw_cpu_cmpxchg_4(__preempt_count, old, new) != old);
 }
 
 /*