[patch 2/5] atm: use for_each_set_bit()

Previous thread: [patch 1/5] phonet: use for_each_set_bit() by akpm on Thursday, March 11, 2010 - 3:07 pm. (3 messages)

Next thread: [PATCH 10/13] RDS: only put sockets that have seen congestion on the poll_waitq by Andy Grover on Thursday, March 11, 2010 - 4:50 pm. (1 message)
From: akpm
Date: Thursday, March 11, 2010 - 3:07 pm

From: Akinobu Mita <akinobu.mita@gmail.com>

Replace open-coded loop with for_each_set_bit().

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Chas Williams <chas@cmf.nrl.navy.mil>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/atm/lanai.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff -puN drivers/atm/lanai.c~atm-use-for_each_set_bit drivers/atm/lanai.c
--- a/drivers/atm/lanai.c~atm-use-for_each_set_bit
+++ a/drivers/atm/lanai.c
@@ -306,11 +306,10 @@ static void vci_bitfield_iterate(struct 
 	const unsigned long *lp,
 	void (*func)(struct lanai_dev *,vci_t vci))
 {
-	vci_t vci = find_first_bit(lp, NUM_VCI);
-	while (vci < NUM_VCI) {
+	vci_t vci;
+
+	for_each_set_bit(vci, lp, NUM_VCI)
 		func(lanai, vci);
-		vci = find_next_bit(lp, NUM_VCI, vci + 1);
-	}
 }
 
 /* -------------------- BUFFER  UTILITIES: */
_
--

From: David Miller
Date: Monday, March 15, 2010 - 4:05 pm

Previous thread: [patch 1/5] phonet: use for_each_set_bit() by akpm on Thursday, March 11, 2010 - 3:07 pm. (3 messages)

Next thread: [PATCH 10/13] RDS: only put sockets that have seen congestion on the poll_waitq by Andy Grover on Thursday, March 11, 2010 - 4:50 pm. (1 message)