Skip to contentSkip to conversation

omap-gpmc: use SECTOR_BYTES instead of hardcoded value

PATCH In review Ladislav Michl 2 participants 3 messages Jan 9, 2017 – Jan 15, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 omap-gpmc: use SECTOR_BYTES instead of hardcoded value

Replace hardcoded value with defined constant SECTOR_BYTES.

---
 drivers/mtd/nand/omap_gpmc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mtd/nand/omap_gpmc.c +4 -4
index d1e1bdda28..f4f0de395b 100644
@@ -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: ");
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 omap-gpmc: use SECTOR_BYTES instead of hardcoded value

Quoted 3 lines · Ladislav Michl

Replace hardcoded value with defined constant SECTOR_BYTES.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170110/eb1de979/attachment.sig>
#2 lore raw
In reply to Ladislav Michl
Quoted 4 lines · Ladislav Michl

Replace hardcoded value with defined constant SECTOR_BYTES.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170115/3eacc7d3/attachment.sig>