]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
bridge: using for_each_set_bit to simplify the code
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Mon, 11 Mar 2013 05:45:23 +0000 (05:45 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 12 Mar 2013 12:04:09 +0000 (08:04 -0400)
Using for_each_set_bit() to simplify the code.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_fdb.c
net/bridge/br_netlink.c

index 48fe76176a22d7ea46b97ebfc4414b3b046a2230..10b47d4cdfe48604f857c6bece68bc2855a6a6d3 100644 (file)
@@ -722,13 +722,10 @@ int br_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
                 * specify a VLAN.  To be nice, add/update entry for every
                 * vlan on this port.
                 */
-               vid = find_first_bit(pv->vlan_bitmap, BR_VLAN_BITMAP_LEN);
-               while (vid < BR_VLAN_BITMAP_LEN) {
+               for_each_set_bit(vid, pv->vlan_bitmap, BR_VLAN_BITMAP_LEN) {
                        err = __br_fdb_add(ndm, p, addr, nlh_flags, vid);
                        if (err)
                                goto out;
-                       vid = find_next_bit(pv->vlan_bitmap,
-                                           BR_VLAN_BITMAP_LEN, vid+1);
                }
        }
 
@@ -813,11 +810,8 @@ int br_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[],
                 * vlan on this port.
                 */
                err = -ENOENT;
-               vid = find_first_bit(pv->vlan_bitmap, BR_VLAN_BITMAP_LEN);
-               while (vid < BR_VLAN_BITMAP_LEN) {
+               for_each_set_bit(vid, pv->vlan_bitmap, BR_VLAN_BITMAP_LEN) {
                        err &= __br_fdb_delete(p, addr, vid);
-                       vid = find_next_bit(pv->vlan_bitmap,
-                                           BR_VLAN_BITMAP_LEN, vid+1);
                }
        }
 out:
index db12a0fcfe50246e274c235fd353778a9671b99f..138284219c6d7e3d9479086e1112f2f8d4c7b375 100644 (file)
@@ -136,10 +136,7 @@ static int br_fill_ifinfo(struct sk_buff *skb,
                        goto nla_put_failure;
 
                pvid = br_get_pvid(pv);
-               for (vid = find_first_bit(pv->vlan_bitmap, BR_VLAN_BITMAP_LEN);
-                    vid < BR_VLAN_BITMAP_LEN;
-                    vid = find_next_bit(pv->vlan_bitmap,
-                                        BR_VLAN_BITMAP_LEN, vid+1)) {
+               for_each_set_bit(vid, pv->vlan_bitmap, BR_VLAN_BITMAP_LEN) {
                        vinfo.vid = vid;
                        vinfo.flags = 0;
                        if (vid == pvid)