diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2010-03-05 16:41:38 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-06 14:26:23 -0500 |
commit | 19b629f581320999ddb9f6597051b79cdb53459c (patch) | |
tree | 2be48184b1ec83f61ae4ab8a4e160d79597a30a4 /drivers | |
parent | 984b3f5746ed2cde3d184651dabf26980f2b66e5 (diff) |
infiniband: use for_each_set_bit()
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/core/mad.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 7522008fda86..58463da814d1 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c | |||
@@ -1193,10 +1193,7 @@ static int method_in_use(struct ib_mad_mgmt_method_table **method, | |||
1193 | { | 1193 | { |
1194 | int i; | 1194 | int i; |
1195 | 1195 | ||
1196 | for (i = find_first_bit(mad_reg_req->method_mask, IB_MGMT_MAX_METHODS); | 1196 | for_each_set_bit(i, mad_reg_req->method_mask, IB_MGMT_MAX_METHODS) { |
1197 | i < IB_MGMT_MAX_METHODS; | ||
1198 | i = find_next_bit(mad_reg_req->method_mask, IB_MGMT_MAX_METHODS, | ||
1199 | 1+i)) { | ||
1200 | if ((*method)->agent[i]) { | 1197 | if ((*method)->agent[i]) { |
1201 | printk(KERN_ERR PFX "Method %d already in use\n", i); | 1198 | printk(KERN_ERR PFX "Method %d already in use\n", i); |
1202 | return -EINVAL; | 1199 | return -EINVAL; |
@@ -1330,13 +1327,9 @@ static int add_nonoui_reg_req(struct ib_mad_reg_req *mad_reg_req, | |||
1330 | goto error3; | 1327 | goto error3; |
1331 | 1328 | ||
1332 | /* Finally, add in methods being registered */ | 1329 | /* Finally, add in methods being registered */ |
1333 | for (i = find_first_bit(mad_reg_req->method_mask, | 1330 | for_each_set_bit(i, mad_reg_req->method_mask, IB_MGMT_MAX_METHODS) |
1334 | IB_MGMT_MAX_METHODS); | ||
1335 | i < IB_MGMT_MAX_METHODS; | ||
1336 | i = find_next_bit(mad_reg_req->method_mask, IB_MGMT_MAX_METHODS, | ||
1337 | 1+i)) { | ||
1338 | (*method)->agent[i] = agent_priv; | 1331 | (*method)->agent[i] = agent_priv; |
1339 | } | 1332 | |
1340 | return 0; | 1333 | return 0; |
1341 | 1334 | ||
1342 | error3: | 1335 | error3: |
@@ -1429,13 +1422,9 @@ check_in_use: | |||
1429 | goto error4; | 1422 | goto error4; |
1430 | 1423 | ||
1431 | /* Finally, add in methods being registered */ | 1424 | /* Finally, add in methods being registered */ |
1432 | for (i = find_first_bit(mad_reg_req->method_mask, | 1425 | for_each_set_bit(i, mad_reg_req->method_mask, IB_MGMT_MAX_METHODS) |
1433 | IB_MGMT_MAX_METHODS); | ||
1434 | i < IB_MGMT_MAX_METHODS; | ||
1435 | i = find_next_bit(mad_reg_req->method_mask, IB_MGMT_MAX_METHODS, | ||
1436 | 1+i)) { | ||
1437 | (*method)->agent[i] = agent_priv; | 1426 | (*method)->agent[i] = agent_priv; |
1438 | } | 1427 | |
1439 | return 0; | 1428 | return 0; |
1440 | 1429 | ||
1441 | error4: | 1430 | error4: |