public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: Brian Norris <computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Lior Amsalem <alior-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
	Tawfik Bayouk <tawfik-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
	Thomas Petazzoni
	<thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Gregory Clement
	<gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Huang Shijie <b32955-KZfg59tc24xl57MIdRCFDg@public.gmane.org>,
	Willy Tarreau <w@1wt.eu>,
	Daniel Mack <zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>
Subject: Re: [PATCH v4 15/31] mtd: nand: pxa3xx: Use a completion to signal device ready
Date: Thu, 14 Nov 2013 15:53:57 -0300	[thread overview]
Message-ID: <20131114185356.GA9912@localhost> (raw)
In-Reply-To: <20131114183923.GO9468-bU/DPfM3abD4WzifrMjOTkcViWtcw2C0@public.gmane.org>

Brian,

On Thu, Nov 14, 2013 at 10:39:23AM -0800, Brian Norris wrote:
> On Thu, Nov 07, 2013 at 12:17:19PM -0300, Ezequiel Garcia wrote:
> > --- a/drivers/mtd/nand/pxa3xx_nand.c
> > +++ b/drivers/mtd/nand/pxa3xx_nand.c
> > @@ -863,21 +867,28 @@ static int pxa3xx_nand_waitfunc(struct mtd_info *mtd, struct nand_chip *this)
> >  {
> >  	struct pxa3xx_nand_host *host = mtd->priv;
> >  	struct pxa3xx_nand_info *info = host->info_data;
> > +	int ret;
> > +
> > +	/* Need to wait? */
> > +	if (!info->is_ready) {
> > +		ret = wait_for_completion_timeout(&info->dev_ready,
> > +				CHIP_DELAY_TIMEOUT);
> > +		if (!ret) {
> > +			dev_err(&info->pdev->dev, "Ready time out!!!\n");
> > +			return NAND_STATUS_FAIL;
> > +		}
> > +		info->is_ready = 1;
> 
> Shouldn't the is_ready=1 line to be above the if (!ret) condition? I
> think you want to set is_ready=1 in either case (success or timeout).
> With this code, any timeout will cause subsequent waitfunc()'s to block,
> even if they are never going to catch an interrupt.
> 

Yes, good catch!

> I think this kind of mistake is easier to make now, since the 'is_ready'
> field isn't properly descriptive any more. It doesn't represent "is the
> device ready"; it represents "is there a pending command on which I need
> to wait". (I don't care if you change the name; I'm just pointing this
> out.)
> 

Yes, I agree. Maybe, "need_wait" or something like that would fit
better. Let me submit a new patch for this one.

> > +	}
> >  
> 
> I think all the other patches up to this one are good. I may push them
> to l2-mtd.git now, unless you object.
> 

Great, thanks a lot for reviewing and for all the feedback!
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2013-11-14 18:53 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-07 15:17 [PATCH v4 00/31] Armada 370/XP NAND support Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 06/31] mtd: nand: pxa3xx: Add documentation about the controller Ezequiel Garcia
2013-11-14 19:00   ` Brian Norris
2013-11-14 19:49     ` Ezequiel Garcia
     [not found] ` <1383837455-30721-1-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2013-11-07 15:17   ` [PATCH v4 01/31] clk: mvebu: Add Core Divider clock Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 02/31] ARM: mvebu: Add Core Divider clock device-tree binding Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 03/31] ARM: mvebu: Add a 2 GHz fixed-clock Armada 370/XP Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 04/31] ARM: mvebu: Add the core-divider clock to " Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 05/31] mtd: nand: pxa3xx: devicetree binding update Ezequiel Garcia
2013-11-07 15:32     ` Jason Cooper
     [not found]       ` <20131107153210.GK8308-u4khhh1J0LxI1Ri9qeTfzeTW4wlIGRCZ@public.gmane.org>
2013-11-07 16:41         ` Ezequiel Garcia
2013-11-07 17:54           ` Jason Cooper
2013-11-07 15:17   ` [PATCH v4 07/31] mtd: nand: pxa3xx: Make config menu show supported platforms Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 08/31] mtd: nand: pxa3xx: Prevent sub-page writes Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 09/31] mtd: nand: pxa3xx: read_page() returns max_bitflips Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 10/31] mtd: nand: pxa3xx: Early variant detection Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 11/31] mtd: nand: pxa3xx: Use chip->cmdfunc instead of the internal Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 12/31] mtd: nand: pxa3xx: Split FIFO size from to-be-read FIFO count Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 13/31] mtd: nand: pxa3xx: Replace host->page_size by mtd->writesize Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 14/31] mtd: nand: pxa3xx: Add a nice comment to pxa3xx_set_datasize() Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 15/31] mtd: nand: pxa3xx: Use a completion to signal device ready Ezequiel Garcia
     [not found]     ` <1383837455-30721-16-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2013-11-14 18:39       ` Brian Norris
     [not found]         ` <20131114183923.GO9468-bU/DPfM3abD4WzifrMjOTkcViWtcw2C0@public.gmane.org>
2013-11-14 18:53           ` Ezequiel Garcia [this message]
2013-11-07 15:17   ` [PATCH v4 16/31] mtd: nand: pxa3xx: Use waitfunc() to wait for the device to be ready Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 17/31] mtd: nand: pxa3xx: Add bad block handling Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 18/31] mtd: nand: pxa3xx: Add driver-specific ECC BCH support Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 19/31] mtd: nand: pxa3xx: Clear cmd buffer #3 (NDCB3) on command start Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 20/31] mtd: nand: pxa3xx: Add helper function to set page address Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 21/31] mtd: nand: pxa3xx: Remove READ0 switch/case falltrough Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 22/31] mtd: nand: pxa3xx: Split prepare_command_pool() in two stages Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 23/31] mtd: nand: pxa3xx: Move the data buffer clean to prepare_start_command() Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 24/31] mtd: nand: pxa3xx: Fix SEQIN column address set Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 25/31] mtd: nand: pxa3xx: Add a read/write buffers markers Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 26/31] mtd: nand: pxa3xx: Introduce multiple page I/O support Ezequiel Garcia
     [not found]     ` <1383837455-30721-27-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2013-11-07 23:45       ` Ezequiel Garcia
2013-11-08  0:46         ` Brian Norris
     [not found]           ` <20131108004600.GZ20061-bU/DPfM3abD4WzifrMjOTkcViWtcw2C0@public.gmane.org>
2013-11-08  3:21             ` Ezequiel Garcia
2013-11-14 15:40             ` Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 27/31] mtd: nand: pxa3xx: Add multiple chunk write support Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 28/31] mtd: nand: pxa3xx: Add ECC BCH correctable errors detection Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 29/31] ARM: mvebu: Add support for NAND controller in Armada 370/XP Ezequiel Garcia
     [not found]     ` <1383837455-30721-30-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2013-11-24  3:42       ` Jason Cooper
2013-11-07 15:17   ` [PATCH v4 30/31] ARM: mvebu: Enable NAND controller in Armada XP GP board Ezequiel Garcia
2013-11-07 15:17   ` [PATCH v4 31/31] ARM: mvebu: Enable NAND controller in Armada 370 Mirabox Ezequiel Garcia
2013-11-07 23:28   ` [PATCH v4 00/31] Armada 370/XP NAND support Ezequiel Garcia
2013-11-10 23:24   ` Ezequiel Garcia

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=20131114185356.GA9912@localhost \
    --to=ezequiel.garcia-wi1+55scjutkeb57/3fjtnbpr1lh4cv8@public.gmane.org \
    --cc=alior-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
    --cc=b32955-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    --cc=computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=tawfik-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
    --cc=thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=w@1wt.eu \
    --cc=zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /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