public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] NAND: Allow nand_scan to be replaced by user
Date: Tue, 6 Dec 2011 00:24:44 +0100	[thread overview]
Message-ID: <201112060024.44839.marek.vasut@gmail.com> (raw)
In-Reply-To: <4EDD51F8.8050307@freescale.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/

No, why use weak-aliased function if you can pass it like I do? If V2 passed the 
function pointer like I do, I'll be OK with it. Though I tried very hard to keep 
the pxa3xx driver as much unchanged as possible and this slightly breaks my 
effort. Anyway, when do you expect to see this (in some modified version, 
without the weak-aliased fn) mainline?
> 
> -Scott

      reply	other threads:[~2011-12-05 23:24 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
2011-12-05 23:24   ` Marek Vasut [this message]

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=201112060024.44839.marek.vasut@gmail.com \
    --to=marek.vasut@gmail.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