Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2990884imm; Fri, 20 Jul 2018 08:17:33 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeDvomAq5JF3qScJesoC79aUNU6KOr81CZoK53Tvne882ljL6BTWOZbqukZwbVia3DCZobJ X-Received: by 2002:a17:902:a581:: with SMTP id az1-v6mr2509410plb.61.1532099853098; Fri, 20 Jul 2018 08:17:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532099853; cv=none; d=google.com; s=arc-20160816; b=IX86lPpijB/M3B9Zb0qkkAqzBJk/WNimc/urzF/3umV3g/+KEtMHIkMCv/je0i60Tu hECxyrhCYQuhVlAb+s9Dn+jSOdN0Rv77ltz/xhUM+Ek/B1CjF6L2aci4PVe3mBGmj32M bOB3HETaOHzaCdHXkCx3AfKM/ZQ9fmVf6VXv+gU7uTl8x6LbvwYNoI5KytuCD0ZM+sSQ R8mBt4j5lALoSHLiDoxQl4LQr5zNXTcAcT4jpbbhGg22pCq4Jro/TrAHitKX1pYNEZX1 7ybAfBW/xP5v/XWmReVm6yuVC8ysSktBsGsniz+YJZPFkjEOLAlKxx5a30BnfQ+2UahY PrbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=VpfnBUfAXZMfU4iPQhJElt4GEl7DM0mp5GCip2z+f+o=; b=Fq5HhBNMklBUWhcZkiTG30Phs2icSJeQzZVyoY4iIPabjAnK/URm28lFO5r4Z3MM+q RlHmsR/E5QwLDd9HZ23rhjko7XW3ksoSfWqVj81NVZvGrDzuUH5+GtulY0XPnE1YvFJp ukqn8CPo3IYPyqkxmAme2HQsJ3oPhhQT9NbJdr7NR2MbKwZopvBAW9qSpvrePTvxJtNw gQizR8hAoiXeYYjuUqVRXZg8m8xv/JnOMCMFyCMJQcy7VXSsIzXNn0TvojLeAfICsuzb YVqtYKxsWLXMdN7C5+4bz9bghMjvpAD5o9hELw/5ZFeeOC1hZk2lN+os+JwrmX3McRIf K/+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o84-v6si2125816pfa.15.2018.07.20.08.17.18; Fri, 20 Jul 2018 08:17:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388286AbeGTQE4 (ORCPT + 99 others); Fri, 20 Jul 2018 12:04:56 -0400 Received: from mail.bootlin.com ([62.4.15.54]:54628 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388058AbeGTQEz (ORCPT ); Fri, 20 Jul 2018 12:04:55 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 99C4D20A9A; Fri, 20 Jul 2018 17:16:09 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 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 7C4D9209CA; Fri, 20 Jul 2018 17:15:47 +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 Cc: linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-mediatek@lists.infradead.org Subject: [PATCH v4 33/35] mtd: rawnand: do not export nand_scan_[ident|tail]() anymore Date: Fri, 20 Jul 2018 17:15:25 +0200 Message-Id: <20180720151527.16038-34-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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Both nand_scan_ident() and nand_scan_tail() helpers used to be called directly from controller drivers that needed to tweak some ECC-related parameters before nand_scan_tail(). This separation prevented dynamic allocations during the phase of NAND identification, which was inconvenient. All controller drivers have been moved to use nand_scan(), in conjunction with the chip->ecc.[attach|detach]_chip() hooks that actually do the required tweaking sequence between both ident/tail calls, allowing programmers to use dynamic allocation as they need all across the scanning sequence. Declare nand_scan_[ident|tail]() statically now. Signed-off-by: Miquel Raynal --- drivers/mtd/nand/raw/nand_base.c | 16 +++++++++------- include/linux/mtd/rawnand.h | 9 ++------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index e7f135c100c2..da99232702a4 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -5924,7 +5924,7 @@ static int nand_dt_init(struct nand_chip *chip) } /** - * nand_scan_ident - [NAND Interface] Scan for the NAND device + * nand_scan_ident - Scan for the NAND device * @mtd: MTD device structure * @maxchips: number of chips to scan for, returns immediately if 0 * @table: alternative NAND ID table @@ -5932,9 +5932,13 @@ static int nand_dt_init(struct nand_chip *chip) * This is the first phase of the normal nand_scan() function. It reads the * flash ID and sets up MTD fields accordingly. * + * This helper used to be called directly from controller drivers that needed + * to tweak some ECC-related parameters before nand_scan_tail(). This separation + * prevented dynamic allocations during this phase which was unconvenient and + * as been banned for the benefit of the ->init_ecc()/cleanup_ecc() hooks. */ -int nand_scan_ident(struct mtd_info *mtd, int maxchips, - struct nand_flash_dev *table) +static int nand_scan_ident(struct mtd_info *mtd, int maxchips, + struct nand_flash_dev *table) { int i, nand_maf_id, nand_dev_id; struct nand_chip *chip = mtd_to_nand(mtd); @@ -6016,7 +6020,6 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips, return 0; } -EXPORT_SYMBOL(nand_scan_ident); static int nand_set_ecc_soft_ops(struct mtd_info *mtd) { @@ -6393,14 +6396,14 @@ static bool nand_ecc_strength_good(struct mtd_info *mtd) } /** - * nand_scan_tail - [NAND Interface] Scan for the NAND device + * nand_scan_tail - Scan for the NAND device * @mtd: MTD device structure * * This is the second phase of the normal nand_scan() function. It fills out * all the uninitialized function pointers with the defaults and scans for a * bad block table if appropriate. */ -int nand_scan_tail(struct mtd_info *mtd) +static int nand_scan_tail(struct mtd_info *mtd) { struct nand_chip *chip = mtd_to_nand(mtd); struct nand_ecc_ctrl *ecc = &chip->ecc; @@ -6724,7 +6727,6 @@ int nand_scan_tail(struct mtd_info *mtd) return ret; } -EXPORT_SYMBOL(nand_scan_tail); static int nand_attach(struct nand_chip *chip) { diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h index a20c78e25878..a928771a7ae4 100644 --- a/include/linux/mtd/rawnand.h +++ b/include/linux/mtd/rawnand.h @@ -36,14 +36,9 @@ static inline int nand_scan(struct mtd_info *mtd, int max_chips) } /* - * Separate phases of nand_scan(), allowing board driver to intervene - * and override command or ECC setup according to flash type. + * Unregister the MTD device and free resources held by the NAND device, must be + * called on error after a successful nand_scan(). */ -int nand_scan_ident(struct mtd_info *mtd, int max_chips, - struct nand_flash_dev *table); -int nand_scan_tail(struct mtd_info *mtd); - -/* Unregister the MTD device and free resources held by the NAND device */ void nand_release(struct mtd_info *mtd); /* Internal helper for board drivers which need to override command function */ -- 2.14.1