All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [PATCH] drivers/ieee1394/hosts.c : Use of time_after() macro
@ 2005-04-13 15:51 Marcelo Feitoza Parisi
  2005-04-13 16:07 ` Nish Aravamudan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marcelo Feitoza Parisi @ 2005-04-13 15:51 UTC (permalink / raw)
  To: kernel-janitors

Use of time_after() macro, defined at linux/jiffies.h, which deal with
wrapping correctly and are nicer to read.

-- 

Marcelo Feitoza Parisi            
marcelo at feitoza.com.br
http://marcelo.feitoza.com.br/


Signed-off-by: Marcelo Feitoza Parisi <marcelo@feitoza.com.br>

--- linux/drivers/ieee1394/hosts.c 2005-03-02 04:38:07.000000000 -0300
+++ development/drivers/ieee1394/hosts.c 2005-04-09 22:06:53.000000000 -0300
@@ -18,6 +18,7 @@
#include <linux/slab.h>
#include <linux/pci.h>
#include <linux/timer.h>
+#include <linux/jiffies.h>

#include "csr1212.h"
#include "ieee1394.h"
@@ -217,7 +218,7 @@ int hpsb_update_config_rom_image(struct

    /* IEEE 1394a-2000 prohibits using the same generation number
    * twice in a 60 second period. */
    - if (jiffies - host->csr.gen_timestamp[next_gen] < 60 * HZ)
    + if (time_after(jiffies, host->csr.gen_timestamp[next_gen] - 60 * HZ))
        /* Wait 60 seconds from the last time this generation number was
        * used. */
        reset_delay = (60 * HZ) + host->csr.gen_timestamp[next_gen] - 
jiffies;
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] [PATCH] drivers/ieee1394/hosts.c : Use of time_after() macro
  2005-04-13 15:51 [KJ] [PATCH] drivers/ieee1394/hosts.c : Use of time_after() macro Marcelo Feitoza Parisi
@ 2005-04-13 16:07 ` Nish Aravamudan
  2005-04-14 21:46 ` [KJ] [PATCH] drivers/ieee1394/hosts.c : Use of time_before() Marcelo Feitoza Parisi
  2005-07-08 19:32 ` [KJ] [PATCH] drivers/ieee1394/hosts.c : Use of time_before macro Marcelo Feitoza Parisi
  2 siblings, 0 replies; 4+ messages in thread
From: Nish Aravamudan @ 2005-04-13 16:07 UTC (permalink / raw)
  To: kernel-janitors

On 4/13/05, Marcelo Feitoza Parisi <marcelo@feitoza.com.br> wrote:
> Use of time_after() macro, defined at linux/jiffies.h, which deal with
> wrapping correctly and are nicer to read.
> 
> --
> 
> Marcelo Feitoza Parisi
> marcelo at feitoza.com.br
> http://marcelo.feitoza.com.br/
> 
> Signed-off-by: Marcelo Feitoza Parisi <marcelo@feitoza.com.br>
> 
> --- linux/drivers/ieee1394/hosts.c 2005-03-02 04:38:07.000000000 -0300
> +++ development/drivers/ieee1394/hosts.c 2005-04-09 22:06:53.000000000 -0300
> @@ -18,6 +18,7 @@
> #include <linux/slab.h>
> #include <linux/pci.h>
> #include <linux/timer.h>
> +#include <linux/jiffies.h>
> 
> #include "csr1212.h"
> #include "ieee1394.h"
> @@ -217,7 +218,7 @@ int hpsb_update_config_rom_image(struct
> 
>     /* IEEE 1394a-2000 prohibits using the same generation number
>     * twice in a 60 second period. */
>     - if (jiffies - host->csr.gen_timestamp[next_gen] < 60 * HZ)
>     + if (time_after(jiffies, host->csr.gen_timestamp[next_gen] - 60 * HZ))

I think this should be

if (time_before(jiffies, host->csr.gen_timestamp[next_gen] + 60 * HZ))

subtracting in a comparison is somehow confusing to me :)

Thanks,
Nish

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

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

* [KJ] [PATCH] drivers/ieee1394/hosts.c : Use of time_before()
  2005-04-13 15:51 [KJ] [PATCH] drivers/ieee1394/hosts.c : Use of time_after() macro Marcelo Feitoza Parisi
  2005-04-13 16:07 ` Nish Aravamudan
@ 2005-04-14 21:46 ` Marcelo Feitoza Parisi
  2005-07-08 19:32 ` [KJ] [PATCH] drivers/ieee1394/hosts.c : Use of time_before macro Marcelo Feitoza Parisi
  2 siblings, 0 replies; 4+ messages in thread
From: Marcelo Feitoza Parisi @ 2005-04-14 21:46 UTC (permalink / raw)
  To: kernel-janitors

Again, following Nish's instruction, the time_after() macro, was 
removed, and a time_before() macro was placed there.

Signed-off-by: Marcelo Feitoza Parisi <marcelo@feitoza.com.br>

--- linux/drivers/ieee1394/hosts.c      2005-03-02 04:38:07.000000000 -0300
+++ development/drivers/ieee1394/hosts.c        2005-04-14 
18:44:06.000000000 -0300
@@ -18,6 +18,7 @@
 #include <linux/slab.h>
 #include <linux/pci.h>
 #include <linux/timer.h>
+#include <linux/jiffies.h>

 #include "csr1212.h"
 #include "ieee1394.h"
@@ -217,7 +218,7 @@

        /* IEEE 1394a-2000 prohibits using the same generation number
         * twice in a 60 second period. */
-       if (jiffies - host->csr.gen_timestamp[next_gen] < 60 * HZ)
+       if (time_before(jiffies, host->csr.gen_timestamp[next_gen] + 60 
* HZ))
                /* Wait 60 seconds from the last time this generation 
number was
                 * used. */
                reset_delay = (60 * HZ) + 
host->csr.gen_timestamp[next_gen] - jiffies;

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

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

* [KJ] [PATCH] drivers/ieee1394/hosts.c : Use of time_before macro
  2005-04-13 15:51 [KJ] [PATCH] drivers/ieee1394/hosts.c : Use of time_after() macro Marcelo Feitoza Parisi
  2005-04-13 16:07 ` Nish Aravamudan
  2005-04-14 21:46 ` [KJ] [PATCH] drivers/ieee1394/hosts.c : Use of time_before() Marcelo Feitoza Parisi
@ 2005-07-08 19:32 ` Marcelo Feitoza Parisi
  2 siblings, 0 replies; 4+ messages in thread
From: Marcelo Feitoza Parisi @ 2005-07-08 19:32 UTC (permalink / raw)
  To: kernel-janitors

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

Use of time_before() macro, defined at linux/jiffies.h, which deal with
wrapping correctly and are nicer to read.

[-- Attachment #2: hosts.patch --]
[-- Type: text/x-patch, Size: 791 bytes --]

Signed-off-by: Marcelo Feitoza Parisi <marcelo@feitoza.com.br>

--- linux/drivers/ieee1394/hosts.c	2005-06-17 16:48:29.000000000 -0300
+++ linux-kj/drivers/ieee1394/hosts.c	2005-07-07 20:38:07.609477888 -0300
@@ -18,6 +18,7 @@
 #include <linux/slab.h>
 #include <linux/pci.h>
 #include <linux/timer.h>
+#include <linux/jiffies.h>
 
 #include "csr1212.h"
 #include "ieee1394.h"
@@ -217,7 +218,7 @@
 
 	/* IEEE 1394a-2000 prohibits using the same generation number
 	 * twice in a 60 second period. */
-	if (jiffies - host->csr.gen_timestamp[next_gen] < 60 * HZ)
+	if (time_before(jiffies, host->csr.gen_timestamp[next_gen] + 60 * HZ))
 		/* Wait 60 seconds from the last time this generation number was
 		 * used. */
 		reset_delay = (60 * HZ) + host->csr.gen_timestamp[next_gen] - jiffies;

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

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

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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-13 15:51 [KJ] [PATCH] drivers/ieee1394/hosts.c : Use of time_after() macro Marcelo Feitoza Parisi
2005-04-13 16:07 ` Nish Aravamudan
2005-04-14 21:46 ` [KJ] [PATCH] drivers/ieee1394/hosts.c : Use of time_before() Marcelo Feitoza Parisi
2005-07-08 19:32 ` [KJ] [PATCH] drivers/ieee1394/hosts.c : Use of time_before macro Marcelo Feitoza Parisi

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.