summaryrefslogtreecommitdiffstats
path: root/include/linux/mtd
diff options
context:
space:
mode:
authorBoris BREZILLON <boris.brezillon@free-electrons.com>2015-12-30 14:32:03 -0500
committerBrian Norris <computersforpeace@gmail.com>2016-01-06 21:45:46 -0500
commit6e9411923b8f4c0e568cbae0f35b7ee4eb989914 (patch)
treeec7bf6355c95b14fd19794119d7fd5fbfb9e0186 /include/linux/mtd
parent6f357de854a6dfb9ce0d5d65f3971cf3d0a4af6f (diff)
mtd: nand: return consistent error codes in ecc.correct() implementations
The error code returned by the ecc.correct() are not consistent over the all implementations. Document the expected behavior in include/linux/mtd/nand.h and fix offending implementations. [Brian: this looks like a bugfix for the ECC reporting in the bf5xx_nand driver, but we haven't seen any testing results for it] Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Tested-by: Franklin S Cooper Jr. <fcooper@ti.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'include/linux/mtd')
-rw-r--r--include/linux/mtd/nand.h8
-rw-r--r--include/linux/mtd/nand_bch.h2
2 files changed, 8 insertions, 2 deletions
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 3e92be1d2d43..518958115182 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -456,7 +456,13 @@ struct nand_hw_control {
456 * @hwctl: function to control hardware ECC generator. Must only 456 * @hwctl: function to control hardware ECC generator. Must only
457 * be provided if an hardware ECC is available 457 * be provided if an hardware ECC is available
458 * @calculate: function for ECC calculation or readback from ECC hardware 458 * @calculate: function for ECC calculation or readback from ECC hardware
459 * @correct: function for ECC correction, matching to ECC generator (sw/hw) 459 * @correct: function for ECC correction, matching to ECC generator (sw/hw).
460 * Should return a positive number representing the number of
461 * corrected bitflips, -EBADMSG if the number of bitflips exceed
462 * ECC strength, or any other error code if the error is not
463 * directly related to correction.
464 * If -EBADMSG is returned the input buffers should be left
465 * untouched.
460 * @read_page_raw: function to read a raw page without ECC. This function 466 * @read_page_raw: function to read a raw page without ECC. This function
461 * should hide the specific layout used by the ECC 467 * should hide the specific layout used by the ECC
462 * controller and always return contiguous in-band and 468 * controller and always return contiguous in-band and
diff --git a/include/linux/mtd/nand_bch.h b/include/linux/mtd/nand_bch.h
index 74acf5367556..fb0bc3420a10 100644
--- a/include/linux/mtd/nand_bch.h
+++ b/include/linux/mtd/nand_bch.h
@@ -55,7 +55,7 @@ static inline int
55nand_bch_correct_data(struct mtd_info *mtd, unsigned char *buf, 55nand_bch_correct_data(struct mtd_info *mtd, unsigned char *buf,
56 unsigned char *read_ecc, unsigned char *calc_ecc) 56 unsigned char *read_ecc, unsigned char *calc_ecc)
57{ 57{
58 return -1; 58 return -ENOTSUPP;
59} 59}
60 60
61static inline struct nand_bch_control * 61static inline struct nand_bch_control *