]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
infiniband: use for_each_set_bit()
authorAkinobu Mita <akinobu.mita@gmail.com>
Fri, 5 Mar 2010 21:41:38 +0000 (13:41 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 6 Mar 2010 19:26:23 +0000 (11:26 -0800)
Replace open-coded loop with for_each_set_bit().

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Roland Dreier <rolandd@cisco.com>
Cc: Sean Hefty <sean.hefty@intel.com>
Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/infiniband/core/mad.c

index 7522008fda86880f759128e694d9df0cda68c764..58463da814d1c671272df2ab4f778986ef84f4dc 100644 (file)
@@ -1193,10 +1193,7 @@ static int method_in_use(struct ib_mad_mgmt_method_table **method,
 {
        int i;
 
-       for (i = find_first_bit(mad_reg_req->method_mask, IB_MGMT_MAX_METHODS);
-            i < IB_MGMT_MAX_METHODS;
-            i = find_next_bit(mad_reg_req->method_mask, IB_MGMT_MAX_METHODS,
-                              1+i)) {
+       for_each_set_bit(i, mad_reg_req->method_mask, IB_MGMT_MAX_METHODS) {
                if ((*method)->agent[i]) {
                        printk(KERN_ERR PFX "Method %d already in use\n", i);
                        return -EINVAL;
@@ -1330,13 +1327,9 @@ static int add_nonoui_reg_req(struct ib_mad_reg_req *mad_reg_req,
                goto error3;
 
        /* Finally, add in methods being registered */
-       for (i = find_first_bit(mad_reg_req->method_mask,
-                               IB_MGMT_MAX_METHODS);
-            i < IB_MGMT_MAX_METHODS;
-            i = find_next_bit(mad_reg_req->method_mask, IB_MGMT_MAX_METHODS,
-                              1+i)) {
+       for_each_set_bit(i, mad_reg_req->method_mask, IB_MGMT_MAX_METHODS)
                (*method)->agent[i] = agent_priv;
-       }
+
        return 0;
 
 error3:
@@ -1429,13 +1422,9 @@ check_in_use:
                goto error4;
 
        /* Finally, add in methods being registered */
-       for (i = find_first_bit(mad_reg_req->method_mask,
-                               IB_MGMT_MAX_METHODS);
-            i < IB_MGMT_MAX_METHODS;
-            i = find_next_bit(mad_reg_req->method_mask, IB_MGMT_MAX_METHODS,
-                              1+i)) {
+       for_each_set_bit(i, mad_reg_req->method_mask, IB_MGMT_MAX_METHODS)
                (*method)->agent[i] = agent_priv;
-       }
+
        return 0;
 
 error4: