mtd: vmu-flash: Use hweight_long

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Nov 30 05:59:01 EST 2009


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=782e5711d61b2cda45dea447badba3ab07c236f0
Commit:     782e5711d61b2cda45dea447badba3ab07c236f0
Parent:     8ce110ac19bc88b82e3feacfbb3a2ee08a07fe22
Author:     Akinobu Mita <akinobu.mita at gmail.com>
AuthorDate: Fri Nov 20 14:56:07 2009 +0900
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Fri Nov 20 10:31:23 2009 +0000

    mtd: vmu-flash: Use hweight_long
    
    Use hweight_long instead of Brian Kernighan's/Peter Wegner's method
    
    Signed-off-by: Akinobu Mita <akinobu.mita at gmail.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/maps/vmu-flash.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/maps/vmu-flash.c b/drivers/mtd/maps/vmu-flash.c
index 1f73297..1008462 100644
--- a/drivers/mtd/maps/vmu-flash.c
+++ b/drivers/mtd/maps/vmu-flash.c
@@ -612,10 +612,9 @@ static int __devinit vmu_connect(struct maple_device *mdev)
 
 	test_flash_data = be32_to_cpu(mdev->devinfo.function);
 	/* Need to count how many bits are set - to find out which
-	 * function_data element has details of the memory card:
-	 * using Brian Kernighan's/Peter Wegner's method */
-	for (c = 0; test_flash_data; c++)
-		test_flash_data &= test_flash_data - 1;
+	 * function_data element has details of the memory card
+	 */
+	c = hweight_long(test_flash_data);
 
 	basic_flash_data = be32_to_cpu(mdev->devinfo.function_data[c - 1]);
 



More information about the linux-mtd-cvs mailing list