mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 19:26:25 +00:00
mtd: alauda: Use hweight8
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:
parent
e670e41ae0
commit
54c69cc250
1 changed files with 1 additions and 10 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue