Skip to contentSkip to conversation

drivers/net/hp100.c : Use of time_after() macro

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

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/net/hp100.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 · 40 lines
Marcelo Feitoza Parisi            
marcelo at feitoza.com.br
http://marcelo.feitoza.com.br/


Marcelo Feitoza Parisi <[email protected]>

--- linux/drivers/net/hp100.c	2005-03-02 04:38:04.000000000 -0300
+++ development/drivers/net/hp100.c	2005-04-09 18:42:14.000000000 -0300
@@ -115,6 +115,7 @@
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/bitops.h>
+#include <linux/jiffies.h>
 
 #include <asm/io.h>
 
@@ -1493,7 +1494,7 @@ static int hp100_start_xmit_bm(struct sk
 		printk("hp100: %s: start_xmit_bm: No TX PDL available.\n", dev->name);
 #endif
 		/* not waited long enough since last tx? */
-		if (jiffies - dev->trans_start < HZ)
+		if (time_after(jiffies, dev->trans_start - HZ))
 			return -EAGAIN;
 
 		if (hp100_check_lan(dev))
@@ -1646,7 +1647,7 @@ static int hp100_start_xmit(struct sk_bu
 		printk("hp100: %s: start_xmit: tx free mem = 0x%x\n", dev->name, i);
 #endif
 		/* not waited long enough since last failed tx try? */
-		if (jiffies - dev->trans_start < HZ) {
+		if (time_after(jiffies, dev->trans_start - HZ)) {
 #ifdef HP100_DEBUG
 			printk("hp100: %s: trans_start timing problem\n",
 			       dev->name);

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
#1 lore raw
Quoted 26 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/

Marcelo Feitoza Parisi <[email protected]>

drivers/net/hp100.c 2005-04-09 18:42:14.000000000 -0300 renamed from drivers/net/hp100.c 2005-03-02 04:38:04.000000000 -0300 +2 -1
@@ -115,6 +115,7 @@
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/bitops.h>
+#include <linux/jiffies.h>
 
 #include <asm/io.h>
 
@@ -1493,7 +1494,7 @@ static int hp100_start_xmit_bm(struct sk
                printk("hp100: %s: start_xmit_bm: No TX PDL available.\n", dev->name);
 #endif
                /* not waited long enough since last tx? */
-               if (jiffies - dev->trans_start < HZ)
+               if (time_after(jiffies, dev->trans_start - HZ))

<snip>

drivers/net/hp100.c 2005-04-09 18:42:14.000000000 -0300

Quoted 2 lines
drivers/net/hp100.c 2005-04-09 18:42:14.000000000 -0300 renamed from drivers/net/hp100.c 2005-03-02 04:38:04.000000000 -0300 +1 -1
-               if (jiffies - dev->trans_start < HZ) {
+               if (time_after(jiffies, dev->trans_start - HZ)) {

I think these both should be

if (time_before(jiffies, dev->trans_start + HZ))

Thanks,
Nish

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw

PATCH 1/1 drivers/net/hp100.c : Use of time_before() macro,

In reply to Marcelo Feitoza Parisi

Again, following Nish's catch, now the patch is using time_before() macro, instead of time_after() macro,
that was the way I did before. Both macros are defined at linux/jiffies.h. Any problem, please contact-me.

drivers/net/hp100.c 2005-04-14 18:39:13.000000000 -0300 renamed from drivers/net/hp100.c 2005-03-02 04:38:04.000000000 -0300 +1 -0
@@ -115,6 +115,7 @@
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/bitops.h>
+#include <linux/jiffies.h>
 
 #include <asm/io.h>
 
@@ -1493,7 +1494,7 @@
                printk("hp100: %s: start_xmit_bm: No TX PDL 

available.\n", dev->name);

 #endif
                /* not waited long enough since last tx? */
-               if (jiffies - dev->trans_start < HZ)
+               if (time_before(jiffies, dev->trans_start + HZ))
                        return -EAGAIN;

                if (hp100_check_lan(dev))
@@ -1646,7 +1647,7 @@
                printk("hp100: %s: start_xmit: tx free mem = 0x%x\n", 
dev->name, i);
 #endif
                /* not waited long enough since last failed tx try? */

- if (jiffies - dev->trans_start < HZ) {
+ if (time_before(jiffies, dev->trans_start + HZ)) {
#ifdef HP100_DEBUG
printk("hp100: %s: trans_start timing problem\n",
dev->name);

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#3 lore raw

PATCH 1/1 drivers/net/hp100.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/net/hp100.c 2005-07-07 20:43:38.393191120 -0300 renamed from drivers/net/hp100.c 2005-07-07 19:13:15.000000000 -0300 +1 -0
@@ -116,6 +116,7 @@
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/bitops.h>
+#include <linux/jiffies.h>
 
 #include <asm/io.h>
 
@@ -1500,7 +1501,7 @@
                printk(KERN_DEBUG "hp100: %s: start_xmit_bm: No TX PDL

available.\n", dev->name);

 #endif
                /* not waited long enough since last tx? */
-               if (jiffies - dev->trans_start < HZ)
+               if (time_before(jiffies, dev->trans_start + HZ))
                        return -EAGAIN;

                if (hp100_check_lan(dev))
@@ -1653,7 +1654,7 @@
                printk(KERN_DEBUG "hp100: %s: start_xmit: tx free mem 0x%x\n", dev->name, i);
 #endif
                /* not waited long enough since last failed tx try? */

- if (jiffies - dev->trans_start < HZ) {
+ if (time_before(jiffies, dev->trans_start + HZ)) {
#ifdef HP100_DEBUG
printk(KERN_DEBUG "hp100: %s: trans_start timing
problem\n",

                               dev->name);

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors