Use bitmap_weight to count the total number of bits set in bitmap.
This change just simplifies the code a bit.

Signed-off-by: Akinobu Mita <akinobu.m...@gmail.com>
Cc: Tony Luck <tony.l...@intel.com>
Cc: Fenghua Yu <fenghua...@intel.com>
Cc: linux-i...@vger.kernel.org
---
 arch/ia64/hp/common/sba_iommu.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index 344387a..9c944fa 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -33,7 +33,7 @@
 #include <linux/acpi.h>
 #include <linux/efi.h>
 #include <linux/nodemask.h>
-#include <linux/bitops.h>         /* hweight64() */
+#include <linux/bitmap.h>         /* bitmap_weight() */
 #include <linux/crash_dump.h>
 #include <linux/iommu-helper.h>
 #include <linux/dma-mapping.h>
@@ -1901,8 +1901,7 @@ static int
 ioc_show(struct seq_file *s, void *v)
 {
        struct ioc *ioc = v;
-       unsigned long *res_ptr = (unsigned long *)ioc->res_map;
-       int i, used = 0;
+       int used;
 
        seq_printf(s, "Hewlett Packard %s IOC rev %d.%d\n",
                ioc->name, ((ioc->rev >> 4) & 0xF), (ioc->rev & 0xF));
@@ -1913,8 +1912,8 @@ ioc_show(struct seq_file *s, void *v)
        seq_printf(s, "IOVA size       : %ld MB\n", ((ioc->pdir_size >> 3) * 
iovp_size)/(1024*1024));
        seq_printf(s, "IOVA page size  : %ld kb\n", iovp_size/1024);
 
-       for (i = 0; i < (ioc->res_size / sizeof(unsigned long)); ++i, ++res_ptr)
-               used += hweight64(*res_ptr);
+       used = bitmap_weight((unsigned long *)ioc->res_map,
+                       ioc->res_size * BITS_PER_BYTE);
 
        seq_printf(s, "PDIR size       : %d entries\n", ioc->pdir_size >> 3);
        seq_printf(s, "PDIR used       : %d entries\n", used);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to