Patchwork [1/5] phonet: use for_each_set_bit()

login
register
mail settings
Submitter Andrew Morton
Date March 11, 2010, 10:07 p.m.
Message ID <201003112207.o2BM7nQn013486@imap1.linux-foundation.org>
Download mbox | patch
Permalink /patch/47639/
State Accepted
Delegated to: David Miller
Headers show

Comments

Andrew Morton - March 11, 2010, 10:07 p.m.
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: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 net/phonet/pn_dev.c     |    3 +--
 net/phonet/pn_netlink.c |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
Rémi Denis-Courmont - March 12, 2010, 7:34 a.m.
On Thu, 11 Mar 2010 14:07:49 -0800, akpm@linux-foundation.org wrote:
> 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: "David S. Miller" <davem@davemloft.net>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Acked-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
David Miller - March 15, 2010, 11:05 p.m.
From: akpm@linux-foundation.org
Date: Thu, 11 Mar 2010 14:07:49 -0800

> 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: "David S. Miller" <davem@davemloft.net>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff -puN net/phonet/pn_dev.c~phonet-use-for_each_set_bit net/phonet/pn_dev.c
--- a/net/phonet/pn_dev.c~phonet-use-for_each_set_bit
+++ a/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);
 	}
diff -puN net/phonet/pn_netlink.c~phonet-use-for_each_set_bit net/phonet/pn_netlink.c
--- a/net/phonet/pn_netlink.c~phonet-use-for_each_set_bit
+++ a/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;