All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [PATCH] drivers/i2c/chips/* : timer_after
@ 2005-02-24  9:52 Christophe Lucas
  2005-02-24 10:13 ` Alexey Dobriyan
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Christophe Lucas @ 2005-02-24  9:52 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 456 bytes --]

Hi kj folks,

I think this patch have already posted, but kj TODO have been recently
updated, and this entry already is here, so:

description:
From kj/TODO:
4.
Some drivers do:
if ((jiffies - data->last_updated > HZ * 2) ||
            (jiffies < data->last_updated))
Should be:
#include <linux/jiffies.h>
if (time_after(jiffies, data->last_updated + HZ * 2))

Have a patch for drivers/i2c/chips/*.

Signed-off-by: Christophe Lucas <c.lucas@ifrance.com>


[-- Attachment #2: patch-linux-2.6.11-rc4-jiffies.diff --]
[-- Type: text/plain, Size: 4832 bytes --]

diff -urpN -X /work/users/dontdiff linux-2.6.11-rc4-vanilla/drivers/i2c/chips/adm1025.c linux-2.6.11-rc4/drivers/i2c/chips/adm1025.c
--- linux-2.6.11-rc4-vanilla/drivers/i2c/chips/adm1025.c	2004-12-24 22:33:47.000000000 +0100
+++ linux-2.6.11-rc4/drivers/i2c/chips/adm1025.c	2005-02-24 09:30:35.000000000 +0100
@@ -46,6 +46,7 @@
  */
 
 #include <linux/config.h>
