From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Richard Weinberger <richard@nod.at>,
David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Marek Vasut <marek.vasut@gmail.com>,
linux-mtd@lists.infradead.org,
Wenyou Yang <wenyou.yang@microchip.com>,
Josh Wu <rainyfeeling@outlook.com>,
Stefan Agner <stefan@agner.ch>, Lucas Stach <dev@lynxeye.de>
Subject: Re: [PATCH v5 15/17] mtd: rawnand: do not export nand_scan_[ident|tail]() anymore
Date: Wed, 25 Jul 2018 17:59:27 +0200 [thread overview]
Message-ID: <20180725175927.67337ede@bbrezillon> (raw)
In-Reply-To: <20180725133152.30898-16-miquel.raynal@bootlin.com>
On Wed, 25 Jul 2018 15:31:50 +0200
Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> 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 <miquel.raynal@bootlin.com>
Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
> ---
> drivers/mtd/nand/raw/nand_base.c | 16 +++++++++-------
> include/linux/mtd/rawnand.h | 18 ++++++------------
> 2 files changed, 15 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> index 42a7a934a17b..34ea44f90fd8 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
> * @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);
> @@ -6008,7 +6012,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)
> {
> @@ -6385,14 +6388,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;
> @@ -6716,7 +6719,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..eaf000b09222 100644
> --- a/include/linux/mtd/rawnand.h
> +++ b/include/linux/mtd/rawnand.h
> @@ -35,17 +35,6 @@ static inline int nand_scan(struct mtd_info *mtd, int max_chips)
> return nand_scan_with_ids(mtd, max_chips, NULL);
> }
>
> -/*
> - * Separate phases of nand_scan(), allowing board driver to intervene
> - * and override command or ECC setup according to flash type.
> - */
> -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 */
> void nand_wait_ready(struct mtd_info *mtd);
>
> @@ -1739,8 +1728,13 @@ int nand_read_data_op(struct nand_chip *chip, void *buf, unsigned int len,
> int nand_write_data_op(struct nand_chip *chip, const void *buf,
> unsigned int len, bool force_8bit);
>
> -/* Free resources held by the NAND device */
> +/*
> + * Free resources held by the NAND device, must be called on error after a
^ and
> + * sucessful nand_scan().
> + */
> void nand_cleanup(struct nand_chip *chip);
> +/* Unregister the MTD device and calls nand_cleanup() */
> +void nand_release(struct mtd_info *mtd);
>
> /* Default extended ID decoding function */
> void nand_decode_ext_id(struct nand_chip *chip);
next prev parent reply other threads:[~2018-07-25 15:59 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-25 13:31 [PATCH v5 00/17] Allow dynamic allocations during NAND chip identification phase Miquel Raynal
2018-07-25 13:31 ` [PATCH v5 01/17] mtd: rawnand: brcmnand: convert driver to nand_scan() Miquel Raynal
2018-07-25 15:22 ` Boris Brezillon
2018-07-25 13:31 ` [PATCH v5 02/17] mtd: rawnand: cafe: " Miquel Raynal
2018-07-25 15:34 ` Boris Brezillon
2018-07-25 13:31 ` [PATCH v5 03/17] mtd: rawnand: lpc32xx_mlc: " Miquel Raynal
2018-07-25 15:38 ` Boris Brezillon
2018-07-25 13:31 ` [PATCH v5 04/17] mtd: rawnand: omap2: " Miquel Raynal
2018-07-25 15:39 ` Boris Brezillon
2018-12-13 18:01 ` [v5,04/17] " Alexander Sverdlin
2018-12-13 18:30 ` Boris Brezillon
2018-12-13 18:37 ` Boris Brezillon
2018-12-13 19:06 ` Boris Brezillon
2018-07-25 13:31 ` [PATCH v5 05/17] mtd: rawnand: atmel: clarify NAND addition/removal paths Miquel Raynal
2018-07-25 15:42 ` Boris Brezillon
2018-07-25 13:31 ` [PATCH v5 06/17] mtd: rawnand: atmel: convert driver to nand_scan() Miquel Raynal
2018-07-25 15:43 ` Boris Brezillon
2018-07-25 13:31 ` [PATCH v5 07/17] mtd: rawnand: do not execute nand_scan_ident() if maxchips is zero Miquel Raynal
2018-07-25 15:44 ` Boris Brezillon
2018-07-25 13:31 ` [PATCH v5 08/17] mtd: rawnand: docg4: convert driver to nand_scan() Miquel Raynal
2018-07-25 15:47 ` Boris Brezillon
2018-07-25 13:31 ` [PATCH v5 09/17] mtd: rawnand: jz4740: fix probe function error path Miquel Raynal
2018-07-25 15:48 ` Boris Brezillon
2018-07-25 13:31 ` [PATCH v5 10/17] mtd: rawnand: jz4740: group nand_scan_{ident, tail} calls Miquel Raynal
2018-07-25 15:54 ` [PATCH v5 10/17] mtd: rawnand: jz4740: group nand_scan_{ident,tail} calls Boris Brezillon
2018-07-25 13:31 ` [PATCH v5 11/17] mtd: rawnand: jz4740: convert driver to nand_scan() Miquel Raynal
2018-07-25 15:55 ` Boris Brezillon
2018-07-25 13:31 ` [PATCH v5 12/17] mtd: rawnand: tegra: " Miquel Raynal
2018-07-25 15:56 ` Boris Brezillon
2018-07-26 16:29 ` Stefan Agner
2018-07-26 18:01 ` Boris Brezillon
2018-07-27 7:13 ` Stefan Agner
2018-07-27 8:06 ` Miquel Raynal
2018-07-27 8:33 ` Stefan Agner
2018-07-25 13:31 ` [PATCH v5 13/17] mtd: rawnand: txx9ndfmc: clarify ECC parameters assignation Miquel Raynal
2018-07-25 15:57 ` Boris Brezillon
2018-07-25 13:31 ` [PATCH v5 14/17] mtd: rawnand: txx9ndfmc: convert driver to nand_scan() Miquel Raynal
2018-07-25 13:31 ` [PATCH v5 15/17] mtd: rawnand: do not export nand_scan_[ident|tail]() anymore Miquel Raynal
2018-07-25 15:59 ` Boris Brezillon [this message]
2018-07-25 13:31 ` [PATCH v5 16/17] mtd: rawnand: allocate model parameter dynamically Miquel Raynal
2018-07-25 13:31 ` [PATCH v5 17/17] mtd: rawnand: allocate dynamically ONFI parameters during detection Miquel Raynal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180725175927.67337ede@bbrezillon \
--to=boris.brezillon@bootlin.com \
--cc=computersforpeace@gmail.com \
--cc=dev@lynxeye.de \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=miquel.raynal@bootlin.com \
--cc=rainyfeeling@outlook.com \
--cc=richard@nod.at \
--cc=stefan@agner.ch \
--cc=wenyou.yang@microchip.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.