From: Roel Kluin Subject: Re: [PATCH] spi: limit reaches -1, tested 0 Date: Sun, 08 Feb 2009 18:46:47 +0100 Message-ID: <498F1A87.8060403@gmail.com> References: <498EE9C0.3010601@gmail.com> <200902080755.26241.david-b@pacbell.net> <200902080828.49036.david-b@pacbell.net> <498F0D64.4040909@gmail.com> <498F1979.1030104@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: David Brownell , spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, Andrew Morton , lkml To: Mariusz Ceier Return-path: In-Reply-To: <498F1979.1030104-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spi-devel-general-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: linux-spi.vger.kernel.org Mariusz Ceier wrote: > Roel Kluin writes in first post: >> - while ((read(drv_data) == 0) && limit--); >> + while ((read(drv_data) == 0) && --limit); > > Roel Kluin writes in last post: >> - while ((read(drv_data) == 0) && limit--); >> + while ((read(drv_data) == 0) && limit--) >> + cpu_relax(); > > so should there be postfix or prefix decrement ? :) Thanks for spotting, I took the liberty to add David Brownell's Acked-by in this case. ----------------------->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 Acked-by: David Brownell --- diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c index 269a55e..b143e8c 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, ------------------------------------------------------------------------------ Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com