summaryrefslogtreecommitdiff
path: root/include/linux/find.h
diff options
context:
space:
mode:
authorYury Norov <yury.norov@gmail.com>2022-09-19 14:05:55 -0700
committerYury Norov <yury.norov@gmail.com>2022-10-01 10:22:57 -0700
commit33e67710beda78aed38a2fe10be6088d4aeb1c53 (patch)
treea551250dc8b2dc899bbad6b7a39e5596868f1216 /include/linux/find.h
parent854701ba4c39afae2362ba19a580c461cb183e4f (diff)
cpumask: switch for_each_cpu{,_not} to use for_each_bit()
The difference between for_each_cpu() and for_each_set_bit() is that the latter uses cpumask_next() instead of find_next_bit(), and so calls cpumask_check(). This check is useless because the iterator value is not provided by user. It generates false-positives for the very last iteration of for_each_cpu(). Signed-off-by: Yury Norov <yury.norov@gmail.com>
Diffstat (limited to 'include/linux/find.h')
-rw-r--r--include/linux/find.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/find.h b/include/linux/find.h
index b100944daba0..128615a3f93e 100644
--- a/include/linux/find.h
+++ b/include/linux/find.h
@@ -390,6 +390,11 @@ unsigned long find_next_bit_le(const void *addr, unsigned
(bit) < (size); \
(bit) = find_next_bit((addr), (size), (bit) + 1))
+#define for_each_and_bit(bit, addr1, addr2, size) \
+ for ((bit) = find_next_and_bit((addr1), (addr2), (size), 0); \
+ (bit) < (size); \
+ (bit) = find_next_and_bit((addr1), (addr2), (size), (bit) + 1))
+
/* same as for_each_set_bit() but use bit as value to start with */
#define for_each_set_bit_from(bit, addr, size) \
for ((bit) = find_next_bit((addr), (size), (bit)); \