aboutsummaryrefslogtreecommitdiffstats
path: root/lib/find_bit.c
diff options
context:
space:
mode:
authorYury Norov [NVIDIA] <[email protected]>2025-05-15 16:58:32 +0000
committerBorislav Petkov (AMD) <[email protected]>2025-05-15 18:24:40 +0000
commit13f0a02bf4c1c5888c736cedef9ca50de666adb3 (patch)
treef8f4701eb9d14d289967e4c7a381be18905aff87 /lib/find_bit.c
parentcpumask: Relax cpumask_any_but() (diff)
downloadkernel-13f0a02bf4c1c5888c736cedef9ca50de666adb3.tar.gz
kernel-13f0a02bf4c1c5888c736cedef9ca50de666adb3.zip
find: Add find_first_andnot_bit()
The function helps to implement cpumask_andnot() APIs. Signed-off-by: Yury Norov [NVIDIA] <[email protected]> Signed-off-by: James Morse <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: James Morse <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Reviewed-by: Fenghua Yu <[email protected]> Tested-by: James Morse <[email protected]> Tested-by: Tony Luck <[email protected]> Tested-by: Fenghua Yu <[email protected]> Link: https://lore.kernel.org/[email protected]
Diffstat (limited to 'lib/find_bit.c')
-rw-r--r--lib/find_bit.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/find_bit.c b/lib/find_bit.c
index 0836bb3d76c5..06b6342aa3ae 100644
--- a/lib/find_bit.c
+++ b/lib/find_bit.c
@@ -117,6 +117,17 @@ EXPORT_SYMBOL(_find_first_and_bit);
#endif
/*
+ * Find the first bit set in 1st memory region and unset in 2nd.
+ */
+unsigned long _find_first_andnot_bit(const unsigned long *addr1,
+ const unsigned long *addr2,
+ unsigned long size)
+{
+ return FIND_FIRST_BIT(addr1[idx] & ~addr2[idx], /* nop */, size);
+}
+EXPORT_SYMBOL(_find_first_andnot_bit);
+
+/*
* Find the first set bit in three memory regions.
*/
unsigned long _find_first_and_and_bit(const unsigned long *addr1,