All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [PATCH] drivers/net/ne2k-pci.c : Use of time_after() macro
@ 2005-04-14 23:55 Marcelo Feitoza Parisi
  2005-04-15  1:33 ` Mark Hollomon
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marcelo Feitoza Parisi @ 2005-04-14 23:55 UTC (permalink / raw)
  To: kernel-janitors

Added the use of time_after() macro, that is defined at linux/jiffies.h

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

--- linux/drivers/net/ne2k-pci.c    2005-04-07 22:25:51.000000000 -0300
+++ development/drivers/net/ne2k-pci.c    2005-04-14 20:00:28.000000000 
-0300
@@ -53,6 +53,7 @@
 #include <linux/ethtool.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
+#include <linux/jiffies.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
@@ -271,7 +272,7 @@
 
     /* Reset card. Who knows what dain-bramaged state it was left in. */
     {
-        unsigned long reset_start_time = jiffies;
+        unsigned long reset_start_time = jiffies + 2;
 
         outb(inb(ioaddr + NE_RESET), ioaddr + NE_RESET);
 
@@ -280,7 +281,7 @@
         */
         while ((inb(ioaddr + EN0_ISR) & ENISR_RESET) = 0)
             /* Limit wait: '2' avoids jiffy roll-over. */
-            if (jiffies - reset_start_time > 2) {
+            if (time_after(jiffies, reset_start_time)) {
                 printk(KERN_ERR PFX "Card failure (no reset ack).\n");
                 goto err_out_free_netdev;
             }
@@ -441,7 +442,7 @@
    8390 reset command required, but that shouldn't be necessary. */
 static void ne2k_pci_reset_8390(struct net_device *dev)
 {
-    unsigned long reset_start_time = jiffies;
+    unsigned long reset_start_time = jiffies + 2;
 
     if (debug > 1) printk("%s: Resetting the 8390 t=%ld...",
                           dev->name, jiffies);
@@ -453,7 +454,7 @@
 
     /* This check _should_not_ be necessary, omit eventually. */
     while ((inb(NE_BASE+EN0_ISR) & ENISR_RESET) = 0)
-        if (jiffies - reset_start_time > 2) {
+        if (time_after(jiffies, reset_start_time)) {
             printk("%s: ne2k_pci_reset_8390() did not complete.\n", 
dev->name);
             break;
         }
@@ -607,10 +608,10 @@
         }
     }
 
-    dma_start = jiffies;
+    dma_start = jiffies + 2;
 
     while ((inb(nic_base + EN0_ISR) & ENISR_RDC) = 0)
-        if (jiffies - dma_start > 2) {            /* Avoid clock 
roll-over. */
+        if (time_after(jiffies, dma_start)) {            /* Avoid clock 
roll-over. */
             printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", 
dev->name);
             ne2k_pci_reset_8390(dev);
             NS8390_init(dev,1);

_______________________________________________
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/net/ne2k-pci.c : Use of time_after() macro
  2005-04-14 23:55 [KJ] [PATCH] drivers/net/ne2k-pci.c : Use of time_after() macro Marcelo Feitoza Parisi
@ 2005-04-15  1:33 ` Mark Hollomon
  2005-07-16  7:17 ` [KJ] [PATCH] drivers/net/ne2k-pci.c : Use of the " Marcelo Feitoza Parisi
  2005-07-18 16:18 ` [KJ] [PATCH] drivers/net/ne2k-pci.c : Use of the time_after() Domen Puncer
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Hollomon @ 2005-04-15  1:33 UTC (permalink / raw)
  To: kernel-janitors

