linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: fix bit algorithm timeout for low values.
@ 2009-04-23 23:09 Dave Airlie
  2009-04-24  9:42 ` Jean Delvare
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Airlie @ 2009-04-23 23:09 UTC (permalink / raw)
  To: linux-i2c, Jean Delvare; +Cc: linux-kernel, stable, Dave Airlie

From: Dave Airlie <airlied@redhat.com>

When fetching DDC using i2c algo bit, we were often seeing timeouts
before getting valid EDID on a retry. The VESA spec states 2ms is the
DDC timeout, so when this translates into 1 jiffie and we are close
to the end of the time period, it could return with a timeout less than
2ms.

Change this code to use time_after instead of time_after_eq.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/i2c/algos/i2c-algo-bit.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
index d420cc5..e25e139 100644
--- a/drivers/i2c/algos/i2c-algo-bit.c
+++ b/drivers/i2c/algos/i2c-algo-bit.c
@@ -104,7 +104,7 @@ static int sclhi(struct i2c_algo_bit_data *adap)
 		 * chips may hold it low ("clock stretching") while they
 		 * are processing data internally.
 		 */
-		if (time_after_eq(jiffies, start + adap->timeout))
+		if (time_after(jiffies, start + adap->timeout))
 			return -ETIMEDOUT;
 		cond_resched();
 	}
-- 
1.6.0.6


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

* Re: [PATCH] i2c: fix bit algorithm timeout for low values.
  2009-04-23 23:09 [PATCH] i2c: fix bit algorithm timeout for low values Dave Airlie
@ 2009-04-24  9:42 ` Jean Delvare
  2009-05-04 21:53   ` [stable] " Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Jean Delvare @ 2009-04-24  9:42 UTC (permalink / raw)
  To: Dave Airlie; +Cc: linux-i2c, linux-kernel, stable, Dave Airlie

Hi Dave,

On Fri, 24 Apr 2009 09:09:13 +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied@redhat.com>
> 
> When fetching DDC using i2c algo bit, we were often seeing timeouts
> before getting valid EDID on a retry. The VESA spec states 2ms is the
> DDC timeout, so when this translates into 1 jiffie and we are close
> to the end of the time period, it could return with a timeout less than
> 2ms.
> 
> Change this code to use time_after instead of time_after_eq.
> 
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> ---
>  drivers/i2c/algos/i2c-algo-bit.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
> index d420cc5..e25e139 100644
> --- a/drivers/i2c/algos/i2c-algo-bit.c
> +++ b/drivers/i2c/algos/i2c-algo-bit.c
> @@ -104,7 +104,7 @@ static int sclhi(struct i2c_algo_bit_data *adap)
>  		 * chips may hold it low ("clock stretching") while they
>  		 * are processing data internally.
>  		 */
> -		if (time_after_eq(jiffies, start + adap->timeout))
> +		if (time_after(jiffies, start + adap->timeout))
>  			return -ETIMEDOUT;
>  		cond_resched();
>  	}

Applied, thanks. I agree this should go in stable.

-- 
Jean Delvare

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

* Re: [stable] [PATCH] i2c: fix bit algorithm timeout for low values.
  2009-04-24  9:42 ` Jean Delvare
@ 2009-05-04 21:53   ` Greg KH
  2009-05-05  6:05     ` Jean Delvare
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2009-05-04 21:53 UTC (permalink / raw)
  To: Jean Delvare; +Cc: Dave Airlie, stable, Dave Airlie, linux-i2c, linux-kernel

