Skip to contentSkip to conversation

drivers/ieee1394/hosts.c : Use of time_after() macro

PATCH In review Marcelo Feitoza Parisi 2 participants 4 messages Apr 13, 2005 – Jul 8, 2005 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/ieee1394/hosts.c : Use of time_after() macro

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

Signature · 31 lines
Marcelo Feitoza Parisi            
marcelo at feitoza.com.br
http://marcelo.feitoza.com.br/


Signed-off-by: Marcelo Feitoza Parisi <[email protected]>

--- 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
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
#1 lore raw
Quoted 22 lines · Marcelo Feitoza Parisi

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/

drivers/ieee1394/hosts.c 2005-04-09 22:06:53.000000000 -0300 renamed from drivers/ieee1394/hosts.c 2005-03-02 04:38:07.000000000 -0300 +1 -0
@@ -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"

drivers/ieee1394/hosts.c 2005-04-09 22:06:53.000000000 -0300 int hpsb_update_config_rom_image(struct · line 222

Quoted 5 lines
drivers/ieee1394/hosts.c 2005-04-09 22:06:53.000000000 -0300 renamed from drivers/ieee1394/hosts.c 2005-03-02 04:38:07.000000000 -0300 +0 -0
@@ -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
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw

PATCH 1/1 drivers/ieee1394/hosts.c : Use of time_before()

In reply to Marcelo Feitoza Parisi

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

--- 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
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#3 lore raw

PATCH 1/1 drivers/ieee1394/hosts.c : Use of time_before macro

In reply to Marcelo Feitoza Parisi

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

drivers/ieee1394/hosts.c +2 -1
@@ -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
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors