]> git.sur5r.net Git - u-boot/commitdiff
omap-gpmc: use SECTOR_BYTES instead of hardcoded value
authorLadislav Michl <ladis@linux-mips.org>
Mon, 9 Jan 2017 10:15:14 +0000 (11:15 +0100)
committerTom Rini <trini@konsulko.com>
Sat, 14 Jan 2017 21:47:18 +0000 (16:47 -0500)
Replace hardcoded value with defined constant SECTOR_BYTES.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
drivers/mtd/nand/omap_gpmc.c

index d1e1bdda280ac2223e66d5dae4511cc268a86186..f4f0de395b75bf4245ff119cb053d6970669f14d 100644 (file)
@@ -656,14 +656,14 @@ static int omap_correct_data_bch_sw(struct mtd_info *mtd, u_char *data,
        struct nand_chip *chip = mtd_to_nand(mtd);
        struct omap_nand_info *info = nand_get_controller_data(chip);
 
-       count = decode_bch(info->control, NULL, 512, read_ecc, calc_ecc,
-                                                       NULL, errloc);
+       count = decode_bch(info->control, NULL, SECTOR_BYTES,
+                               read_ecc, calc_ecc, NULL, errloc);
        if (count > 0) {
                /* correct errors */
                for (i = 0; i < count; i++) {
                        /* correct data only, not ecc bytes */
-                       if (errloc[i] < 8*512)
-                               data[errloc[i]/8] ^= 1 << (errloc[i] & 7);
+                       if (errloc[i] < SECTOR_BYTES << 3)
+                               data[errloc[i] >> 3] ^= 1 << (errloc[i] & 7);
                        debug("corrected bitflip %u\n", errloc[i]);
 #ifdef DEBUG
                        puts("read_ecc: ");