All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spi_bfin5xx: limit reaches -1
@ 2009-04-16 21:37 Roel Kluin
       [not found] ` <49E7A528.9070400-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-04-16 21:37 UTC (permalink / raw)
  To: dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Andrew Morton

bfin_spi_flush() returns limit, which reaches -1 upon timeout. but in function
bfin_spi_pump_transfers() it is compared with 0.

Signed-off-by: Roel Kluin <roel.kluin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
index f014cc2..6545b0c 100644
--- a/drivers/spi/spi_bfin5xx.c
+++ b/drivers/spi/spi_bfin5xx.c
@@ -169,7 +169,7 @@ static int bfin_spi_flush(struct driver_data *drv_data)
 	unsigned long limit = loops_per_jiffy << 1;
 
 	/* wait for stop and clear stat */
-	while (!(read_STAT(drv_data) & BIT_STAT_SPIF) && limit--)
+	while (!(read_STAT(drv_data) & BIT_STAT_SPIF) && --limit)
 		cpu_relax();
 
 	write_STAT(drv_data, BIT_STAT_CLR);

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] spi_bfin5xx: limit reaches -1
       [not found] ` <49E7A528.9070400-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2009-04-16 23:12   ` David Brownell
  0 siblings, 0 replies; 2+ messages in thread
From: David Brownell @ 2009-04-16 23:12 UTC (permalink / raw)
  To: Roel Kluin
  Cc: Bryan Wu, spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	Andrew Morton

On Thursday 16 April 2009, Roel Kluin wrote:
> bfin_spi_flush() returns limit, which reaches -1 upon timeout. but in function
> bfin_spi_pump_transfers() it is compared with 0.
> 
> Signed-off-by: Roel Kluin <roel.kluin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Acked-by: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>

... although this could trigger a rarely-seen-before fault
path in this driver, which I hope won't cause trouble.  Bryan?

> ---
> diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
> index f014cc2..6545b0c 100644
> --- a/drivers/spi/spi_bfin5xx.c
> +++ b/drivers/spi/spi_bfin5xx.c
> @@ -169,7 +169,7 @@ static int bfin_spi_flush(struct driver_data *drv_data)
>  	unsigned long limit = loops_per_jiffy << 1;
>  
>  	/* wait for stop and clear stat */
> -	while (!(read_STAT(drv_data) & BIT_STAT_SPIF) && limit--)
> +	while (!(read_STAT(drv_data) & BIT_STAT_SPIF) && --limit)
>  		cpu_relax();
>  
>  	write_STAT(drv_data, BIT_STAT_CLR);
> 
> 



------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-04-16 23:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-16 21:37 [PATCH] spi_bfin5xx: limit reaches -1 Roel Kluin
     [not found] ` <49E7A528.9070400-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-04-16 23:12   ` David Brownell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.