[PATCH 2/3][v2] nand_base: use nand_ooblayout_lp_hamming_ops for 1bit hamming as default

Boris Brezillon boris.brezillon at free-electrons.com
Tue May 2 01:49:02 PDT 2017


On Tue,  2 May 2017 10:13:22 +0200
Alexander Couzens <lynxis at fe80.eu> wrote:

> commit 41b207a70d3a ("mtd: nand: implement the default mtd_ooblayout_ops")
> uses a different ooblayout for platforms which doesn't set the
> layout by itself. Use for 1bit hamming the old layout.

Please merge patch 1 and 2 so that we end up with a
simple/self-contained patch that can be backported to stable kernels.

> 
> Signed-off-by: Alexander Couzens <lynxis at fe80.eu>
> ---
>  drivers/mtd/nand/nand_base.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index daf3df157885..6a9e99377181 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -4724,7 +4724,11 @@ int nand_scan_tail(struct mtd_info *mtd)
>  			break;
>  		case 64:
>  		case 128:
> -			mtd_set_ooblayout(mtd, &nand_ooblayout_lp_ops);
> +			if (ecc->algo == NAND_ECC_HAMMING && ecc->strength == 1)
> +				mtd_set_ooblayout(mtd,
> +						&nand_ooblayout_lp_hamming_ops);
> +			else
> +				mtd_set_ooblayout(mtd, &nand_ooblayout_lp_ops);

Why not unconditionally setting it to nand_ooblayout_lp_hamming_ops to
restore the initial behavior. If one wants to use the new "large page"
layout he can still explicitly assign it (which is a good practice
anyway).

>  			break;
>  		default:
>  			WARN(1, "No oob scheme defined for oobsize %d\n",




More information about the linux-mtd mailing list