]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mtd: rawnand: do not execute nand_scan_ident() if maxchips is zero
authorMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 25 Jul 2018 13:31:42 +0000 (15:31 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Tue, 31 Jul 2018 07:46:09 +0000 (09:46 +0200)
Some driver (eg. docg4) will need to handle themselves the
identification phase. As part of the migration to use nand_scan()
everywhere (which will unconditionnaly call nand_scan_ident()), we add
a condition at the start of nand_scan_with_ids() to jump over
nand_scan_ident() if the maxchips parameters is zero, meaning that the
driver does not want the core to handle this phase.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
drivers/mtd/nand/raw/nand_base.c

index dea41fa25be19e023e20ce8b6d974598789fdd26..42a7a934a17be4fb2552c9326c884baa8b5d1df4 100644 (file)
@@ -6735,7 +6735,9 @@ static void nand_detach(struct nand_chip *chip)
 /**
  * nand_scan_with_ids - [NAND Interface] Scan for the NAND device
  * @mtd: MTD device structure
- * @maxchips: number of chips to scan for
+ * @maxchips: number of chips to scan for. @nand_scan_ident() will not be run if
+ *           this parameter is zero (useful for specific drivers that must
+ *           handle this part of the process themselves, e.g docg4).
  * @ids: optional flash IDs table
  *
  * This fills out all the uninitialized function pointers with the defaults.
@@ -6748,9 +6750,11 @@ int nand_scan_with_ids(struct mtd_info *mtd, int maxchips,
        struct nand_chip *chip = mtd_to_nand(mtd);
        int ret;
 
-       ret = nand_scan_ident(mtd, maxchips, ids);
-       if (ret)
-               return ret;
+       if (maxchips) {
+               ret = nand_scan_ident(mtd, maxchips, ids);
+               if (ret)
+                       return ret;
+       }
 
        ret = nand_attach(chip);
        if (ret)