+#include <linux/jiffies.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
@@ -512,8 +513,7 @@ static struct adm1025_data *adm1025_upda
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > HZ * 2) ||
-	    (jiffies < data->last_updated) ||
+	if (time_after(jiffies, data->last_updated + HZ * 2) || 
 	    !data->valid) {
 		int i;
 
diff -urpN -X /work/users/dontdiff linux-2.6.11-rc4-vanilla/drivers/i2c/chips/lm83.c linux-2.6.11-rc4/drivers/i2c/chips/lm83.c
--- linux-2.6.11-rc4-vanilla/drivers/i2c/chips/lm83.c	2004-12-24 22:34:32.000000000 +0100
+++ linux-2.6.11-rc4/drivers/i2c/chips/lm83.c	2005-02-24 09:27:07.000000000 +0100
@@ -31,6 +31,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 
@@ -369,8 +370,7 @@ static struct lm83_data *lm83_update_dev
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > HZ * 2) ||
-	    (jiffies < data->last_updated) ||
+	if (time_after(jiffies, data->last_updated + HZ * 2) || 
 	    !data->valid) {
 		int nr;
 
diff -urpN -X /work/users/dontdiff linux-2.6.11-rc4-vanilla/drivers/i2c/chips/lm90.c linux-2.6.11-rc4/drivers/i2c/chips/lm90.c
--- linux-2.6.11-rc4-vanilla/drivers/i2c/chips/lm90.c	2005-02-24 09:34:22.000000000 +0100
+++ linux-2.6.11-rc4/drivers/i2c/chips/lm90.c	2005-02-24 09:26:55.000000000 +0100
@@ -66,6 +66,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 
@@ -495,8 +496,7 @@ static struct lm90_data *lm90_update_dev
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > HZ * 2) ||
-	    (jiffies < data->last_updated) ||
+	if ( time_after(jiffies, data->last_updated + HZ * 2) || 
 	    !data->valid) {
 		u8 oldh, newh;
 
diff -urpN -X /work/users/dontdiff linux-2.6.11-rc4-vanilla/drivers/i2c/chips/max1619.c linux-2.6.11-rc4/drivers/i2c/chips/max1619.c
--- linux-2.6.11-rc4-vanilla/drivers/i2c/chips/max1619.c	2004-12-24 22:35:25.000000000 +0100
+++ linux-2.6.11-rc4/drivers/i2c/chips/max1619.c	2005-02-24 09:27:54.000000000 +0100
@@ -30,6 +30,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 
@@ -331,8 +332,7 @@ static struct max1619_data *max1619_upda
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > HZ * 2) ||
-	    (jiffies < data->last_updated) ||
+	if (time_after(jiffies, data->last_updated + HZ * 2) ||
 	    !data->valid) {
 		
 		dev_dbg(&client->dev, "Updating max1619 data.\n");
diff -urpN -X /work/users/dontdiff linux-2.6.11-rc4-vanilla/drivers/i2c/chips/pc87360.c linux-2.6.11-rc4/drivers/i2c/chips/pc87360.c
--- linux-2.6.11-rc4-vanilla/drivers/i2c/chips/pc87360.c	2005-02-24 09:34:22.000000000 +0100
+++ linux-2.6.11-rc4/drivers/i2c/chips/pc87360.c	2005-02-24 09:29:04.000000000 +0100
@@ -37,6 +37,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 #include <linux/i2c-vid.h>
@@ -1174,8 +1175,7 @@ static struct pc87360_data *pc87360_upda
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > HZ * 2)
-	 || (jiffies < data->last_updated) || !data->valid) {
+	if (time_after(jiffies, data->last_updated + HZ * 2) || !data->valid) {
 		dev_dbg(&client->dev, "Data update\n");
 
 		/* Fans */
diff -urpN -X /work/users/dontdiff linux-2.6.11-rc4-vanilla/drivers/i2c/chips/w83l785ts.c linux-2.6.11-rc4/drivers/i2c/chips/w83l785ts.c
--- linux-2.6.11-rc4-vanilla/drivers/i2c/chips/w83l785ts.c	2004-12-24 22:34:26.000000000 +0100
+++ linux-2.6.11-rc4/drivers/i2c/chips/w83l785ts.c	2005-02-24 09:30:17.000000000 +0100
@@ -35,6 +35,7 @@
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 
@@ -301,9 +302,7 @@ static struct w83l785ts_data *w83l785ts_
 
 	down(&data->update_lock);
 
-	if (!data->valid
-	 || (jiffies - data->last_updated > HZ * 2)
-	 || (jiffies < data->last_updated)) {
+	if (!data->valid || time_after(jiffies, data->last_updated + HZ * 2)) {
 		dev_dbg(&client->dev, "Updating w83l785ts data.\n");
 		data->temp = w83l785ts_read_value(client,
 			     W83L785TS_REG_TEMP, data->temp);

[-- Attachment #3: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] [PATCH] drivers/i2c/chips/* : timer_after
  2005-02-24  9:52 [KJ] [PATCH] drivers/i2c/chips/* : timer_after Christophe Lucas
@ 2005-02-24 10:13 ` Alexey Dobriyan
  2005-02-24 10:45 ` Christophe Lucas
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Alexey Dobriyan @ 2005-02-24 10:13 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1911 bytes --]

On Thursday 24 February 2005 11:52, Christophe Lucas wrote:

> I think this patch have already posted, but kj TODO have been recently
> updated, and this entry already is here, so:
> 
> description:
> >From kj/TODO:
> 4.
> Some drivers do:
> if ((jiffies - data->last_updated > HZ * 2) ||
>             (jiffies < data->last_updated))
> Should be:
> #include <linux/jiffies.h>
> if (time_after(jiffies, data->last_updated + HZ * 2))

Greg KH already applied my patch with following diffstat:

 drivers/i2c/chips/adm1021.c    |    5 +++--
 drivers/i2c/chips/adm1025.c    |    5 ++---
 drivers/i2c/chips/adm1026.c    |    7 ++++---
 drivers/i2c/chips/adm1031.c    |    5 +++--
 drivers/i2c/chips/asb100.c     |    5 +++--
 drivers/i2c/chips/ds1621.c     |    5 +++--
 drivers/i2c/chips/eeprom.c     |    4 ++--
 drivers/i2c/chips/fscher.c     |    4 ++--
 drivers/i2c/chips/gl518sm.c    |    5 +++--
 drivers/i2c/chips/it87.c       |    5 +++--
 drivers/i2c/chips/lm63.c       |    5 ++---
 drivers/i2c/chips/lm75.c       |    5 +++--
 drivers/i2c/chips/lm77.c       |    5 +++--
 drivers/i2c/chips/lm78.c       |    5 +++--
 drivers/i2c/chips/lm80.c       |    5 ++---
 drivers/i2c/chips/lm83.c       |    5 ++---
 drivers/i2c/chips/lm85.c       |    5 +++--
 drivers/i2c/chips/lm87.c       |    5 ++---
 drivers/i2c/chips/lm90.c       |    5 ++---
 drivers/i2c/chips/max1619.c    |    6 ++----
 drivers/i2c/chips/pc87360.c    |    4 ++--
 drivers/i2c/chips/smsc47b397.c |    5 ++---
 drivers/i2c/chips/smsc47m1.c   |    4 ++--
 drivers/i2c/chips/via686a.c    |    6 +++---
 drivers/i2c/chips/w83627hf.c   |    5 +++--
 drivers/i2c/chips/w83781d.c    |    6 +++---
 drivers/i2c/chips/w83l785ts.c  |    5 ++---
 27 files changed, 69 insertions(+), 67 deletions(-)

	Alexey

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] [PATCH] drivers/i2c/chips/* : timer_after
  2005-02-24  9:52 [KJ] [PATCH] drivers/i2c/chips/* : timer_after Christophe Lucas
  2005-02-24 10:13 ` Alexey Dobriyan
@ 2005-02-24 10:45 ` Christophe Lucas
  2005-02-24 16:06 ` Randy.Dunlap
  2005-02-24 19:08 ` Greg KH
  3 siblings, 0 replies; 5+ messages in thread
From: Christophe Lucas @ 2005-02-24 10:45 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 614 bytes --]

Alexey Dobriyan (adobriyan@mail.ru) wrote:
> On Thursday 24 February 2005 11:52, Christophe Lucas wrote:
> 
> > I think this patch have already posted, but kj TODO have been recently
> > updated, and this entry already is here, so:
> > 
> > description:
> > >From kj/TODO:
> > 4.
> > Some drivers do:
> > if ((jiffies - data->last_updated > HZ * 2) ||
> >             (jiffies < data->last_updated))
> > Should be:
> > #include <linux/jiffies.h>
> > if (time_after(jiffies, data->last_updated + HZ * 2))
> 
> Greg KH already applied my patch with following diffstat:

Ok sorry :-)

Have a nice day.

	~Christophe


[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] [PATCH] drivers/i2c/chips/* : timer_after
  2005-02-24  9:52 [KJ] [PATCH] drivers/i2c/chips/* : timer_after Christophe Lucas
  2005-02-24 10:13 ` Alexey Dobriyan
  2005-02-24 10:45 ` Christophe Lucas
@ 2005-02-24 16:06 ` Randy.Dunlap
  2005-02-24 19:08 ` Greg KH
  3 siblings, 0 replies; 5+ messages in thread
From: Randy.Dunlap @ 2005-02-24 16:06 UTC (permalink / raw)
  To: kernel-janitors

Christophe Lucas wrote:
> Hi kj folks,
> 
> I think this patch have already posted, but kj TODO have been recently
> updated, and this entry already is here, so:
> 
> description:
>>From kj/TODO:
> 4.
> Some drivers do:
> if ((jiffies - data->last_updated > HZ * 2) ||
>             (jiffies < data->last_updated))
> Should be:
> #include <linux/jiffies.h>
> if (time_after(jiffies, data->last_updated + HZ * 2))

I see that Alexey's patch is already merged, but in the continuing
spirit of KJ mentoring...  :)

It would make sense in several of these to check for '!data_valid'
before the time_after() test instead of after it, as is done
in the last patch segment.

> ------------------------------------------------------------------------
> 
> diff -urpN -X /work/users/dontdiff linux-2.6.11-rc4-vanilla/drivers/i2c/chips/adm1025.c linux-2.6.11-rc4/drivers/i2c/chips/adm1025.c
> --- linux-2.6.11-rc4-vanilla/drivers/i2c/chips/adm1025.c	2004-12-24 22:33:47.000000000 +0100
> +++ linux-2.6.11-rc4/drivers/i2c/chips/adm1025.c	2005-02-24 09:30:35.000000000 +0100
> @@ -512,8 +513,7 @@ static struct adm1025_data *adm1025_upda
>  
>  	down(&data->update_lock);
>  
> -	if ((jiffies - data->last_updated > HZ * 2) ||
> -	    (jiffies < data->last_updated) ||
> +	if (time_after(jiffies, data->last_updated + HZ * 2) || 
>  	    !data->valid) {
>  		int i;
>  
> diff -urpN -X /work/users/dontdiff linux-2.6.11-rc4-vanilla/drivers/i2c/chips/lm83.c linux-2.6.11-rc4/drivers/i2c/chips/lm83.c
> --- linux-2.6.11-rc4-vanilla/drivers/i2c/chips/lm83.c	2004-12-24 22:34:32.000000000 +0100
> +++ linux-2.6.11-rc4/drivers/i2c/chips/lm83.c	2005-02-24 09:27:07.000000000 +0100
> @@ -369,8 +370,7 @@ static struct lm83_data *lm83_update_dev
>  
>  	down(&data->update_lock);
>  
> -	if ((jiffies - data->last_updated > HZ * 2) ||
> -	    (jiffies < data->last_updated) ||
> +	if (time_after(jiffies, data->last_updated + HZ * 2) || 
>  	    !data->valid) {
>  		int nr;
>  
> diff -urpN -X /work/users/dontdiff linux-2.6.11-rc4-vanilla/drivers/i2c/chips/lm90.c linux-2.6.11-rc4/drivers/i2c/chips/lm90.c
> --- linux-2.6.11-rc4-vanilla/drivers/i2c/chips/lm90.c	2005-02-24 09:34:22.000000000 +0100
> +++ linux-2.6.11-rc4/drivers/i2c/chips/lm90.c	2005-02-24 09:26:55.000000000 +0100
> @@ -495,8 +496,7 @@ static struct lm90_data *lm90_update_dev
>  
>  	down(&data->update_lock);
>  
> -	if ((jiffies - data->last_updated > HZ * 2) ||
> -	    (jiffies < data->last_updated) ||
> +	if ( time_after(jiffies, data->last_updated + HZ * 2) || 
>  	    !data->valid) {
>  		u8 oldh, newh;
>  
> diff -urpN -X /work/users/dontdiff linux-2.6.11-rc4-vanilla/drivers/i2c/chips/max1619.c linux-2.6.11-rc4/drivers/i2c/chips/max1619.c
> --- linux-2.6.11-rc4-vanilla/drivers/i2c/chips/max1619.c	2004-12-24 22:35:25.000000000 +0100
> +++ linux-2.6.11-rc4/drivers/i2c/chips/max1619.c	2005-02-24 09:27:54.000000000 +0100
> @@ -331,8 +332,7 @@ static struct max1619_data *max1619_upda
>  
>  	down(&data->update_lock);
>  
> -	if ((jiffies - data->last_updated > HZ * 2) ||
> -	    (jiffies < data->last_updated) ||
> +	if (time_after(jiffies, data->last_updated + HZ * 2) ||
>  	    !data->valid) {
>  		
>  		dev_dbg(&client->dev, "Updating max1619 data.\n");
> diff -urpN -X /work/users/dontdiff linux-2.6.11-rc4-vanilla/drivers/i2c/chips/pc87360.c linux-2.6.11-rc4/drivers/i2c/chips/pc87360.c
> --- linux-2.6.11-rc4-vanilla/drivers/i2c/chips/pc87360.c	2005-02-24 09:34:22.000000000 +0100
> +++ linux-2.6.11-rc4/drivers/i2c/chips/pc87360.c	2005-02-24 09:29:04.000000000 +0100
> @@ -1174,8 +1175,7 @@ static struct pc87360_data *pc87360_upda
>  
>  	down(&data->update_lock);
>  
> -	if ((jiffies - data->last_updated > HZ * 2)
> -	 || (jiffies < data->last_updated) || !data->valid) {
> +	if (time_after(jiffies, data->last_updated + HZ * 2) || !data->valid) {
>  		dev_dbg(&client->dev, "Data update\n");
>  
>  		/* Fans */
> diff -urpN -X /work/users/dontdiff linux-2.6.11-rc4-vanilla/drivers/i2c/chips/w83l785ts.c linux-2.6.11-rc4/drivers/i2c/chips/w83l785ts.c
> --- linux-2.6.11-rc4-vanilla/drivers/i2c/chips/w83l785ts.c	2004-12-24 22:34:26.000000000 +0100
> +++ linux-2.6.11-rc4/drivers/i2c/chips/w83l785ts.c	2005-02-24 09:30:17.000000000 +0100
> @@ -301,9 +302,7 @@ static struct w83l785ts_data *w83l785ts_
>  
>  	down(&data->update_lock);
>  
> -	if (!data->valid
> -	 || (jiffies - data->last_updated > HZ * 2)
> -	 || (jiffies < data->last_updated)) {
> +	if (!data->valid || time_after(jiffies, data->last_updated + HZ * 2)) {
>  		dev_dbg(&client->dev, "Updating w83l785ts data.\n");


-- 
~Randy
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] [PATCH] drivers/i2c/chips/* : timer_after
  2005-02-24  9:52 [KJ] [PATCH] drivers/i2c/chips/* : timer_after Christophe Lucas
                   ` (2 preceding siblings ...)
  2005-02-24 16:06 ` Randy.Dunlap
@ 2005-02-24 19:08 ` Greg KH
  3 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2005-02-24 19:08 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 609 bytes --]

On Thu, Feb 24, 2005 at 10:52:17AM +0100, Christophe Lucas wrote:
> Hi kj folks,
> 
> I think this patch have already posted, but kj TODO have been recently
> updated, and this entry already is here, so:
> 
> description:
> >From kj/TODO:
> 4.
> Some drivers do:
> if ((jiffies - data->last_updated > HZ * 2) ||
>             (jiffies < data->last_updated))
> Should be:
> #include <linux/jiffies.h>
> if (time_after(jiffies, data->last_updated + HZ * 2))
> 
> Have a patch for drivers/i2c/chips/*.
> 
> Signed-off-by: Christophe Lucas <c.lucas@ifrance.com>

Already fixed in the -mm tree.

thanks,

greg k-h

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

end of thread, other threads:[~2005-02-24 19:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-24  9:52 [KJ] [PATCH] drivers/i2c/chips/* : timer_after Christophe Lucas
2005-02-24 10:13 ` Alexey Dobriyan
2005-02-24 10:45 ` Christophe Lucas
2005-02-24 16:06 ` Randy.Dunlap
2005-02-24 19:08 ` Greg KH

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.