From patchwork Mon Nov 16 03:08:00 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 60187 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAG38pYs006087 for ; Mon, 16 Nov 2009 03:08:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752014AbZKPDIo (ORCPT ); Sun, 15 Nov 2009 22:08:44 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752011AbZKPDIo (ORCPT ); Sun, 15 Nov 2009 22:08:44 -0500 Received: from mail-gx0-f226.google.com ([209.85.217.226]:50516 "EHLO mail-gx0-f226.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751923AbZKPDIn (ORCPT ); Sun, 15 Nov 2009 22:08:43 -0500 Received: by gxk26 with SMTP id 26so446217gxk.1 for ; Sun, 15 Nov 2009 19:08:49 -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; bh=Bl/n/+2UWINxAZsxBnwvANx0ChRC3JHwvrBuxas5PMw=; b=AKdgPiWYACdaxPPJ74wXFblmAWq9dRHJAcpQCosMtn/veC99UpDZqoD4prTgzH562M bp1pML5QnFpevjVaGkZovruYnW30E33/wDgtzi6vmMriS2lC8jkuRYAdqDMkbhNnKQp5 eKMrdHrTDtZ6GmUsnA2TxsUzhWoWwcmDl6vCE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=Oppbb1J729qjv5xYsDxnzBKLiZooUUW92264vvV5fhsS7xBcbNeXtApG9Bz1VXYCpD CYpe4eTxk82oEwn9EnslhRvaqwUbmMmewnaEdRP3wqQ/WRnxTNT/DTJsdVmTiWIV+Xhz F9GMzcCQ7WyeUPvaLboGnZy0Lzw2UTKOhMjXE= Received: by 10.150.42.3 with SMTP id p3mr12587105ybp.63.1258340929143; Sun, 15 Nov 2009 19:08:49 -0800 (PST) Received: from localhost ([220.110.185.192]) by mx.google.com with ESMTPS id 6sm2281464ywd.52.2009.11.15.19.08.47 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 15 Nov 2009 19:08:48 -0800 (PST) From: Akinobu Mita To: akpm@linux-foundation.org, linux-kernel@vger.kernel.org Cc: Akinobu Mita , Ralph Campbell , Roland Dreier , Sean Hefty , Hal Rosenstock , linux-rdma@vger.kernel.org Subject: [PATCH] ipath: Use bitmap_weight Date: Mon, 16 Nov 2009 12:08:00 +0900 Message-Id: <1258340880-28269-1-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 1.6.5.1 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c index 013d138..d2787fe 100644 --- a/drivers/infiniband/hw/ipath/ipath_driver.c +++ b/drivers/infiniband/hw/ipath/ipath_driver.c @@ -39,6 +39,7 @@ #include #include #include +#include #include "ipath_kernel.h" #include "ipath_verbs.h" @@ -1697,7 +1698,7 @@ void ipath_chg_pioavailkernel(struct ipath_devdata *dd, unsigned start, unsigned len, int avail) { unsigned long flags; - unsigned end, cnt = 0, next; + unsigned end, cnt = 0; /* There are two bits per send buffer (busy and generation) */ start *= 2; @@ -1748,12 +1749,7 @@ void ipath_chg_pioavailkernel(struct ipath_devdata *dd, unsigned start, if (dd->ipath_pioupd_thresh) { end = 2 * (dd->ipath_piobcnt2k + dd->ipath_piobcnt4k); - next = find_first_bit(dd->ipath_pioavailkernel, end); - while (next < end) { - cnt++; - next = find_next_bit(dd->ipath_pioavailkernel, end, - next + 1); - } + cnt = bitmap_weight(dd->ipath_pioavailkernel, end); } spin_unlock_irqrestore(&ipath_pioavail_lock, flags);