From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Brezillon Subject: Re: [PATCH v4 28/35] mtd: rawnand: allow exiting immediately nand_scan_ident() Date: Sun, 22 Jul 2018 10:49:12 +0200 Message-ID: <20180722104912.77e81f8d@bbrezillon> References: <20180720151527.16038-1-miquel.raynal@bootlin.com> <20180720151527.16038-29-miquel.raynal@bootlin.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20180720151527.16038-29-miquel.raynal@bootlin.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Miquel Raynal Cc: Alexandre Belloni , Mans Rullgard , Maxime Ripard , Stefan Agner , linux-kernel@vger.kernel.org, Masahiro Yamada , linux-mtd@lists.infradead.org, Kamal Dasu , Josh Wu , Marc Gonzalez , Marek Vasut , Chen-Yu Tsai , bcm-kernel-feedback-list@broadcom.com, Sylvain Lemieux , Wenyou Yang , Tudor Ambarus , Vladimir Zapolskiy , Harvey Hunt , linux-mediatek@lists.infradead.org, Matthias Brugger , Han Xu , Xiaolei Li , linux-arm-kernel@lists.infradead.org, Richard List-Id: linux-mediatek@lists.infradead.org On Fri, 20 Jul 2018 17:15:20 +0200 Miquel Raynal wrote: > 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_ident() to just "do nothing" if > the maxchips parameters is zero, meaning that the driver does not want > the core to handle this phase. > > Signed-off-by: Miquel Raynal > --- > drivers/mtd/nand/raw/nand_base.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c > index dea41fa25be1..e7f135c100c2 100644 > --- a/drivers/mtd/nand/raw/nand_base.c > +++ b/drivers/mtd/nand/raw/nand_base.c > @@ -5926,7 +5926,7 @@ static int nand_dt_init(struct nand_chip *chip) > /** > * nand_scan_ident - [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, returns immediately if 0 > * @table: alternative NAND ID table > * > * This is the first phase of the normal nand_scan() function. It reads the > @@ -5940,6 +5940,14 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips, > struct nand_chip *chip = mtd_to_nand(mtd); > int ret; > > + /* > + * If the number of chips to scan for is null, just return silently. ^ zero > + * This is for specific drivers that must handle this part of the > + * probe process themselves (e.g docg4). > + */ I think that description of the special case maxchips == 0 should be placed in the kernel doc header. > + if (!maxchips) > + return 0; Can we move this check in nand_scan_with_ids()? > + > /* Enforce the right timings for reset/detection */ > onfi_fill_data_interface(chip, NAND_SDR_IFACE, 0); >