aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtdchar.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@cruncher.tec.linutronix.de>2006-05-29 08:56:39 -0400
committerThomas Gleixner <tglx@cruncher.tec.linutronix.de>2006-05-29 09:06:51 -0400
commit9a1fcdfd4bee27c418424cac47abf7c049541297 (patch)
tree5baa5f1e1d1a296a319bf6a5a4b636668c107e00 /drivers/mtd/mtdchar.c
parent8593fbc68b0df1168995de76d1af38eb62fd6b62 (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/mtdchar.c')
-rw-r--r--drivers/mtd/mtdchar.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 7522fc3a2827..a48210d58b92 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -199,10 +199,13 @@ static ssize_t mtd_read(struct file *file, char __user *buf, size_t count,loff_t
199 /* Nand returns -EBADMSG on ecc errors, but it returns 199 /* Nand returns -EBADMSG on ecc errors, but it returns
200 * the data. For our userspace tools it is important 200 * the data. For our userspace tools it is important
201 * to dump areas with ecc errors ! 201 * to dump areas with ecc errors !
202 * For kernel internal usage it also might return -EUCLEAN
203 * to signal the caller that a bitflip has occured and has
204 * been corrected by the ECC algorithm.
202 * Userspace software which accesses NAND this way 205 * Userspace software which accesses NAND this way
203 * must be aware of the fact that it deals with NAND 206 * must be aware of the fact that it deals with NAND
204 */ 207 */
205 if (!ret || (ret == -EBADMSG)) { 208 if (!ret || (ret == -EUCLEAN) || (ret == -EBADMSG)) {
206 *ppos += retlen; 209 *ppos += retlen;
207 if (copy_to_user(buf, kbuf, retlen)) { 210 if (copy_to_user(buf, kbuf, retlen)) {
208 kfree(kbuf); 211 kfree(kbuf);