Marcelo Feitoza Parisi wrote:
> Added the use of time_after() macro, that is defined at linux/jiffies.h
> 
> Signed-off-by: Marcelo Feitoza Parisi <marcelo@feitoza.com.br>
> 
> --- linux/drivers/net/ne2k-pci.c    2005-04-07 22:25:51.000000000 -0300
> +++ development/drivers/net/ne2k-pci.c    2005-04-14 20:00:28.000000000 
> -0300
> @@ -53,6 +53,7 @@
> #include <linux/ethtool.h>
> #include <linux/netdevice.h>
> #include <linux/etherdevice.h>
> +#include <linux/jiffies.h>
> 
> #include <asm/system.h>
> #include <asm/io.h>
> @@ -271,7 +272,7 @@
> 
>     /* Reset card. Who knows what dain-bramaged state it was left in. */
>     {
> -        unsigned long reset_start_time = jiffies;
> +        unsigned long reset_start_time = jiffies + 2;

A nit pick, but if you add 2 to jiffies, it is no longer the reset start time. 
Maybe rename the variable reset_timeout or something.

> 
>         outb(inb(ioaddr + NE_RESET), ioaddr + NE_RESET);
> 
> @@ -280,7 +281,7 @@
>         */
>         while ((inb(ioaddr + EN0_ISR) & ENISR_RESET) = 0)
>             /* Limit wait: '2' avoids jiffy roll-over. */
> -            if (jiffies - reset_start_time > 2) {
> +            if (time_after(jiffies, reset_start_time)) {
>                 printk(KERN_ERR PFX "Card failure (no reset ack).\n");
>                 goto err_out_free_netdev;
>             }
> @@ -441,7 +442,7 @@
>    8390 reset command required, but that shouldn't be necessary. */
> static void ne2k_pci_reset_8390(struct net_device *dev)
> {
> -    unsigned long reset_start_time = jiffies;
> +    unsigned long reset_start_time = jiffies + 2;

ditto

> 
>     if (debug > 1) printk("%s: Resetting the 8390 t=%ld...",
>                           dev->name, jiffies);
> @@ -453,7 +454,7 @@
> 
>     /* This check _should_not_ be necessary, omit eventually. */
>     while ((inb(NE_BASE+EN0_ISR) & ENISR_RESET) = 0)
> -        if (jiffies - reset_start_time > 2) {
> +        if (time_after(jiffies, reset_start_time)) {
>             printk("%s: ne2k_pci_reset_8390() did not complete.\n", 
> dev->name);
>             break;
>         }
> @@ -607,10 +608,10 @@
>         }
>     }
> 
> -    dma_start = jiffies;
> +    dma_start = jiffies + 2;

ditto

> 
>     while ((inb(nic_base + EN0_ISR) & ENISR_RDC) = 0)
> -        if (jiffies - dma_start > 2) {            /* Avoid clock 
> roll-over. */
> +        if (time_after(jiffies, dma_start)) {            /* Avoid clock 
> roll-over. */
>             printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", 
> dev->name);
>             ne2k_pci_reset_8390(dev);
>             NS8390_init(dev,1);
> 
> _______________________________________________
> Kernel-janitors mailing list
> Kernel-janitors@lists.osdl.org
> http://lists.osdl.org/mailman/listinfo/kernel-janitors
> 


-- 
Mark Hollomon
_______________________________________________
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/net/ne2k-pci.c : Use of the time_after() macro
  2005-04-14 23:55 [KJ] [PATCH] drivers/net/ne2k-pci.c : Use of time_after() macro Marcelo Feitoza Parisi
  2005-04-15  1:33 ` Mark Hollomon
@ 2005-07-16  7:17 ` Marcelo Feitoza Parisi
  2005-07-18 16:18 ` [KJ] [PATCH] drivers/net/ne2k-pci.c : Use of the time_after() Domen Puncer
  2 siblings, 0 replies; 4+ messages in thread
From: Marcelo Feitoza Parisi @ 2005-07-16  7:17 UTC (permalink / raw)
  To: kernel-janitors

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



[-- Attachment #2: ne2k-pci.patch --]
[-- Type: text/x-patch, Size: 1327 bytes --]

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

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

--- linux/drivers/net/ne2k-pci.c	2005-07-13 17:53:29.000000000 -0300
+++ linux-kj/drivers/net/ne2k-pci.c	2005-07-15 22:21:44.302017824 -0300
@@ -280,7 +280,7 @@
 		*/
 		while ((inb(ioaddr + EN0_ISR) & ENISR_RESET) == 0)
 			/* Limit wait: '2' avoids jiffy roll-over. */
-			if (jiffies - reset_start_time > 2) {
+			if (time_after(jiffies, reset_start_time + 2)) {
 				printk(KERN_ERR PFX "Card failure (no reset ack).\n");
 				goto err_out_free_netdev;
 			}
@@ -453,7 +453,7 @@
 
 	/* This check _should_not_ be necessary, omit eventually. */
 	while ((inb(NE_BASE+EN0_ISR) & ENISR_RESET) == 0)
-		if (jiffies - reset_start_time > 2) {
+		if (time_after(jiffies, reset_start_time + 2)) {
 			printk("%s: ne2k_pci_reset_8390() did not complete.\n", dev->name);
 			break;
 		}
@@ -610,7 +610,7 @@
 	dma_start = jiffies;
 
 	while ((inb(nic_base + EN0_ISR) & ENISR_RDC) == 0)
-		if (jiffies - dma_start > 2) {			/* Avoid clock roll-over. */
+		if (time_after(jiffies, dma_start + 2)) {	/* Avoid clock roll-over. */
 			printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name);
 			ne2k_pci_reset_8390(dev);
 			NS8390_init(dev,1);

[-- 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

* Re: [KJ] [PATCH] drivers/net/ne2k-pci.c : Use of the time_after()
  2005-04-14 23:55 [KJ] [PATCH] drivers/net/ne2k-pci.c : Use of time_after() macro Marcelo Feitoza Parisi
  2005-04-15  1:33 ` Mark Hollomon
  2005-07-16  7:17 ` [KJ] [PATCH] drivers/net/ne2k-pci.c : Use of the " Marcelo Feitoza Parisi
@ 2005-07-18 16:18 ` Domen Puncer
  2 siblings, 0 replies; 4+ messages in thread
From: Domen Puncer @ 2005-07-18 16:18 UTC (permalink / raw)
  To: kernel-janitors

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

On 16/07/05 04:17 -0300, Marcelo Feitoza Parisi wrote:

> Use of the time_after() macro, defined at linux/jiffies.h, which deal
> with wrapping correctly and are nicer to read.
> 
> Signed-off-by: Marcelo Feitoza Parisi <marcelo@feitoza.com.br>
> 
> --- linux/drivers/net/ne2k-pci.c	2005-07-13 17:53:29.000000000 -0300
> +++ linux-kj/drivers/net/ne2k-pci.c	2005-07-15 22:21:44.302017824 -0300
> @@ -280,7 +280,7 @@
>  		*/
>  		while ((inb(ioaddr + EN0_ISR) & ENISR_RESET) == 0)
>  			/* Limit wait: '2' avoids jiffy roll-over. */

We can get rid of the comment.

> -			if (jiffies - reset_start_time > 2) {

> +			if (time_after(jiffies, reset_start_time + 2)) {

And use just "> 1", as it still guarantees 1 jiffie.

> +		if (time_after(jiffies, reset_start_time + 2)) {

> +		if (time_after(jiffies, dma_start + 2)) {	/* Avoid clock roll-over. */


Also, HZ and/or whitespace issues with:
drivers/net/eexpress.c
drivers/net/eth16i.c
drivers/atm/iphase.c

OK, whitespace I can fix quickly, but for HZ figure out what is
intended, and resend with that in description. Thanks.

[-- Attachment #2: 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-18 16:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-14 23:55 [KJ] [PATCH] drivers/net/ne2k-pci.c : Use of time_after() macro Marcelo Feitoza Parisi
2005-04-15  1:33 ` Mark Hollomon
2005-07-16  7:17 ` [KJ] [PATCH] drivers/net/ne2k-pci.c : Use of the " Marcelo Feitoza Parisi
2005-07-18 16:18 ` [KJ] [PATCH] drivers/net/ne2k-pci.c : Use of the time_after() Domen Puncer

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.