Skip to content

Commit 49aa76b

Browse files
committed
mtd: rawnand: do not execute nand_scan_ident() if maxchips is zero
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>
1 parent 577e010 commit 49aa76b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/mtd/nand/raw/nand_base.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6735,7 +6735,9 @@ static void nand_detach(struct nand_chip *chip)
67356735
/**
67366736
* nand_scan_with_ids - [NAND Interface] Scan for the NAND device
67376737
* @mtd: MTD device structure
6738-
* @maxchips: number of chips to scan for
6738+
* @maxchips: number of chips to scan for. @nand_scan_ident() will not be run if
6739+
* this parameter is zero (useful for specific drivers that must
6740+
* handle this part of the process themselves, e.g docg4).
67396741
* @ids: optional flash IDs table
67406742
*
67416743
* 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,
67486750
struct nand_chip *chip = mtd_to_nand(mtd);
67496751
int ret;
67506752

6751-
ret = nand_scan_ident(mtd, maxchips, ids);
6752-
if (ret)
6753-
return ret;
6753+
if (maxchips) {
6754+
ret = nand_scan_ident(mtd, maxchips, ids);
6755+
if (ret)
6756+
return ret;
6757+
}
67546758

67556759
ret = nand_attach(chip);
67566760
if (ret)

0 commit comments

Comments
 (0)