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
This commit is contained in:
Miquel Raynal 2020-05-26 21:56:18 +02:00
parent dbc2f2e6d5
commit 86f2b225ad
2 changed files with 2 additions and 1 deletions

View File

@ -5022,7 +5022,7 @@ static int of_get_nand_ecc_mode(struct device_node *np)
if (err < 0)
return err;
for (i = 0; i < ARRAY_SIZE(nand_ecc_modes); i++)
for (i = NAND_ECC_NONE; i < ARRAY_SIZE(nand_ecc_modes); i++)
if (!strcasecmp(pm, nand_ecc_modes[i]))
return i;

View File

@ -84,6 +84,7 @@ struct nand_chip;
* Constants for ECC_MODES
*/
enum nand_ecc_mode {
NAND_ECC_INVALID,
NAND_ECC_NONE,
NAND_ECC_SOFT,
NAND_ECC_HW,