public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: spi-devel-general@lists.sourceforge.net,
	lkml <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] spi: limit reaches -1, tested 0
Date: Sun, 8 Feb 2009 09:26:54 -0800	[thread overview]
Message-ID: <200902080926.56810.david-b@pacbell.net> (raw)
In-Reply-To: <498F0D64.4040909@gmail.com>

On Sunday 08 February 2009, Roel Kluin wrote:
> >>> -			while ((read(drv_data) == 0) && limit--);
> >>> +			while ((read(drv_data) == 0) && --limit);
> > 
> > ... although I wouldn't have resisted the urge to make the
> > loop body be "cpu_relax();" instead of an empty statement.
> 
> Ok,
> ---------------------------->8-------------------8<-----------------------------
> With a postfix decrement limit will reach -1 rather than 0, so the warning will
> not be issued.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>

Still:

Acked-by: David Brownell <dbrownell@users.sourceforge.net>


> ---
> diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c
> index 269a55e..15abe61 100644
> --- a/drivers/spi/spi_imx.c
> +++ b/drivers/spi/spi_imx.c
> @@ -779,7 +779,8 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data)
>  
>  			/* Read trailing bytes */
>  			limit = loops_per_jiffy << 1;
> -			while ((read(drv_data) == 0) && limit--);
> +			while ((read(drv_data) == 0) && limit--)
> +				cpu_relax();
>  
>  			if (limit == 0)
>  				dev_err(&drv_data->pdev->dev,
> 
> 



  reply	other threads:[~2009-02-08 17:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-08 14:18 [PATCH] spi: limit reaches -1, tested 0 Roel Kluin
2009-02-08 15:55 ` David Brownell
2009-02-08 16:28   ` David Brownell
2009-02-08 16:50     ` Roel Kluin
2009-02-08 17:26       ` David Brownell [this message]
2009-02-08 17:42       ` Mariusz Ceier
2009-02-08 17:46         ` Roel Kluin

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=200902080926.56810.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roel.kluin@gmail.com \
    --cc=spi-devel-general@lists.sourceforge.net \
    /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