Commit 598cb6f3 authored by Akinobu Mita's avatar Akinobu Mita Committed by Roland Dreier

IB/ipath: Use bitmap_weight()

Use bitmap_weight() instead of finding all set bits in bitmap by hand.
Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Cc: Ralph Campbell <infinipath@qlogic.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 91d3f9ba
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/bitmap.h>
#include "ipath_kernel.h" #include "ipath_kernel.h"
#include "ipath_verbs.h" #include "ipath_verbs.h"
...@@ -1697,7 +1698,7 @@ void ipath_chg_pioavailkernel(struct ipath_devdata *dd, unsigned start, ...@@ -1697,7 +1698,7 @@ void ipath_chg_pioavailkernel(struct ipath_devdata *dd, unsigned start,
unsigned len, int avail) unsigned len, int avail)
{ {
unsigned long flags; unsigned long flags;
unsigned end, cnt = 0, next; unsigned end, cnt = 0;
/* There are two bits per send buffer (busy and generation) */ /* There are two bits per send buffer (busy and generation) */
start *= 2; start *= 2;
...@@ -1748,12 +1749,7 @@ void ipath_chg_pioavailkernel(struct ipath_devdata *dd, unsigned start, ...@@ -1748,12 +1749,7 @@ void ipath_chg_pioavailkernel(struct ipath_devdata *dd, unsigned start,
if (dd->ipath_pioupd_thresh) { if (dd->ipath_pioupd_thresh) {
end = 2 * (dd->ipath_piobcnt2k + dd->ipath_piobcnt4k); end = 2 * (dd->ipath_piobcnt2k + dd->ipath_piobcnt4k);
next = find_first_bit(dd->ipath_pioavailkernel, end); cnt = bitmap_weight(dd->ipath_pioavailkernel, end);
while (next < end) {
cnt++;
next = find_next_bit(dd->ipath_pioavailkernel, end,
next + 1);
}
} }
spin_unlock_irqrestore(&ipath_pioavail_lock, flags); spin_unlock_irqrestore(&ipath_pioavail_lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment