All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: linux-mtd@lists.infradead.org, kernel@pengutronix.de,
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 5/9] mtd: nand: Expose data interface for ONFI mode 0
Date: Thu, 15 Sep 2016 14:56:25 +0200	[thread overview]
Message-ID: <20160915145625.15e81012@bbrezillon> (raw)
In-Reply-To: <1473928373-8680-6-git-send-email-s.hauer@pengutronix.de>

On Thu, 15 Sep 2016 10:32:49 +0200
Sascha Hauer <s.hauer@pengutronix.de> wrote:

> The nand layer will need ONFI mode 0 to use it as timing mode
> before and right after reset.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  drivers/mtd/nand/nand_timings.c | 11 +++++++++++
>  include/linux/mtd/nand.h        |  2 ++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/drivers/mtd/nand/nand_timings.c b/drivers/mtd/nand/nand_timings.c
> index 608d098..9cdbc16 100644
> --- a/drivers/mtd/nand/nand_timings.c
> +++ b/drivers/mtd/nand/nand_timings.c
> @@ -297,3 +297,14 @@ int onfi_init_data_interface(struct nand_chip *chip,
>  
>  	return 0;
>  }
> +
> +/**
> + * nand_get_default_data_interface - [NAND Interface] Retrieve NAND
> + * data interface for mode 0. This is used as default timing after
> + * reset.
> + */
> +const struct nand_data_interface *nand_get_default_data_interface(void)
> +{
> +	return &onfi_sdr_timings[0];
> +}
> +EXPORT_SYMBOL(nand_get_default_data_interface);

You export nand_get_default_data_interface() here, but you don't export
onfi_init_data_interface().
None of these functions should be called from NAND controller drivers,
so they don't need to be exported. ITOH, the prototypes are public
(defined in nand.h), so nothing prevents a driver from calling these
functions.

I don't know what's the best solution here:
1/ Export both nand_get_default_data_interface() and
   onfi_init_data_interface()
2/ Do not export them, but keep their prototypes in nand.h with a
   comment saying that they should not be directly called by NAND
   controller drivers
3/ Removing the prototypes from nand.h and defining them in nand_base.c
   (or in a private header).

Brian, Richard, Sascha, any comments?

> diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
> index 7216f54..29ae324 100644
> --- a/include/linux/mtd/nand.h
> +++ b/include/linux/mtd/nand.h
> @@ -1146,6 +1146,8 @@ static inline int jedec_feature(struct nand_chip *chip)
>  
>  /* get timing characteristics from ONFI timing mode. */
>  const struct nand_sdr_timings *onfi_async_timing_mode_to_sdr_timings(int mode);
> +/* get data interface from ONFI timing mode 0, used after reset. */
> +const struct nand_data_interface *nand_get_default_data_interface(void);
>  
>  int nand_check_erased_ecc_chunk(void *data, int datalen,
>  				void *ecc, int ecclen,

WARNING: multiple messages have this Message-ID (diff)
From: boris.brezillon@free-electrons.com (Boris Brezillon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/9] mtd: nand: Expose data interface for ONFI mode 0
Date: Thu, 15 Sep 2016 14:56:25 +0200	[thread overview]
Message-ID: <20160915145625.15e81012@bbrezillon> (raw)
In-Reply-To: <1473928373-8680-6-git-send-email-s.hauer@pengutronix.de>

On Thu, 15 Sep 2016 10:32:49 +0200
Sascha Hauer <s.hauer@pengutronix.de> wrote:

> The nand layer will need ONFI mode 0 to use it as timing mode
> before and right after reset.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  drivers/mtd/nand/nand_timings.c | 11 +++++++++++
>  include/linux/mtd/nand.h        |  2 ++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/drivers/mtd/nand/nand_timings.c b/drivers/mtd/nand/nand_timings.c
> index 608d098..9cdbc16 100644
> --- a/drivers/mtd/nand/nand_timings.c
> +++ b/drivers/mtd/nand/nand_timings.c
> @@ -297,3 +297,14 @@ int onfi_init_data_interface(struct nand_chip *chip,
>  
>  	return 0;
>  }
> +
> +/**
> + * nand_get_default_data_interface - [NAND Interface] Retrieve NAND
> + * data interface for mode 0. This is used as default timing after
> + * reset.
> + */
> +const struct nand_data_interface *nand_get_default_data_interface(void)
> +{
> +	return &onfi_sdr_timings[0];
> +}
> +EXPORT_SYMBOL(nand_get_default_data_interface);

You export nand_get_default_data_interface() here, but you don't export
onfi_init_data_interface().
None of these functions should be called from NAND controller drivers,
so they don't need to be exported. ITOH, the prototypes are public
(defined in nand.h), so nothing prevents a driver from calling these
functions.

I don't know what's the best solution here:
1/ Export both nand_get_default_data_interface() and
   onfi_init_data_interface()
2/ Do not export them, but keep their prototypes in nand.h with a
   comment saying that they should not be directly called by NAND
   controller drivers
3/ Removing the prototypes from nand.h and defining them in nand_base.c
   (or in a private header).

Brian, Richard, Sascha, any comments?

> diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
> index 7216f54..29ae324 100644
> --- a/include/linux/mtd/nand.h
> +++ b/include/linux/mtd/nand.h
> @@ -1146,6 +1146,8 @@ static inline int jedec_feature(struct nand_chip *chip)
>  
>  /* get timing characteristics from ONFI timing mode. */
>  const struct nand_sdr_timings *onfi_async_timing_mode_to_sdr_timings(int mode);
> +/* get data interface from ONFI timing mode 0, used after reset. */
> +const struct nand_data_interface *nand_get_default_data_interface(void);
>  
>  int nand_check_erased_ecc_chunk(void *data, int datalen,
>  				void *ecc, int ecclen,

  reply	other threads:[~2016-09-15 12:56 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-15  8:32 [PATCH v4] mtd: nand: automate NAND timings selection Sascha Hauer
2016-09-15  8:32 ` Sascha Hauer
2016-09-15  8:32 ` [PATCH 1/9] mtd: nand: Create a NAND reset function Sascha Hauer
2016-09-15  8:32   ` Sascha Hauer
2016-09-15  8:32 ` [PATCH 2/9] mtd: nand: Introduce nand_data_interface Sascha Hauer
2016-09-15  8:32   ` Sascha Hauer
2016-09-15  8:32 ` [PATCH 3/9] mtd: nand: convert ONFI mode into data interface Sascha Hauer
2016-09-15  8:32   ` Sascha Hauer
2016-09-15  8:32 ` [PATCH 4/9] mtd: nand: Add function to convert ONFI mode to data_interface Sascha Hauer
2016-09-15  8:32   ` Sascha Hauer
2016-09-15  8:32 ` [PATCH 5/9] mtd: nand: Expose data interface for ONFI mode 0 Sascha Hauer
2016-09-15  8:32   ` Sascha Hauer
2016-09-15 12:56   ` Boris Brezillon [this message]
2016-09-15 12:56     ` Boris Brezillon
2016-10-09  5:12     ` Brian Norris
2016-10-09  5:12       ` Brian Norris
2016-10-09 11:58       ` Boris Brezillon
2016-10-09 11:58         ` Boris Brezillon
2016-09-15  8:32 ` [PATCH 6/9] mtd: nand: automate NAND timings selection Sascha Hauer
2016-09-15  8:32   ` Sascha Hauer
2016-09-15  8:32 ` [PATCH 7/9] mtd: nand: sunxi: switch from manual to automated timing config Sascha Hauer
2016-09-15  8:32   ` Sascha Hauer
2016-09-15  8:32 ` [PATCH 8/9] mtd: nand: mxc: implement onfi get/set features Sascha Hauer
2016-09-15  8:32   ` Sascha Hauer
2016-11-21 13:56   ` Boris Brezillon
2016-11-21 13:56     ` Boris Brezillon
2016-11-22 10:52     ` Sascha Hauer
2016-11-22 10:52       ` Sascha Hauer
2016-11-22 11:03       ` Boris Brezillon
2016-11-22 11:03         ` Boris Brezillon
2016-09-15  8:32 ` [PATCH 9/9] mtd: nand: mxc: Add timing setup for v2 controllers Sascha Hauer
2016-09-15  8:32   ` Sascha Hauer
2016-09-16 12:19 ` [PATCH v4] mtd: nand: automate NAND timings selection Boris Brezillon
2016-09-16 12:19   ` Boris Brezillon
2016-09-19  6:43   ` Sascha Hauer
2016-09-19  6:43     ` Sascha Hauer
  -- strict thread matches above, loose matches on Subject: below --
2016-09-09 12:05 Sascha Hauer
2016-09-09 12:05 ` [PATCH 5/9] mtd: nand: Expose data interface for ONFI mode 0 Sascha Hauer
2016-09-09 12:05   ` Sascha Hauer

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=20160915145625.15e81012@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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.