Skip to contentSkip to conversation

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

PATCH In review Marcelo Feitoza Parisi 2 participants 2 messages Jul 16, 2005 – Jul 29, 2005

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

PATCH 1/1 drivers/net/es3210.c : Use of the time_after() macro

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

drivers/net/es3210.c +2 -1
@@ -56,6 +56,7 @@
 #include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
+#include <linux/jiffies.h>
 
 #include <asm/io.h>
 #include <asm/system.h>
@@ -331,7 +332,7 @@
 	if (ei_debug > 1) printk("%s: resetting the ES3210...", dev->name);
 
 	end = jiffies + 2*HZ/100;
-        while ((signed)(end - jiffies) > 0) continue;
+        while (time_after(end, jiffies)) continue;
 
 	ei_status.txing = 0;
 	outb(0x01, ioaddr + ES_RESET_PORT);

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

#1 lore raw
Quoted 18 lines · Marcelo Feitoza Parisi

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

drivers/net/es3210.c +1 -0
@@ -56,6 +56,7 @@
 #include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
+#include <linux/jiffies.h>
 
 #include <asm/io.h>
 #include <asm/system.h>

drivers/net/es3210.c line 335

Quoted 5 lines
drivers/net/es3210.c +1 -1
@@ -331,7 +332,7 @@
 	if (ei_debug > 1) printk("%s: resetting the ES3210...", dev->name);
 
 	end = jiffies + 2*HZ/100;
-        while ((signed)(end - jiffies) > 0) continue;
+        while (time_after(end, jiffies)) continue;

Seems like I missed this on the first review...
msleep(20) should be much better here.

Quoted 8 lines
drivers/net/es3210.c +0 -0
 	ei_status.txing = 0;
 	outb(0x01, ioaddr + ES_RESET_PORT);
 

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

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