aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/alauda.c
diff options
context:
space:
mode:
authorMike Dunn <mikedunn@newsguy.com>2012-04-25 15:06:11 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-05-14 00:14:23 -0400
commitedbc4540e02c201bdd4f4d498ebb6ed517fd36e2 (patch)
tree403ee7318cb1218a224885d048781e35f2128a22 /drivers/mtd/nand/alauda.c
parente2788c98b98269a3131bffd2b57599280d7abd73 (diff)
mtd: driver _read() returns max_bitflips; mtd_read() returns -EUCLEAN
The drivers' _read() method, absent an error, returns a non-negative integer indicating the maximum number of bit errors that were corrected in any one region comprising an ecc step. MTD returns -EUCLEAN if this is >= bitflip_threshold, 0 otherwise. If bitflip_threshold is zero, the comparison is not made since these devices lack ECC and always return zero in the non-error case (thanks Brian)¹. Note that this is a subtle change to the driver interface. This and the preceding patches in this set were tested with ubi on top of the nandsim and docg4 devices, running the ubi test io_basic from mtd-utils. ¹ http://lists.infradead.org/pipermail/linux-mtd/2012-March/040468.html Signed-off-by: Mike Dunn <mikedunn@newsguy.com> Acked-by: Robert Jarzmik <robert.jarzmik@free.fr> Acked-by: Brian Norris <computersforpeace@gmail.com> Ivan Djelic <ivan.djelic@parrot.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/nand/alauda.c')
-rw-r--r--drivers/mtd/nand/alauda.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/nand/alauda.c b/drivers/mtd/nand/alauda.c
index 4f20e1d8bef1..60a0dfdb0808 100644
--- a/drivers/mtd/nand/alauda.c
+++ b/drivers/mtd/nand/alauda.c
@@ -414,7 +414,7 @@ static int alauda_bounce_read(struct mtd_info *mtd, loff_t from, size_t len,
414 } 414 }
415 err = 0; 415 err = 0;
416 if (corrected) 416 if (corrected)
417 err = -EUCLEAN; 417 err = 1; /* return max_bitflips per ecc step */
418 if (uncorrected) 418 if (uncorrected)
419 err = -EBADMSG; 419 err = -EBADMSG;
420out: 420out:
@@ -446,7 +446,7 @@ static int alauda_read(struct mtd_info *mtd, loff_t from, size_t len,
446 } 446 }
447 err = 0; 447 err = 0;
448 if (corrected) 448 if (corrected)
449 err = -EUCLEAN; 449 err = 1; /* return max_bitflips per ecc step */
450 if (uncorrected) 450 if (uncorrected)
451 err = -EBADMSG; 451 err = -EBADMSG;
452 return err; 452 return err;