summaryrefslogtreecommitdiff
path: root/include/linux/find.h
diff options
context:
space:
mode:
authorValentin Schneider <vschneid@redhat.com>2022-10-03 16:34:18 +0100
committerYury Norov <yury.norov@gmail.com>2022-10-06 05:57:36 -0700
commit5f75ff295c662c1c8fb9e1737e9dc3b9a1e7fb29 (patch)
tree3d5bc8c5fe350f59a27426efb5b2de4c75f6fa31 /include/linux/find.h
parent90d482908eedd56f01a707325aa541cf9c40f936 (diff)
cpumask: Introduce for_each_cpu_andnot()
for_each_cpu_and() is very convenient as it saves having to allocate a temporary cpumask to store the result of cpumask_and(). The same issue applies to cpumask_andnot() which doesn't actually need temporary storage for iteration purposes. Following what has been done for for_each_cpu_and(), introduce for_each_cpu_andnot(). Signed-off-by: Valentin Schneider <vschneid@redhat.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 2235af19e7e1..ccaf61a0f5fd 100644
--- a/include/linux/find.h
+++ b/include/linux/find.h
@@ -498,6 +498,11 @@ unsigned long find_next_bit_le(const void *addr, unsigned
(bit) = find_next_and_bit((addr1), (addr2), (size), (bit)), (bit) < (size);\
(bit)++)
+#define for_each_andnot_bit(bit, addr1, addr2, size) \
+ for ((bit) = 0; \
+ (bit) = find_next_andnot_bit((addr1), (addr2), (size), (bit)), (bit) < (size);\
+ (bit)++)
+
/* 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)), (bit) < (size); (bit)++)