mtd: nand: vf610_nfc: use nand_check_erased_ecc_chunk() helper
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Fri Nov 6 10:59:27 PST 2015
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=48c25cf441182e629e52e7f9fa56c2019e75fb00
Commit: 48c25cf441182e629e52e7f9fa56c2019e75fb00
Parent: b70af9bef49bd9a5f4e7a2327d9074e29653e665
Author: Brian Norris <computersforpeace at gmail.com>
AuthorDate: Tue Sep 29 14:11:56 2015 -0700
Committer: Brian Norris <computersforpeace at gmail.com>
CommitDate: Mon Oct 26 13:05:42 2015 -0700
mtd: nand: vf610_nfc: use nand_check_erased_ecc_chunk() helper
Signed-off-by: Brian Norris <computersforpeace at gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon at free-electrons.com>
---
drivers/mtd/nand/vf610_nfc.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/mtd/nand/vf610_nfc.c b/drivers/mtd/nand/vf610_nfc.c
index d275691..8805d63 100644
--- a/drivers/mtd/nand/vf610_nfc.c
+++ b/drivers/mtd/nand/vf610_nfc.c
@@ -561,7 +561,6 @@ static inline int vf610_nfc_correct_data(struct mtd_info *mtd, uint8_t *dat,
u32 ecc_status_off = NFC_MAIN_AREA(0) + ECC_SRAM_ADDR + ECC_STATUS;
u8 ecc_status;
u8 ecc_count;
- int flips;
int flips_threshold = nfc->chip.ecc.strength / 2;
ecc_status = vf610_nfc_read(nfc, ecc_status_off) & 0xff;
@@ -578,16 +577,9 @@ static inline int vf610_nfc_correct_data(struct mtd_info *mtd, uint8_t *dat,
* On an erased page, bit count (including OOB) should be zero or
* at least less then half of the ECC strength.
*/
- flips = count_written_bits(dat, nfc->chip.ecc.size, flips_threshold);
- flips += count_written_bits(oob, mtd->oobsize, flips_threshold);
-
- if (unlikely(flips > flips_threshold))
- return -EINVAL;
-
- /* Erased page. */
- memset(dat, 0xff, nfc->chip.ecc.size);
- memset(oob, 0xff, mtd->oobsize);
- return flips;
+ return nand_check_erased_ecc_chunk(dat, nfc->chip.ecc.size, oob,
+ mtd->oobsize, NULL, 0,
+ flips_threshold);
}
static int vf610_nfc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
More information about the linux-mtd-cvs
mailing list