public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c,algo: timeout reaches -1
@ 2009-01-31 15:04 Roel Kluin
       [not found] ` <4984688B.2090805-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Roel Kluin @ 2009-01-31 15:04 UTC (permalink / raw)
  To: ben-linux-elnMNo+KYs3YtjvyW6yDsg, khali-PUYAD+kWke1g9hUCZPvPmw
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA

The postfix decrement decrements timeout till -1, but the
warning is already triggered on 0

Signed-off-by: Roel Kluin <roel.kluin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
diff --git a/drivers/i2c/algos/i2c-algo-pcf.c b/drivers/i2c/algos/i2c-algo-pcf.c
index 3e01992..0e2933f 100644
--- a/drivers/i2c/algos/i2c-algo-pcf.c
+++ b/drivers/i2c/algos/i2c-algo-pcf.c
@@ -115,7 +115,7 @@ static int wait_for_bb(struct i2c_algo_pcf_data *adap) {
 
 	status = get_pcf(adap, 1);
 #ifndef STUB_I2C
-	while (timeout-- && !(status & I2C_PCF_BB)) {
+	while (--timeout && !(status & I2C_PCF_BB)) {
 		udelay(100); /* wait for 100 us */
 		status = get_pcf(adap, 1);
 	}
@@ -123,7 +123,7 @@ static int wait_for_bb(struct i2c_algo_pcf_data *adap) {
 	if (timeout <= 0) {
 		printk(KERN_ERR "Timeout waiting for Bus Busy\n");
 	}
-	
+
 	return (timeout<=0);
 }
 
@@ -134,7 +134,7 @@ static int wait_for_pin(struct i2c_algo_pcf_data *adap, int *status) {
 
 	*status = get_pcf(adap, 1);
 #ifndef STUB_I2C
-	while (timeout-- && (*status & I2C_PCF_PIN)) {
+	while (--timeout && (*status & I2C_PCF_PIN)) {
 		adap->waitforpin(adap->data);
 		*status = get_pcf(adap, 1);
 	}

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

end of thread, other threads:[~2009-02-07  0:33 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-31 15:04 [PATCH] i2c,algo: timeout reaches -1 Roel Kluin
     [not found] ` <4984688B.2090805-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-02-01 10:41   ` Jean Delvare
     [not found]     ` <20090201114121.6448a3c9-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-02-02 21:09       ` Roel Kluin
     [not found]         ` <498760F7.6020005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-02-02 21:53           ` Jean Delvare
     [not found]             ` <20090202225309.359e77d6-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-02-03 12:31               ` [PATCH 1/2] i2c,algo: cleanup i2c-algo-pcf.c Roel Kluin
     [not found]                 ` <49883938.9010104-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-02-04  8:34                   ` Jean Delvare
     [not found]                     ` <20090204093402.08ddb2e8-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-02-04 16:07                       ` [PATCH 1/2 v2] " Roel Kluin
     [not found]                         ` <4989BD34.9050406-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-02-05 16:11                           ` Jean Delvare
2009-02-06 13:11                           ` [PATCH 2/2 v2] i2c,algo: handle timeout correctly Roel Kluin
     [not found]                             ` <498C3712.2000904-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-02-06 20:51                               ` Jean Delvare
     [not found]                                 ` <20090206215111.60c83bd0-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-02-07  0:33                                   ` Eric Brower
     [not found]                     ` <25e057c00902040754k22e05c91i72f70f00619d547d@mail.gmail.com>
     [not found]                       ` <25e057c00902040754k22e05c91i72f70f00619d547d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-02-05 20:38                         ` [PATCH 1/2] i2c,algo: cleanup i2c-algo-pcf.c Jean Delvare
     [not found]                           ` <20090205213858.4948305e-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-02-06  2:56                             ` Eric Brower

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox