From patchwork Fri Jul 20 15:15:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 10537889 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9901C602CA for ; Fri, 20 Jul 2018 15:44:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79741297C7 for ; Fri, 20 Jul 2018 15:44:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6CE6D29875; Fri, 20 Jul 2018 15:44:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 10051297C7 for ; Fri, 20 Jul 2018 15:44:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=xg2m4vdUnRY7HmI0Udi8u4WtnhA2fUOLiXY+giAwku4=; b=fVq6gBPqpUwaBTUQlEpNEy07r4 4EhStc++IlGAS+pqMR7mCrZ4CHFgtgRXip7yFZrgcYl7O1NLJHj3sCUI/SYXn2PunaWlzRqAYafTt /BBAjfcl86cSO5CspvY1sFgqYzHD4w9FdVp7VRo5yaoEuuHXw9QPe1H2TcLzz3noYjQHkNpOo9y7z U1vHCvMuVF7vIe8AOO9pBgRvHWszBnqcDqgnK0WwMpk0bRs3J3k2Ce04eoGaMYqgUGI/H68T0Cy5/ uTWAkuGTenZzv4Lf9CqMcOfpfpTkKwQwqiepQksgOeKqd9HOctxVyru9vjQAvVVMq3yCrQTPKby3B dL7rtpkw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fgXZm-0006Fa-1p; Fri, 20 Jul 2018 15:44:14 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fgX8p-0006bd-Ui; Fri, 20 Jul 2018 15:16:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=jThYYX2IH0KwIXB57etzRK6Vtwf2g96Tobz7XGb6Rn8=; b=o7hpNHTaU/BPBokpB/eaZ5RPU p2hMunNGBv8QCF3txn651GUCub9Bz4dd0AUkknshq7qA2UeYZmX21v8wkWygskEDotNK1GhJTwxhJ E48rvg14Z0q5J8eO9RcFyOB9OSjmevX5KS5g9sYzRvGUFdeC+16MXTCaM/QRsm7P/dVJ7+aZWUzyu ljUjT0LEb3mm8zX7g0e1D8SLvBfBGwI8ss4J/FJ5xIWGfUgIX3RR+duAYpGKt6mIqmxgJ2OHjZZWO rG8CThMACUYfZKPiv9NXfa6QJCfpCVkIF5l5hRkhqdmQlTW+HtbhE4dmy+WZRrMyNvYsH086Uuqgt RcIJ3kxXw==; Received: from mail.bootlin.com ([62.4.15.54]) by merlin.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fgX8d-0004kj-MS; Fri, 20 Jul 2018 15:16:12 +0000 Received: by mail.bootlin.com (Postfix, from userid 110) id 42A0C209B9; Fri, 20 Jul 2018 17:16:01 +0200 (CEST) Received: from localhost.localdomain (AAubervilliers-681-1-78-122.w90-88.abo.wanadoo.fr [90.88.20.122]) by mail.bootlin.com (Postfix) with ESMTPSA id 9C4B2209BD; Fri, 20 Jul 2018 17:15:44 +0200 (CEST) From: Miquel Raynal To: Wenyou Yang , Josh Wu , Tudor Ambarus , Boris Brezillon , Miquel Raynal , Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Nicolas Ferre , Alexandre Belloni , Kamal Dasu , Masahiro Yamada , Han Xu , Harvey Hunt , Vladimir Zapolskiy , Sylvain Lemieux , Xiaolei Li , Matthias Brugger , Maxime Ripard , Chen-Yu Tsai , Marc Gonzalez , Mans Rullgard , Stefan Agner Subject: [PATCH v4 28/35] mtd: rawnand: allow exiting immediately nand_scan_ident() Date: Fri, 20 Jul 2018 17:15:20 +0200 Message-Id: <20180720151527.16038-29-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180720151527.16038-1-miquel.raynal@bootlin.com> References: <20180720151527.16038-1-miquel.raynal@bootlin.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180720_111611_918919_A0043712 X-CRM114-Status: GOOD ( 16.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bcm-kernel-feedback-list@broadcom.com, linux-mediatek@lists.infradead.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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. + * This is for specific drivers that must handle this part of the + * probe process themselves (e.g docg4). + */ + if (!maxchips) + return 0; + /* Enforce the right timings for reset/detection */ onfi_fill_data_interface(chip, NAND_SDR_IFACE, 0);