Re: [PATCH V2 09/11] mtd: nand: read ECC algorithm from the new field

From: Boris Brezillon
Date: Sun Apr 17 2016 - 15:01:25 EST


On Sun, 17 Apr 2016 19:11:42 +0200
RafaÅ MiÅecki <zajec5@xxxxxxxxx> wrote:

> Now we have all drivers properly setting this new field we can start
> using it. For a very short period of time we should support both values:
> NAND_ECC_SOFT and NAND_ECC_SOFT_BCH treating them the same. It's because
> of_get_nand_ecc_mode may still be setting NAND_ECC_SOFT_BCH.
>
> Signed-off-by: RafaÅ MiÅecki <zajec5@xxxxxxxxx>
> ---
> V2: Move SOFT-related code to separated functions
> Add missing checks for SOFT before checking Hamming vs. BCH
> ---
> drivers/mtd/nand/nand_base.c | 116 ++++++++++++++++++++++++++-----------------
> 1 file changed, 71 insertions(+), 45 deletions(-)
>
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c

[...]

>
> @@ -4154,7 +4217,9 @@ int nand_scan_tail(struct mtd_info *mtd)
> /*
> * If no default placement scheme is given, select an appropriate one.
> */
> - if (!mtd->ooblayout && (ecc->mode != NAND_ECC_SOFT_BCH)) {
> + if (!mtd->ooblayout &&
> + (ecc->mode == NAND_ECC_SOFT || ecc->mode == NAND_ECC_SOFT_BCH) &&
> + ecc->algo != NAND_ECC_BCH) {

Sorry, I got this wrong in my previous review. It should be

if (!mtd->ooblayout &&
((ecc->mode != NAND_ECC_SOFT &&
ecc->mode != NAND_ECC_SOFT_BCH) ||
ecc->algo != NAND_ECC_BCH) {

otherwise we're only addressing the software ECC case, and IIRC, some
drivers rely on these default layouts for their HW ECC implementation.

The rest looks good to me.

Thanks,

Boris


--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com