Commit 2e8f56f2 authored by Miquel Raynal's avatar Miquel Raynal

mtd: rawnand: jedec: Define the number of parameter pages

Use a macro to define the number of parameter page instead of
hardcoding it everywhere.
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: default avatarBoris Brezillon <boris.brezillon@collabora.com>
Link: https://lore.kernel.org/linux-mtd/20200428094302.14624-9-miquel.raynal@bootlin.com
parent 6e9c65d8
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include "internals.h" #include "internals.h"
#define JEDEC_PARAM_PAGES 3
/* /*
* Check if the NAND chip is JEDEC compliant, returns 1 if it is, 0 otherwise. * Check if the NAND chip is JEDEC compliant, returns 1 if it is, 0 otherwise.
*/ */
...@@ -47,7 +49,7 @@ int nand_jedec_detect(struct nand_chip *chip) ...@@ -47,7 +49,7 @@ int nand_jedec_detect(struct nand_chip *chip)
goto free_jedec_param_page; goto free_jedec_param_page;
} }
for (i = 0; i < 3; i++) { for (i = 0; i < JEDEC_PARAM_PAGES; i++) {
ret = nand_read_data_op(chip, p, sizeof(*p), true); ret = nand_read_data_op(chip, p, sizeof(*p), true);
if (ret) { if (ret) {
ret = 0; ret = 0;
...@@ -59,7 +61,7 @@ int nand_jedec_detect(struct nand_chip *chip) ...@@ -59,7 +61,7 @@ int nand_jedec_detect(struct nand_chip *chip)
break; break;
} }
if (i == 3) { if (i == JEDEC_PARAM_PAGES) {
pr_err("Could not find valid JEDEC parameter page; aborting\n"); pr_err("Could not find valid JEDEC parameter page; aborting\n");
goto free_jedec_param_page; goto free_jedec_param_page;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment