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/eth16i.c | |
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/eth16i.c')
-rw-r--r-- | drivers/net/eth16i.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/net/eth16i.c b/drivers/net/eth16i.c index f32a6b3acb2a..b67545be2caa 100644 --- a/drivers/net/eth16i.c +++ b/drivers/net/eth16i.c | |||
@@ -161,6 +161,7 @@ static char *version = | |||
161 | #include <linux/etherdevice.h> | 161 | #include <linux/etherdevice.h> |
162 | #include <linux/skbuff.h> | 162 | #include <linux/skbuff.h> |
163 | #include <linux/bitops.h> | 163 | #include <linux/bitops.h> |
164 | #include <linux/jiffies.h> | ||
164 | 165 | ||
165 | #include <asm/system.h> | 166 | #include <asm/system.h> |
166 | #include <asm/io.h> | 167 | #include <asm/io.h> |
@@ -754,7 +755,7 @@ static void eth16i_set_port(int ioaddr, int porttype) | |||
754 | 755 | ||
755 | static int eth16i_send_probe_packet(int ioaddr, unsigned char *b, int l) | 756 | static int eth16i_send_probe_packet(int ioaddr, unsigned char *b, int l) |
756 | { | 757 | { |
757 | int starttime; | 758 | unsigned long starttime; |
758 | 759 | ||
759 | outb(0xff, ioaddr + TX_STATUS_REG); | 760 | outb(0xff, ioaddr + TX_STATUS_REG); |
760 | 761 | ||
@@ -765,7 +766,7 @@ static int eth16i_send_probe_packet(int ioaddr, unsigned char *b, int l) | |||
765 | outb(TX_START | 1, ioaddr + TRANSMIT_START_REG); | 766 | outb(TX_START | 1, ioaddr + TRANSMIT_START_REG); |
766 | 767 | ||
767 | while( (inb(ioaddr + TX_STATUS_REG) & 0x80) == 0) { | 768 | while( (inb(ioaddr + TX_STATUS_REG) & 0x80) == 0) { |
768 | if( (jiffies - starttime) > TX_TIMEOUT) { | 769 | if( time_after(jiffies, starttime + TX_TIMEOUT)) { |
769 | return -1; | 770 | return -1; |
770 | } | 771 | } |
771 | } | 772 | } |
@@ -775,18 +776,18 @@ static int eth16i_send_probe_packet(int ioaddr, unsigned char *b, int l) | |||
775 | 776 | ||
776 | static int eth16i_receive_probe_packet(int ioaddr) | 777 | static int eth16i_receive_probe_packet(int ioaddr) |
777 | { | 778 | { |
778 | int starttime; | 779 | unsigned long starttime; |
779 | 780 | ||
780 | starttime = jiffies; | 781 | starttime = jiffies; |
781 | 782 | ||
782 | while((inb(ioaddr + TX_STATUS_REG) & 0x20) == 0) { | 783 | while((inb(ioaddr + TX_STATUS_REG) & 0x20) == 0) { |
783 | if( (jiffies - starttime) > TX_TIMEOUT) { | 784 | if( time_after(jiffies, starttime + TX_TIMEOUT)) { |
784 | 785 | ||
785 | if(eth16i_debug > 1) | 786 | if(eth16i_debug > 1) |
786 | printk(KERN_DEBUG "Timeout occurred waiting transmit packet received\n"); | 787 | printk(KERN_DEBUG "Timeout occurred waiting transmit packet received\n"); |
787 | starttime = jiffies; | 788 | starttime = jiffies; |
788 | while((inb(ioaddr + RX_STATUS_REG) & 0x80) == 0) { | 789 | while((inb(ioaddr + RX_STATUS_REG) & 0x80) == 0) { |
789 | if( (jiffies - starttime) > TX_TIMEOUT) { | 790 | if( time_after(jiffies, starttime + TX_TIMEOUT)) { |
790 | if(eth16i_debug > 1) | 791 | if(eth16i_debug > 1) |
791 | printk(KERN_DEBUG "Timeout occurred waiting receive packet\n"); | 792 | printk(KERN_DEBUG "Timeout occurred waiting receive packet\n"); |
792 | return -1; | 793 | return -1; |