diff options
author | Thomas Gleixner <tglx@cruncher.tec.linutronix.de> | 2006-05-29 08:56:39 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@cruncher.tec.linutronix.de> | 2006-05-29 09:06:51 -0400 |
commit | 9a1fcdfd4bee27c418424cac47abf7c049541297 (patch) | |
tree | 5baa5f1e1d1a296a319bf6a5a4b636668c107e00 /drivers/mtd/mtdconcat.c | |
parent | 8593fbc68b0df1168995de76d1af38eb62fd6b62 (diff) |
[MTD] NAND Signal that a bitflip was corrected by ECC
Return -EUCLEAN on read when a bitflip was detected and corrected, so the
clients can react and eventually copy the affected block to a spare one.
Make all in kernel users aware of the change.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/mtd/mtdconcat.c')
-rw-r--r-- | drivers/mtd/mtdconcat.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index 38151b8e6631..3c8d5e6fa010 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c | |||
@@ -56,7 +56,7 @@ concat_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
56 | size_t * retlen, u_char * buf) | 56 | size_t * retlen, u_char * buf) |
57 | { | 57 | { |
58 | struct mtd_concat *concat = CONCAT(mtd); | 58 | struct mtd_concat *concat = CONCAT(mtd); |
59 | int err = -EINVAL; | 59 | int ret = 0, err = -EINVAL; |
60 | int i; | 60 | int i; |
61 | 61 | ||
62 | *retlen = 0; | 62 | *retlen = 0; |
@@ -80,9 +80,18 @@ concat_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
80 | 80 | ||
81 | err = subdev->read(subdev, from, size, &retsize, buf); | 81 | err = subdev->read(subdev, from, size, &retsize, buf); |
82 | 82 | ||
83 | if (err) | 83 | if (err && (err != -EBADMSG) && (err != -EUCLEAN)) |
84 | break; | 84 | break; |
85 | 85 | ||
86 | /* Save information about bitflips! */ | ||
87 | if (err) { | ||
88 | if (err == -EBADMSG) | ||
89 | ret = err; | ||
90 | else if (!ret) | ||
91 | ret = err; | ||
92 | err = 0; | ||
93 | } | ||
94 | |||
86 | *retlen += retsize; | 95 | *retlen += retsize; |
87 | len -= size; | 96 | len -= size; |
88 | if (len == 0) | 97 | if (len == 0) |
@@ -92,7 +101,7 @@ concat_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
92 | buf += size; | 101 | buf += size; |
93 | from = 0; | 102 | from = 0; |
94 | } | 103 | } |
95 | return err; | 104 | return err ? err : ret; |
96 | } | 105 | } |
97 | 106 | ||
98 | static int | 107 | static int |