[PATCH 6/6] linux: bitmap.h: Add for_each_set_bit_from() function

Scaria Kochidanadu s-kochidanadu at ti.com
Mon Jul 8 09:52:07 CEST 2024


Add function macro for_each_set_bit_from(), an extension to the already
existing function macro for_each_set_bit() to iterate through set bits
of a variable from a given bit index as required by the MCASP Driver.

Signed-off-by: Scaria Kochidanadu <s-kochidanadu at ti.com>
---
 include/linux/bitmap.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 0a8503af9f..da3aa428b6 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -159,6 +159,11 @@ static inline unsigned long find_first_bit(const unsigned long *addr, unsigned l
 	     (bit) < (size);					\
 	     (bit) = find_next_bit((addr), (size), (bit) + 1))
 
+#define for_each_set_bit_from(_bit, _addr, _size) \
+	for ((_bit) = find_next_bit((_addr), (_size), (_bit));		\
+	    (_bit) < (_size);					\
+	    (_bit) = find_next_bit((_addr), (_size), (_bit) + 1))
+
 static inline unsigned long
 bitmap_find_next_zero_area(unsigned long *map,
 			   unsigned long size,
-- 
2.34.1



More information about the U-Boot mailing list