Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 54c69cc2 authored by Akinobu Mita's avatar Akinobu Mita Committed by David Woodhouse
Browse files

mtd: alauda: Use hweight8

parent e670e41a
Loading
Loading
Loading
Loading
+1 −10
Original line number Original line Diff line number Diff line
@@ -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);
	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)
static int alauda_isbad(struct mtd_info *mtd, loff_t ofs)
{
{
	u8 oob[16];
	u8 oob[16];
@@ -391,7 +382,7 @@ static int alauda_isbad(struct mtd_info *mtd, loff_t ofs)
		return err;
		return err;


	/* A block is marked bad if two or more bits are zero */
	/* 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,
static int alauda_bounce_read(struct mtd_info *mtd, loff_t from, size_t len,