[{"id":1961105,"web_url":"http://patchwork.ozlabs.org/comment/1961105/","msgid":"<20180725175927.67337ede@bbrezillon>","list_archive_url":null,"date":"2018-07-25T15:59:27","subject":"Re: [PATCH v5 15/17] mtd: rawnand: do not export\n\tnand_scan_[ident|tail]() anymore","submitter":{"id":73370,"url":"http://patchwork.ozlabs.org/api/people/73370/","name":"Boris Brezillon","email":"boris.brezillon@bootlin.com"},"content":"On Wed, 25 Jul 2018 15:31:50 +0200\nMiquel Raynal <miquel.raynal@bootlin.com> wrote:\n\n> Both nand_scan_ident() and nand_scan_tail() helpers used to be called\n> directly from controller drivers that needed to tweak some ECC-related\n> parameters before nand_scan_tail(). This separation prevented dynamic\n> allocations during the phase of NAND identification, which was\n> inconvenient.\n> \n> All controller drivers have been moved to use nand_scan(), in\n> conjunction with the chip->ecc.[attach|detach]_chip() hooks that\n> actually do the required tweaking sequence between both ident/tail\n> calls, allowing programmers to use dynamic allocation as they need all\n> across the scanning sequence.\n> \n> Declare nand_scan_[ident|tail]() statically now.\n> \n> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>\n\nReviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>\n\n> ---\n>  drivers/mtd/nand/raw/nand_base.c | 16 +++++++++-------\n>  include/linux/mtd/rawnand.h      | 18 ++++++------------\n>  2 files changed, 15 insertions(+), 19 deletions(-)\n> \n> diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c\n> index 42a7a934a17b..34ea44f90fd8 100644\n> --- a/drivers/mtd/nand/raw/nand_base.c\n> +++ b/drivers/mtd/nand/raw/nand_base.c\n> @@ -5924,7 +5924,7 @@ static int nand_dt_init(struct nand_chip *chip)\n>  }\n>  \n>  /**\n> - * nand_scan_ident - [NAND Interface] Scan for the NAND device\n> + * nand_scan_ident - Scan for the NAND device\n>   * @mtd: MTD device structure\n>   * @maxchips: number of chips to scan for\n>   * @table: alternative NAND ID table\n> @@ -5932,9 +5932,13 @@ static int nand_dt_init(struct nand_chip *chip)\n>   * This is the first phase of the normal nand_scan() function. It reads the\n>   * flash ID and sets up MTD fields accordingly.\n>   *\n> + * This helper used to be called directly from controller drivers that needed\n> + * to tweak some ECC-related parameters before nand_scan_tail(). This separation\n> + * prevented dynamic allocations during this phase which was unconvenient and\n> + * as been banned for the benefit of the ->init_ecc()/cleanup_ecc() hooks.\n>   */\n> -int nand_scan_ident(struct mtd_info *mtd, int maxchips,\n> -\t\t    struct nand_flash_dev *table)\n> +static int nand_scan_ident(struct mtd_info *mtd, int maxchips,\n> +\t\t\t   struct nand_flash_dev *table)\n>  {\n>  \tint i, nand_maf_id, nand_dev_id;\n>  \tstruct nand_chip *chip = mtd_to_nand(mtd);\n> @@ -6008,7 +6012,6 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,\n>  \n>  \treturn 0;\n>  }\n> -EXPORT_SYMBOL(nand_scan_ident);\n>  \n>  static int nand_set_ecc_soft_ops(struct mtd_info *mtd)\n>  {\n> @@ -6385,14 +6388,14 @@ static bool nand_ecc_strength_good(struct mtd_info *mtd)\n>  }\n>  \n>  /**\n> - * nand_scan_tail - [NAND Interface] Scan for the NAND device\n> + * nand_scan_tail - Scan for the NAND device\n>   * @mtd: MTD device structure\n>   *\n>   * This is the second phase of the normal nand_scan() function. It fills out\n>   * all the uninitialized function pointers with the defaults and scans for a\n>   * bad block table if appropriate.\n>   */\n> -int nand_scan_tail(struct mtd_info *mtd)\n> +static int nand_scan_tail(struct mtd_info *mtd)\n>  {\n>  \tstruct nand_chip *chip = mtd_to_nand(mtd);\n>  \tstruct nand_ecc_ctrl *ecc = &chip->ecc;\n> @@ -6716,7 +6719,6 @@ int nand_scan_tail(struct mtd_info *mtd)\n>  \n>  \treturn ret;\n>  }\n> -EXPORT_SYMBOL(nand_scan_tail);\n>  \n>  static int nand_attach(struct nand_chip *chip)\n>  {\n> diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h\n> index a20c78e25878..eaf000b09222 100644\n> --- a/include/linux/mtd/rawnand.h\n> +++ b/include/linux/mtd/rawnand.h\n> @@ -35,17 +35,6 @@ static inline int nand_scan(struct mtd_info *mtd, int max_chips)\n>  \treturn nand_scan_with_ids(mtd, max_chips, NULL);\n>  }\n>  \n> -/*\n> - * Separate phases of nand_scan(), allowing board driver to intervene\n> - * and override command or ECC setup according to flash type.\n> - */\n> -int nand_scan_ident(struct mtd_info *mtd, int max_chips,\n> -\t\t\t   struct nand_flash_dev *table);\n> -int nand_scan_tail(struct mtd_info *mtd);\n> -\n> -/* Unregister the MTD device and free resources held by the NAND device */\n> -void nand_release(struct mtd_info *mtd);\n> -\n>  /* Internal helper for board drivers which need to override command function */\n>  void nand_wait_ready(struct mtd_info *mtd);\n>  \n> @@ -1739,8 +1728,13 @@ int nand_read_data_op(struct nand_chip *chip, void *buf, unsigned int len,\n>  int nand_write_data_op(struct nand_chip *chip, const void *buf,\n>  \t\t       unsigned int len, bool force_8bit);\n>  \n> -/* Free resources held by the NAND device */\n> +/*\n> + * Free resources held by the NAND device, must be called on error after a\n\n\t\t\t\t\t\t\t\t      ^ and\n\n> + * sucessful nand_scan().\n> + */\n>  void nand_cleanup(struct nand_chip *chip);\n> +/* Unregister the MTD device and calls nand_cleanup() */\n> +void nand_release(struct mtd_info *mtd);\n>  \n>  /* Default extended ID decoding function */\n>  void nand_decode_ext_id(struct nand_chip *chip);","headers":{"Return-Path":"<linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org; spf=none (mailfrom)\n\tsmtp.mailfrom=lists.infradead.org\n\t(client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org;\n\tenvelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdmarc=none (p=none dis=none) header.from=bootlin.com","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"Wc49NMys\"; \n\tdkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[IPv6:2607:7c80:54:e::133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 41bKgM1WHjz9ryn\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 26 Jul 2018 01:59:59 +1000 (AEST)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux))\n\tid 1fiMCe-00009i-PP; Wed, 25 Jul 2018 15:59:52 +0000","from mail.bootlin.com ([62.4.15.54])\n\tby bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux))\n\tid 1fiMCb-00008f-08\n\tfor linux-mtd@lists.infradead.org; Wed, 25 Jul 2018 15:59:50 +0000","by mail.bootlin.com (Postfix, from userid 110)\n\tid 7AC2C2073D; Wed, 25 Jul 2018 17:59:37 +0200 (CEST)","from bbrezillon (AAubervilliers-681-1-78-122.w90-88.abo.wanadoo.fr\n\t[90.88.20.122])\n\tby mail.bootlin.com (Postfix) with ESMTPSA id 3153F203D9;\n\tWed, 25 Jul 2018 17:59:27 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:\n\tMessage-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=oP9wNDJA49ePeoh6l6Yf3gVuxITT11mIfLKwAdugA64=;\n\tb=Wc49NMysTeeGuK\n\tgdFReQ4+SVEDYi7un6KSm993b4kWTLl21xvrdbt+MjK6o8jem2JVl/sx6JSktoH+5QsgFSwrAMYqn\n\tquzMf3ELjnS7M1s/FqGNdfeZWnds/cHkugyaRSj9sKIdyfzG/+HnrGIXiPxDuvNv8zukjdce432io\n\t/mUmGVT1jxg67rh1mDIaLgbOaNZoLLjFCV9ioafclth9ejZMVRSQDrMqS/caH7N/OWKivKoHLukM4\n\tsC9HroaKGA9w7a36jt4n2quaeuln+ReEna81rtyNmj2Z34TRbzZXB48VlFtVC17J0J4Zlmew8kfkB\n\tovKMK88HXREhdb8iyrMQ==;","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,\n\tURIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0","Date":"Wed, 25 Jul 2018 17:59:27 +0200","From":"Boris Brezillon <boris.brezillon@bootlin.com>","To":"Miquel Raynal <miquel.raynal@bootlin.com>","Subject":"Re: [PATCH v5 15/17] mtd: rawnand: do not export\n\tnand_scan_[ident|tail]() anymore","Message-ID":"<20180725175927.67337ede@bbrezillon>","In-Reply-To":"<20180725133152.30898-16-miquel.raynal@bootlin.com>","References":"<20180725133152.30898-1-miquel.raynal@bootlin.com>\n\t<20180725133152.30898-16-miquel.raynal@bootlin.com>","X-Mailer":"Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu)","MIME-Version":"1.0","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20180725_085949_316886_175FE8E7 ","X-CRM114-Status":"GOOD (  24.65  )","X-Spam-Score":"-0.0 (/)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-0.0 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/,\n\tno trust [62.4.15.54 listed in list.dnswl.org]\n\t-0.0 SPF_PASS               SPF: sender matches SPF record","X-BeenThere":"linux-mtd@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"Linux MTD discussion mailing list <linux-mtd.lists.infradead.org>","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-mtd/>","List-Post":"<mailto:linux-mtd@lists.infradead.org>","List-Help":"<mailto:linux-mtd-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=subscribe>","Cc":"Lucas Stach <dev@lynxeye.de>, Wenyou Yang <wenyou.yang@microchip.com>,\n\tRichard Weinberger <richard@nod.at>, Stefan Agner <stefan@agner.ch>, \n\tMarek Vasut <marek.vasut@gmail.com>, linux-mtd@lists.infradead.org,\n\tJosh Wu <rainyfeeling@outlook.com>,\n\tBrian Norris <computersforpeace@gmail.com>, \n\tDavid Woodhouse <dwmw2@infradead.org>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"linux-mtd\" <linux-mtd-bounces@lists.infradead.org>","Errors-To":"linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"}}]