UPSTREAM: sched/preempt: Fix preempt_count manipulations
[firefly-linux-kernel-4.4.55.git] / include / asm-generic / preempt.h
index 5d8ffa3e6f8c8a4e3715f3da4294abc860390386..c1cde3577551817c9f5581b98f331406e8c61f83 100644 (file)
@@ -7,10 +7,10 @@
 
 static __always_inline int preempt_count(void)
 {
-       return current_thread_info()->preempt_count;
+       return READ_ONCE(current_thread_info()->preempt_count);
 }
 
-static __always_inline int *preempt_count_ptr(void)
+static __always_inline volatile int *preempt_count_ptr(void)
 {
        return &current_thread_info()->preempt_count;
 }