diff mbox series

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

Message ID 20170502081323.3138-3-lynxis@fe80.eu
State New
Headers show
Series fixing 1bit hamming | expand

Commit Message

Alexander Couzens May 2, 2017, 8:13 a.m. UTC
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.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>

---
 drivers/mtd/nand/nand_base.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

-- 
2.12.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

Comments

Boris Brezillon May 2, 2017, 8:49 a.m. UTC | #1
On Tue,  2 May 2017 10:13:22 +0200
Alexander Couzens <lynxis@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@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",



______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
diff mbox series

Patch

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);
 			break;
 		default:
 			WARN(1, "No oob scheme defined for oobsize %d\n",