locking/atomics: Flip atomic_fetch_or() arguments
authorPeter Zijlstra <peterz@infradead.org>
Thu, 21 Apr 2016 18:35:25 +0000 (20:35 +0200)
committerIngo Molnar <mingo@kernel.org>
Thu, 5 May 2016 07:58:52 +0000 (09:58 +0200)
All the atomic operations have their arguments the wrong way around;
make atomic_fetch_or() consistent and flip them.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
include/linux/atomic.h
kernel/time/tick-sched.c

index 506c3531832eee836ab30997122070790067cadd..e451534fe54d9184fbdaab4c8684c1e5a288ff39 100644 (file)
@@ -560,11 +560,11 @@ static inline int atomic_dec_if_positive(atomic_t *v)
 
 /**
  * atomic_fetch_or - perform *p |= mask and return old value of *p
- * @p: pointer to atomic_t
  * @mask: mask to OR on the atomic_t
+ * @p: pointer to atomic_t
  */
 #ifndef atomic_fetch_or
-static inline int atomic_fetch_or(atomic_t *p, int mask)
+static inline int atomic_fetch_or(int mask, atomic_t *p)
 {
        int old, val = atomic_read(p);
 
index 58e3310c9b213617210fb19c10b6eb9b22a405a9..3daa49ff0719a973b3e8e859a8cdc302ebfeafac 100644 (file)
@@ -262,7 +262,7 @@ static void tick_nohz_dep_set_all(atomic_t *dep,
 {
        int prev;
 
-       prev = atomic_fetch_or(dep, BIT(bit));
+       prev = atomic_fetch_or(BIT(bit), dep);
        if (!prev)
                tick_nohz_full_kick_all();
 }
@@ -292,7 +292,7 @@ void tick_nohz_dep_set_cpu(int cpu, enum tick_dep_bits bit)
 
        ts = per_cpu_ptr(&tick_cpu_sched, cpu);
 
-       prev = atomic_fetch_or(&ts->tick_dep_mask, BIT(bit));
+       prev = atomic_fetch_or(BIT(bit), &ts->tick_dep_mask);
        if (!prev) {
                preempt_disable();
                /* Perf needs local kick that is NMI safe */