Skip to contentSkip to conversation

phonet: use for_each_set_bit()

PATCH Applied [email protected] 3 participants 3 messages Mar 11, 2010 – Mar 15, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/5 phonet: use for_each_set_bit()

From: Akinobu Mita <[email protected]>

Replace open-coded loop with for_each_set_bit().

---

 net/phonet/pn_dev.c     |    3 +--
 net/phonet/pn_netlink.c |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
net/phonet/pn_dev.c renamed from net/phonet/pn_dev.c~phonet-use-for_each_set_bit +1 -2
diff -puN net/phonet/pn_dev.c~phonet-use-for_each_set_bit net/phonet/pn_dev.c
@@ -107,8 +107,7 @@ static void phonet_device_destroy(struct
 	if (pnd) {
 		u8 addr;
 
-		for (addr = find_first_bit(pnd->addrs, 64); addr < 64;
-			addr = find_next_bit(pnd->addrs, 64, 1+addr))
+		for_each_set_bit(addr, pnd->addrs, 64)
 			phonet_address_notify(RTM_DELADDR, dev, addr);
 		kfree(pnd);
 	}
net/phonet/pn_netlink.c renamed from net/phonet/pn_netlink.c~phonet-use-for_each_set_bit +1 -2
diff -puN net/phonet/pn_netlink.c~phonet-use-for_each_set_bit net/phonet/pn_netlink.c
@@ -141,8 +141,7 @@ static int getaddr_dumpit(struct sk_buff
 			continue;
 
 		addr_idx = 0;
-		for (addr = find_first_bit(pnd->addrs, 64); addr < 64;
-			addr = find_next_bit(pnd->addrs, 64, 1+addr)) {
+		for_each_set_bit(addr, pnd->addrs, 64) {
 			if (addr_idx++ < addr_start_idx)
 				continue;
 

_

Acked-by on v1 1/5
#1 lore raw
Quoted 7 lines · On Thu, 11 Mar 2010 14:07:49 -0800, [email protected] wrote:

From: Akinobu Mita <[email protected]>

Replace open-coded loop with for_each_set_bit().

Signature · 3 lines
Rémi Denis-Courmont
http://www.remlab.net
http://fi.linkedin.com/in/remidenis