public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] NAND: Allow nand_scan to be replaced by user
Date: Mon, 5 Dec 2011 17:21:28 -0600	[thread overview]
Message-ID: <4EDD51F8.8050307@freescale.com> (raw)
In-Reply-To: <1323126962-20525-1-git-send-email-marek.vasut@gmail.com>

On 12/05/2011 05:16 PM, Marek Vasut wrote:
> This patch allows user to supply nand_scan() call replacement via the usual
> method. This will be beneficial for PXA3XX NAND driver, which does further init
> of the chip at this stage.
> 
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> Cc: Scott Wood <scottwood@freescale.com>
> ---
>  drivers/mtd/nand/nand_base.c |   12 +++++++++---
>  include/linux/mtd/nand.h     |    2 ++
>  2 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index 27f6c77..baf7622 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -2974,10 +2974,16 @@ int nand_scan_tail(struct mtd_info *mtd)
>  int nand_scan(struct mtd_info *mtd, int maxchips)
>  {
>  	int ret;
> +	struct nand_chip *nand = mtd->priv;
> +
> +	if (nand->scan) {
> +		ret = nand->scan(mtd);
> +	} else {
> +		ret = nand_scan_ident(mtd, maxchips, NULL);
> +		if (!ret)
> +			ret = nand_scan_tail(mtd);
> +	}
>  
> -	ret = nand_scan_ident(mtd, maxchips, NULL);
> -	if (!ret)
> -		ret = nand_scan_tail(mtd);
>  	return ret;
>  }

There is no need to change this code.  Instead, we should stop calling
nand_scan in the first place if we want to insert code between ident and
tail.

Does the approach in the following patch work for you?
http://patchwork.ozlabs.org/patch/128816/

-Scott

  reply	other threads:[~2011-12-05 23:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-05 23:16 [U-Boot] [PATCH] NAND: Allow nand_scan to be replaced by user Marek Vasut
2011-12-05 23:21 ` Scott Wood [this message]
2011-12-05 23:24   ` Marek Vasut

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=4EDD51F8.8050307@freescale.com \
    --to=scottwood@freescale.com \
    --cc=u-boot@lists.denx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox