Skip to content

Commit 86f2b22

Browse files
committed
mtd: rawnand: Add an invalid ECC mode to discriminate with valid ones
NAND ECC modes (or providers) have their own enumeration but, unlike their algorithms counterpart, there is no invalid or uninitialized value to discriminate between an error and having chosen a no-ECC situation. Add an "invalid" entry for this purpose. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Link: https://lore.kernel.org/linux-mtd/20200526195633.11543-7-miquel.raynal@bootlin.com
1 parent dbc2f2e commit 86f2b22

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

‎drivers/mtd/nand/raw/nand_base.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5022,7 +5022,7 @@ static int of_get_nand_ecc_mode(struct device_node *np)
50225022
if (err < 0)
50235023
return err;
50245024

5025-
for (i = 0; i < ARRAY_SIZE(nand_ecc_modes); i++)
5025+
for (i = NAND_ECC_NONE; i < ARRAY_SIZE(nand_ecc_modes); i++)
50265026
if (!strcasecmp(pm, nand_ecc_modes[i]))
50275027
return i;
50285028

‎include/linux/mtd/rawnand.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ struct nand_chip;
8484
* Constants for ECC_MODES
8585
*/
8686
enum nand_ecc_mode {
87+
NAND_ECC_INVALID,
8788
NAND_ECC_NONE,
8889
NAND_ECC_SOFT,
8990
NAND_ECC_HW,

0 commit comments

Comments
 (0)