Re: [PATCH 09/12] mtd: nand: fsmc: validate ECC setup by checking algorithm directly

From: Joe Perches
Date: Fri Apr 15 2016 - 16:23:53 EST


On Fri, 2016-04-15 at 21:54 +0200, RafaÅ MiÅecki wrote:
> NAND core sets ECC algorithm in algo field now and it should be
> preferred over the mode field. This also prepares driver for dropping
> NAND_ECC_SOFT_BCH.
>
> Signed-off-by: RafaÅ MiÅecki <zajec5@xxxxxxxxx>
> ---
> Âdrivers/mtd/nand/fsmc_nand.c | 7 +++++--
> Â1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c
> index 1372040..0f8c63f 100644
> --- a/drivers/mtd/nand/fsmc_nand.c
> +++ b/drivers/mtd/nand/fsmc_nand.c
> @@ -958,9 +958,12 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
> Â nand->ecc.strength = 1;
> Â break;
> Â
> + case NAND_ECC_SOFT:
> Â case NAND_ECC_SOFT_BCH:
> - dev_info(&pdev->dev, "Using 4-bit SW BCH ECC scheme\n");
> - break;
> + if (nand->ecc.algo == NAND_ECC_BCH) {
> + dev_info(&pdev->dev, "Using 4-bit SW BCH ECC scheme\n");
> + break;
> + }
> Â
> Â default:
> Â dev_err(&pdev->dev, "Unsupported ECC mode!\n");

Why not just add NAND_ECC_SOFT above the default case?