diff options
author | Marcelo Feitoza Parisi <marcelo@feitoza.com.br> | 2006-01-09 21:37:15 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-01-17 07:59:23 -0500 |
commit | ff5688ae1cedfb175b5ed0f319d03ad2e5ee005d (patch) | |
tree | eca0d41b3eefc833238591e0100a8136f21269a7 /drivers/net/tokenring | |
parent | e03d72b99e4027504ada134bf1804d6ea792b206 (diff) |
[PATCH] drivers/net/*: use time_after() and friends
They deal with wrapping correctly and are nicer to read. Also make
jiffies-holding variables unsigned long.
Signed-off-by: Marcelo Feitoza Parisi <marcelo@feitoza.com.br>
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/tokenring')
-rw-r--r-- | drivers/net/tokenring/lanstreamer.c | 3 | ||||
-rw-r--r-- | drivers/net/tokenring/olympic.c | 9 |
2 files changed, 7 insertions, 5 deletions
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c index 97712c3c4e07..c58a4c31d0dd 100644 --- a/drivers/net/tokenring/lanstreamer.c +++ b/drivers/net/tokenring/lanstreamer.c | |||
@@ -122,6 +122,7 @@ | |||
122 | #include <linux/spinlock.h> | 122 | #include <linux/spinlock.h> |
123 | #include <linux/version.h> | 123 | #include <linux/version.h> |
124 | #include <linux/bitops.h> | 124 | #include <linux/bitops.h> |
125 | #include <linux/jiffies.h> | ||
125 | 126 | ||
126 | #include <net/checksum.h> | 127 | #include <net/checksum.h> |
127 | 128 | ||
@@ -512,7 +513,7 @@ static int streamer_reset(struct net_device *dev) | |||
512 | 513 | ||
513 | while (!((readw(streamer_mmio + SISR)) & SISR_SRB_REPLY)) { | 514 | while (!((readw(streamer_mmio + SISR)) & SISR_SRB_REPLY)) { |
514 | msleep_interruptible(100); | 515 | msleep_interruptible(100); |
515 | if (jiffies - t > 40 * HZ) { | 516 | if (time_after(jiffies, t + 40 * HZ)) { |
516 | printk(KERN_ERR | 517 | printk(KERN_ERR |
517 | "IBM PCI tokenring card not responding\n"); | 518 | "IBM PCI tokenring card not responding\n"); |
518 | release_region(dev->base_addr, STREAMER_IO_SPACE); | 519 | release_region(dev->base_addr, STREAMER_IO_SPACE); |
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c index 05477d24fd49..23032a7bc0a9 100644 --- a/drivers/net/tokenring/olympic.c +++ b/drivers/net/tokenring/olympic.c | |||
@@ -100,6 +100,7 @@ | |||
100 | #include <linux/pci.h> | 100 | #include <linux/pci.h> |
101 | #include <linux/spinlock.h> | 101 | #include <linux/spinlock.h> |
102 | #include <linux/bitops.h> | 102 | #include <linux/bitops.h> |
103 | #include <linux/jiffies.h> | ||
103 | 104 | ||
104 | #include <net/checksum.h> | 105 | #include <net/checksum.h> |
105 | 106 | ||
@@ -307,7 +308,7 @@ static int __devinit olympic_init(struct net_device *dev) | |||
307 | t=jiffies; | 308 | t=jiffies; |
308 | while((readl(olympic_mmio+BCTL)) & BCTL_SOFTRESET) { | 309 | while((readl(olympic_mmio+BCTL)) & BCTL_SOFTRESET) { |
309 | schedule(); | 310 | schedule(); |
310 | if(jiffies-t > 40*HZ) { | 311 | if(time_after(jiffies, t + 40*HZ)) { |
311 | printk(KERN_ERR "IBM PCI tokenring card not responding.\n"); | 312 | printk(KERN_ERR "IBM PCI tokenring card not responding.\n"); |
312 | return -ENODEV; | 313 | return -ENODEV; |
313 | } | 314 | } |
@@ -359,7 +360,7 @@ static int __devinit olympic_init(struct net_device *dev) | |||
359 | t=jiffies; | 360 | t=jiffies; |
360 | while (!readl(olympic_mmio+CLKCTL) & CLKCTL_PAUSE) { | 361 | while (!readl(olympic_mmio+CLKCTL) & CLKCTL_PAUSE) { |
361 | schedule() ; | 362 | schedule() ; |
362 | if(jiffies-t > 2*HZ) { | 363 | if(time_after(jiffies, t + 2*HZ)) { |
363 | printk(KERN_ERR "IBM Cardbus tokenring adapter not responsing.\n") ; | 364 | printk(KERN_ERR "IBM Cardbus tokenring adapter not responsing.\n") ; |
364 | return -ENODEV; | 365 | return -ENODEV; |
365 | } | 366 | } |
@@ -373,7 +374,7 @@ static int __devinit olympic_init(struct net_device *dev) | |||
373 | t=jiffies; | 374 | t=jiffies; |
374 | while(!((readl(olympic_mmio+SISR_RR)) & SISR_SRB_REPLY)) { | 375 | while(!((readl(olympic_mmio+SISR_RR)) & SISR_SRB_REPLY)) { |
375 | schedule(); | 376 | schedule(); |
376 | if(jiffies-t > 15*HZ) { | 377 | if(time_after(jiffies, t + 15*HZ)) { |
377 | printk(KERN_ERR "IBM PCI tokenring card not responding.\n"); | 378 | printk(KERN_ERR "IBM PCI tokenring card not responding.\n"); |
378 | return -ENODEV; | 379 | return -ENODEV; |
379 | } | 380 | } |
@@ -519,7 +520,7 @@ static int olympic_open(struct net_device *dev) | |||
519 | olympic_priv->srb_queued=0; | 520 | olympic_priv->srb_queued=0; |
520 | break; | 521 | break; |
521 | } | 522 | } |
522 | if ((jiffies-t) > 10*HZ) { | 523 | if (time_after(jiffies, t + 10*HZ)) { |
523 | printk(KERN_WARNING "%s: SRB timed out. \n",dev->name) ; | 524 | printk(KERN_WARNING "%s: SRB timed out. \n",dev->name) ; |
524 | olympic_priv->srb_queued=0; | 525 | olympic_priv->srb_queued=0; |
525 | break ; | 526 | break ; |