On Fri, Apr 24, 2009 at 11:42:59AM +0200, Jean Delvare wrote:
> Hi Dave,
> 
> On Fri, 24 Apr 2009 09:09:13 +1000, Dave Airlie wrote:
> > From: Dave Airlie <airlied@redhat.com>
> > 
> > When fetching DDC using i2c algo bit, we were often seeing timeouts
> > before getting valid EDID on a retry. The VESA spec states 2ms is the
> > DDC timeout, so when this translates into 1 jiffie and we are close
> > to the end of the time period, it could return with a timeout less than
> > 2ms.
> > 
> > Change this code to use time_after instead of time_after_eq.
> > 
> > Signed-off-by: Dave Airlie <airlied@redhat.com>
> > ---
> >  drivers/i2c/algos/i2c-algo-bit.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
> > index d420cc5..e25e139 100644
> > --- a/drivers/i2c/algos/i2c-algo-bit.c
> > +++ b/drivers/i2c/algos/i2c-algo-bit.c
> > @@ -104,7 +104,7 @@ static int sclhi(struct i2c_algo_bit_data *adap)
> >  		 * chips may hold it low ("clock stretching") while they
> >  		 * are processing data internally.
> >  		 */
> > -		if (time_after_eq(jiffies, start + adap->timeout))
> > +		if (time_after(jiffies, start + adap->timeout))
> >  			return -ETIMEDOUT;
> >  		cond_resched();
> >  	}
> 
> Applied, thanks. I agree this should go in stable.

I don't see this in Linus's tree anywhere, am I just missing it?

thanks,

greg k-h

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

* Re: [stable] [PATCH] i2c: fix bit algorithm timeout for low values.
  2009-05-04 21:53   ` [stable] " Greg KH
@ 2009-05-05  6:05     ` Jean Delvare
  0 siblings, 0 replies; 4+ messages in thread
From: Jean Delvare @ 2009-05-05  6:05 UTC (permalink / raw)
  To: Greg KH; +Cc: stable, Dave Airlie, linux-i2c, linux-kernel

Hi Greg,

On Mon, 4 May 2009 14:53:25 -0700, Greg KH wrote:
> On Fri, Apr 24, 2009 at 11:42:59AM +0200, Jean Delvare wrote:
> > Hi Dave,
> > 
> > On Fri, 24 Apr 2009 09:09:13 +1000, Dave Airlie wrote:
> > > From: Dave Airlie <airlied@redhat.com>
> > > 
> > > When fetching DDC using i2c algo bit, we were often seeing timeouts
> > > before getting valid EDID on a retry. The VESA spec states 2ms is the
> > > DDC timeout, so when this translates into 1 jiffie and we are close
> > > to the end of the time period, it could return with a timeout less than
> > > 2ms.
> > > 
> > > Change this code to use time_after instead of time_after_eq.
> > > 
> > > Signed-off-by: Dave Airlie <airlied@redhat.com>
> > > ---
> > >  drivers/i2c/algos/i2c-algo-bit.c |    2 +-
> > >  1 files changed, 1 insertions(+), 1 deletions(-)
> > > 
> > > diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
> > > index d420cc5..e25e139 100644
> > > --- a/drivers/i2c/algos/i2c-algo-bit.c
> > > +++ b/drivers/i2c/algos/i2c-algo-bit.c
> > > @@ -104,7 +104,7 @@ static int sclhi(struct i2c_algo_bit_data *adap)
> > >  		 * chips may hold it low ("clock stretching") while they
> > >  		 * are processing data internally.
> > >  		 */
> > > -		if (time_after_eq(jiffies, start + adap->timeout))
> > > +		if (time_after(jiffies, start + adap->timeout))
> > >  			return -ETIMEDOUT;
> > >  		cond_resched();
> > >  	}
> > 
> > Applied, thanks. I agree this should go in stable.
> 
> I don't see this in Linus's tree anywhere, am I just missing it?

You're correct, it's not there yet, I'll push it to Linus today. Busy
busy busy.

-- 
Jean Delvare

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

end of thread, other threads:[~2009-05-05  6:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-23 23:09 [PATCH] i2c: fix bit algorithm timeout for low values Dave Airlie
2009-04-24  9:42 ` Jean Delvare
2009-05-04 21:53   ` [stable] " Greg KH
2009-05-05  6:05     ` Jean Delvare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).