From patchwork Mon Feb 1 15:10:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 76100 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o11FGii0021970 for ; Mon, 1 Feb 2010 15:16:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755042Ab0BAPPF (ORCPT ); Mon, 1 Feb 2010 10:15:05 -0500 Received: from mail-fx0-f220.google.com ([209.85.220.220]:55475 "EHLO mail-fx0-f220.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754951Ab0BAPPB (ORCPT ); Mon, 1 Feb 2010 10:15:01 -0500 Received: by mail-fx0-f220.google.com with SMTP id 20so4336961fxm.21 for ; Mon, 01 Feb 2010 07:15:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=x6rOrMwfjVaGOwr6spgdR3gpxak7jOagt8uCJqEJLWU=; b=FeNiaZj0Av3r06Np++NIQfFbGHIRESy1vJJUVEbY9B2+zQZV6Zh5yv6a6lnIhF6MC3 ddu9Jf/RTg/duT3DjyhrVte1mImzCehEB9hQtDb0rktI5wi0gxioqjk4x/iZ1IWkQT09 0T7nAxH2es9zIp0r4gfG0FgURSCrTpdE0oiGw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=i8NoJw0ueizR4zV+JrT9JqaHE//LfCE/e8pbFRkOamPCed3PMFlkzbzQzX7+/JRGHt uE9N+PPGiLxEgKqH8tumA9fJ2hmX9XzsuA5KifdCklPoOeyWKrKy8GnCUZyhkLXM7xGe NKVOfJ65a8pWotHJP/PcsXCip8FwifxJaBlt8= Received: by 10.223.144.85 with SMTP id y21mr4569440fau.71.1265037299989; Mon, 01 Feb 2010 07:14:59 -0800 (PST) Received: from localhost (p12138-adsao01yokonib1-acca.kanagawa.ocn.ne.jp [61.199.6.138]) by mx.google.com with ESMTPS id 14sm1934616fxm.11.2010.02.01.07.14.57 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 01 Feb 2010 07:14:58 -0800 (PST) From: Akinobu Mita To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org Cc: Akinobu Mita , Roland Dreier , Sean Hefty , Hal Rosenstock , linux-rdma@vger.kernel.org Subject: [PATCH 7/9] infiniband: Use for_each_set_bit Date: Tue, 2 Feb 2010 00:10:38 +0900 Message-Id: <1265037040-23413-7-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 1.6.0.6 In-Reply-To: <1265037040-23413-1-git-send-email-akinobu.mita@gmail.com> References: <1265037040-23413-1-git-send-email-akinobu.mita@gmail.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 01 Feb 2010 15:16:44 +0000 (UTC) diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 7522008..58463da 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, { 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: