[U-Boot] [PATCH v1 2/2] mtd: nand: omap: fix ecclayout to be in sync with u-boot NAND driver
Brian Norris
computersforpeace at gmail.com
Sat Jan 25 09:57:19 CET 2014
On Fri, Dec 13, 2013 at 02:42:58PM +0530, Pekon Gupta wrote:
> @@ -1851,7 +1854,13 @@ static int omap_nand_probe(struct platform_device *pdev)
> ecclayout->eccbytes = nand_chip->ecc.bytes *
> (mtd->writesize /
> nand_chip->ecc.size);
> - ecclayout->eccpos[0] = BADBLOCK_MARKER_LENGTH;
> + oob_index = BADBLOCK_MARKER_LENGTH;
> + for (i = 0; i < ecclayout->eccbytes; i++, oob_index++) {
> + if ((i % nand_chip->ecc.bytes) || (i == 0))
> + ecclayout->eccpos[i] = oob_index;
> + else
> + ecclayout->eccpos[i] = ++oob_index;
This if-else structure, with a combined assignment and increment kind of
obscures the logic of what you're really trying to do. Could this be
better as follows?
for (i = 0; i < ecclayout->eccbytes; i++, oob_index++) {
ecclayout->eccpos[i] = oob_index;
if (((i + 1) % nand_chip->ecc.bytes) == 0)
oob_index++;
}
> + }
> /* software bch library is used for locating errors */
> nand_chip->ecc.priv = nand_bch_init(mtd,
> nand_chip->ecc.size,
Brian
More information about the U-Boot
mailing list