mtd: alauda: Use hweight8

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


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=54c69cc25064c1d333a12b5883aaa3bfa3041dee
Commit:     54c69cc25064c1d333a12b5883aaa3bfa3041dee
Parent:     e670e41ae0f329487e5a5c357510c6798b0d80b4
Author:     Akinobu Mita <akinobu.mita at gmail.com>
AuthorDate: Fri Nov 13 16:02:22 2009 +0900
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Mon Nov 30 09:53:19 2009 +0000

    mtd: alauda: Use hweight8
    
    Signed-off-by: Akinobu Mita <akinobu.mita at gmail.com>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/nand/alauda.c |   11 +----------
 1 files changed, 1 insertions(+), 10 deletions(-)

diff --git a/drivers/mtd/nand/alauda.c b/drivers/mtd/nand/alauda.c
index 6d96491..2d67732 100644
--- a/drivers/mtd/nand/alauda.c
+++ b/drivers/mtd/nand/alauda.c
@@ -372,15 +372,6 @@ static int alauda_read_oob(struct mtd_info *mtd, loff_t from, void *oob)
 	return __alauda_read_page(mtd, from, ignore_buf, oob);
 }
 
-static int popcount8(u8 c)
-{
-	int ret = 0;
-
-	for ( ; c; c>>=1)
-		ret += c & 1;
-	return ret;
-}
-
 static int alauda_isbad(struct mtd_info *mtd, loff_t ofs)
 {
 	u8 oob[16];
@@ -391,7 +382,7 @@ static int alauda_isbad(struct mtd_info *mtd, loff_t ofs)
 		return err;
 
 	/* A block is marked bad if two or more bits are zero */
-	return popcount8(oob[5]) >= 7 ? 0 : 1;
+	return hweight8(oob[5]) >= 7 ? 0 : 1;
 }
 
 static int alauda_bounce_read(struct mtd_info *mtd, loff_t from, size_t len,



More information about the linux-mtd-cvs mailing list