]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
linux/cpumask.h: add typechecking to cpumask_test_cpu
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Tue, 31 Mar 2015 02:55:05 +0000 (13:25 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 31 Mar 2015 03:25:31 +0000 (13:55 +1030)
The Subtlety (1) referred to vanished with 6ba2ef7baac2 ("cpumask:
Move deprecated functions to end of header."). That used to mention
some suboptimal code generation by a, by now, rather ancient gcc. With
gcc 4.7, I don't see any change in the generated code by making it a
static inline, so let's add type checking and get rid of the ghost
reference.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
include/linux/cpumask.h

index 4ad2d3c8e21f30c22f9c333a4b633e18fdfb56b1..89558d0b56acbdfe67b7c3fd66189feeb819f779 100644 (file)
@@ -290,11 +290,11 @@ static inline void cpumask_clear_cpu(int cpu, struct cpumask *dstp)
  * @cpumask: the cpumask pointer
  *
  * Returns 1 if @cpu is set in @cpumask, else returns 0
- *
- * No static inline type checking - see Subtlety (1) above.
  */
-#define cpumask_test_cpu(cpu, cpumask) \
-       test_bit(cpumask_check(cpu), cpumask_bits((cpumask)))
+static inline int cpumask_test_cpu(int cpu, const struct cpumask *cpumask)
+{
+       return test_bit(cpumask_check(cpu), cpumask_bits((cpumask)));
+}
 
 /**
  * cpumask_test_and_set_cpu - atomically test and set a cpu in a cpumask