[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>
This commit is contained in:
parent
e03d72b99e
commit
ff5688ae1c
22 changed files with 65 additions and 45 deletions
|
@ -105,6 +105,7 @@
|
|||
#include <linux/mca-legacy.h>
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/processor.h>
|
||||
|
@ -658,7 +659,7 @@ static int init586(struct net_device *dev)
|
|||
|
||||
s = jiffies; /* warning: only active with interrupts on !! */
|
||||
while (!(cfg_cmd->cmd_status & STAT_COMPL)) {
|
||||
if (jiffies - s > 30*HZ/100)
|
||||
if (time_after(jiffies, s + 30*HZ/100))
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -684,7 +685,7 @@ static int init586(struct net_device *dev)
|
|||
|
||||
s = jiffies;
|
||||
while (!(ias_cmd->cmd_status & STAT_COMPL)) {
|
||||
if (jiffies - s > 30*HZ/100)
|
||||
if (time_after(jiffies, s + 30*HZ/100))
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -709,7 +710,7 @@ static int init586(struct net_device *dev)
|
|||
|
||||
s = jiffies;
|
||||
while (!(tdr_cmd->cmd_status & STAT_COMPL)) {
|
||||
if (jiffies - s > 30*HZ/100) {
|
||||
if (time_after(jiffies, s + 30*HZ/100)) {
|
||||
printk(KERN_WARNING "%s: %d Problems while running the TDR.\n", dev->name, __LINE__);
|
||||
result = 1;
|
||||
break;
|
||||
|
@ -798,7 +799,7 @@ static int init586(struct net_device *dev)
|
|||
elmc_id_attn586();
|
||||
s = jiffies;
|
||||
while (!(mc_cmd->cmd_status & STAT_COMPL)) {
|
||||
if (jiffies - s > 30*HZ/100)
|
||||
if (time_after(jiffies, s + 30*HZ/100))
|
||||
break;
|
||||
}
|
||||
if (!(mc_cmd->cmd_status & STAT_COMPL)) {
|
||||
|
|
|
@ -258,6 +258,7 @@ static int vortex_debug = 1;
|
|||
#include <linux/highmem.h>
|
||||
#include <linux/eisa.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <asm/irq.h> /* For NR_IRQS only. */
|
||||
#include <asm/io.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
@ -2717,7 +2718,7 @@ boomerang_rx(struct net_device *dev)
|
|||
skb = dev_alloc_skb(PKT_BUF_SZ);
|
||||
if (skb == NULL) {
|
||||
static unsigned long last_jif;
|
||||
if ((jiffies - last_jif) > 10 * HZ) {
|
||||
if (time_after(jiffies, last_jif + 10 * HZ)) {
|
||||
printk(KERN_WARNING "%s: memory shortage\n", dev->name);
|
||||
last_jif = jiffies;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <linux/delay.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include <asm/system.h>
|
||||
#include <asm/io.h>
|
||||
|
@ -216,7 +217,7 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr)
|
|||
outb(inb(ioaddr + NE_RESET), ioaddr + NE_RESET);
|
||||
|
||||
while ((inb(ioaddr + NE_EN0_ISR) & ENISR_RESET) == 0)
|
||||
if (jiffies - reset_start_time > 2*HZ/100) {
|
||||
if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
|
||||
printk(" not found (no reset ack).\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
@ -382,7 +383,7 @@ apne_reset_8390(struct net_device *dev)
|
|||
|
||||
/* This check _should_not_ be necessary, omit eventually. */
|
||||
while ((inb(NE_BASE+NE_EN0_ISR) & ENISR_RESET) == 0)
|
||||
if (jiffies - reset_start_time > 2*HZ/100) {
|
||||
if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
|
||||
printk("%s: ne_reset_8390() did not complete.\n", dev->name);
|
||||
break;
|
||||
}
|
||||
|
@ -530,7 +531,7 @@ apne_block_output(struct net_device *dev, int count,
|
|||
dma_start = jiffies;
|
||||
|
||||
while ((inb(NE_BASE + NE_EN0_ISR) & ENISR_RDC) == 0)
|
||||
if (jiffies - dma_start > 2*HZ/100) { /* 20ms */
|
||||
if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */
|
||||
printk("%s: timeout waiting for Tx RDC.\n", dev->name);
|
||||
apne_reset_8390(dev);
|
||||
NS8390_init(dev,1);
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include <net/arp.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/arcdevice.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
/* "do nothing" functions for protocol drivers */
|
||||
static void null_rx(struct net_device *dev, int bufnum,
|
||||
|
@ -733,7 +734,7 @@ static void arcnet_timeout(struct net_device *dev)
|
|||
|
||||
spin_unlock_irqrestore(&lp->lock, flags);
|
||||
|
||||
if (jiffies - lp->last_timeout > 10*HZ) {
|
||||
if (time_after(jiffies, lp->last_timeout + 10*HZ)) {
|
||||
BUGMSG(D_EXTRA, "tx timed out%s (status=%Xh, intmask=%Xh, dest=%02Xh)\n",
|
||||
msg, status, lp->intmask, lp->lasttrans_dest);
|
||||
lp->last_timeout = jiffies;
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include <linux/device.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include <asm/system.h>
|
||||
#include <asm/ecard.h>
|
||||
|
@ -355,7 +356,7 @@ etherh_block_output (struct net_device *dev, int count, const unsigned char *buf
|
|||
dma_start = jiffies;
|
||||
|
||||
while ((readb (addr + EN0_ISR) & ENISR_RDC) == 0)
|
||||
if (jiffies - dma_start > 2*HZ/100) { /* 20ms */
|
||||
if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */
|
||||
printk(KERN_ERR "%s: timeout waiting for TX RDC\n",
|
||||
dev->name);
|
||||
etherh_reset (dev);
|
||||
|
|
|
@ -161,6 +161,7 @@ static char *version =
|
|||
#include <linux/etherdevice.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include <asm/system.h>
|
||||
#include <asm/io.h>
|
||||
|
@ -754,7 +755,7 @@ static void eth16i_set_port(int ioaddr, int porttype)
|
|||
|
||||
static int eth16i_send_probe_packet(int ioaddr, unsigned char *b, int l)
|
||||
{
|
||||
int starttime;
|
||||
unsigned long starttime;
|
||||
|
||||
outb(0xff, ioaddr + TX_STATUS_REG);
|
||||
|
||||
|
@ -765,7 +766,7 @@ static int eth16i_send_probe_packet(int ioaddr, unsigned char *b, int l)
|
|||
outb(TX_START | 1, ioaddr + TRANSMIT_START_REG);
|
||||
|
||||
while( (inb(ioaddr + TX_STATUS_REG) & 0x80) == 0) {
|
||||
if( (jiffies - starttime) > TX_TIMEOUT) {
|
||||
if( time_after(jiffies, starttime + TX_TIMEOUT)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -775,18 +776,18 @@ static int eth16i_send_probe_packet(int ioaddr, unsigned char *b, int l)
|
|||
|
||||
static int eth16i_receive_probe_packet(int ioaddr)
|
||||
{
|
||||
int starttime;
|
||||
unsigned long starttime;
|
||||
|
||||
starttime = jiffies;
|
||||
|
||||
while((inb(ioaddr + TX_STATUS_REG) & 0x20) == 0) {
|
||||
if( (jiffies - starttime) > TX_TIMEOUT) {
|
||||
if( time_after(jiffies, starttime + TX_TIMEOUT)) {
|
||||
|
||||
if(eth16i_debug > 1)
|
||||
printk(KERN_DEBUG "Timeout occurred waiting transmit packet received\n");
|
||||
starttime = jiffies;
|
||||
while((inb(ioaddr + RX_STATUS_REG) & 0x80) == 0) {
|
||||
if( (jiffies - starttime) > TX_TIMEOUT) {
|
||||
if( time_after(jiffies, starttime + TX_TIMEOUT)) {
|
||||
if(eth16i_debug > 1)
|
||||
printk(KERN_DEBUG "Timeout occurred waiting receive packet\n");
|
||||
return -1;
|
||||
|
|
|
@ -905,7 +905,7 @@ static int epp_open(struct net_device *dev)
|
|||
/* autoprobe baud rate */
|
||||
tstart = jiffies;
|
||||
i = 0;
|
||||
while ((signed)(jiffies-tstart-HZ/3) < 0) {
|
||||
while (time_before(jiffies, tstart + HZ/3)) {
|
||||
if (pp->ops->epp_read_addr(pp, &stat, 1, 0) != 1)
|
||||
goto epptimeout;
|
||||
if ((stat & (EPP_NRAEF|EPP_NRHF)) == EPP_NRHF) {
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
#include <linux/delay.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
|
||||
|
@ -1499,7 +1500,7 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev)
|
|||
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))
|
||||
|
@ -1652,7 +1653,7 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||
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);
|
||||
|
|
|
@ -27,6 +27,7 @@ static const char version1[] =
|
|||
#include <linux/delay.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include <asm/system.h>
|
||||
#include <asm/io.h>
|
||||
|
@ -365,7 +366,7 @@ static void ne_reset_8390(struct net_device *dev)
|
|||
|
||||
/* This check _should_not_ be necessary, omit eventually. */
|
||||
while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0)
|
||||
if (jiffies - reset_start_time > 2*HZ/100) {
|
||||
if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
|
||||
printk(KERN_WARNING "%s: ne_reset_8390() did not complete.\n", dev->name);
|
||||
break;
|
||||
}
|
||||
|
@ -580,7 +581,7 @@ retry:
|
|||
#endif
|
||||
|
||||
while ((inb_p(NE_BASE + EN0_ISR) & ENISR_RDC) == 0)
|
||||
if (jiffies - dma_start > 2*HZ/100) { /* 20ms */
|
||||
if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */
|
||||
printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name);
|
||||
ne_reset_8390(dev);
|
||||
NS8390_init(dev,1);
|
||||
|
|
|
@ -50,6 +50,7 @@ static const char version2[] =
|
|||
#include <linux/delay.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include <asm/system.h>
|
||||
#include <asm/io.h>
|
||||
|
@ -341,7 +342,7 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr)
|
|||
outb(inb(ioaddr + NE_RESET), ioaddr + NE_RESET);
|
||||
|
||||
while ((inb_p(ioaddr + EN0_ISR) & ENISR_RESET) == 0)
|
||||
if (jiffies - reset_start_time > 2*HZ/100) {
|
||||
if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
|
||||
if (bad_card) {
|
||||
printk(" (warning: no reset ack)");
|
||||
break;
|
||||
|
@ -580,7 +581,7 @@ static void ne_reset_8390(struct net_device *dev)
|
|||
|
||||
/* This check _should_not_ be necessary, omit eventually. */
|
||||
while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0)
|
||||
if (jiffies - reset_start_time > 2*HZ/100) {
|
||||
if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
|
||||
printk(KERN_WARNING "%s: ne_reset_8390() did not complete.\n", dev->name);
|
||||
break;
|
||||
}
|
||||
|
@ -787,7 +788,7 @@ retry:
|
|||
#endif
|
||||
|
||||
while ((inb_p(nic_base + EN0_ISR) & ENISR_RDC) == 0)
|
||||
if (jiffies - dma_start > 2*HZ/100) { /* 20ms */
|
||||
if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */
|
||||
printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name);
|
||||
ne_reset_8390(dev);
|
||||
NS8390_init(dev,1);
|
||||
|
|
|
@ -75,6 +75,7 @@ static const char *version = "ne2.c:v0.91 Nov 16 1998 Wim Dumon <wimpie@kotnet.o
|
|||
#include <linux/etherdevice.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include <asm/system.h>
|
||||
#include <asm/io.h>
|
||||
|
@ -395,7 +396,7 @@ static int __init ne2_probe1(struct net_device *dev, int slot)
|
|||
outb(inb(base_addr + NE_RESET), base_addr + NE_RESET);
|
||||
|
||||
while ((inb_p(base_addr + EN0_ISR) & ENISR_RESET) == 0)
|
||||
if (jiffies - reset_start_time > 2*HZ/100) {
|
||||
if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
|
||||
printk(" not found (no reset ack).\n");
|
||||
retval = -ENODEV;
|
||||
goto out;
|
||||
|
@ -548,7 +549,7 @@ static void ne_reset_8390(struct net_device *dev)
|
|||
|
||||
/* This check _should_not_ be necessary, omit eventually. */
|
||||
while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0)
|
||||
if (jiffies - reset_start_time > 2*HZ/100) {
|
||||
if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
|
||||
printk("%s: ne_reset_8390() did not complete.\n",
|
||||
dev->name);
|
||||
break;
|
||||
|
@ -749,7 +750,7 @@ retry:
|
|||
#endif
|
||||
|
||||
while ((inb_p(nic_base + EN0_ISR) & ENISR_RDC) == 0)
|
||||
if (jiffies - dma_start > 2*HZ/100) { /* 20ms */
|
||||
if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */
|
||||
printk("%s: timeout waiting for Tx RDC.\n", dev->name);
|
||||
ne_reset_8390(dev);
|
||||
NS8390_init(dev,1);
|
||||
|
|
|
@ -116,6 +116,7 @@
|
|||
#include <linux/timer.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
@ -1607,7 +1608,7 @@ static void ns83820_run_bist(struct net_device *ndev, const char *name, u32 enab
|
|||
{
|
||||
struct ns83820 *dev = PRIV(ndev);
|
||||
int timed_out = 0;
|
||||
long start;
|
||||
unsigned long start;
|
||||
u32 status;
|
||||
int loops = 0;
|
||||
|
||||
|
@ -1625,7 +1626,7 @@ static void ns83820_run_bist(struct net_device *ndev, const char *name, u32 enab
|
|||
break;
|
||||
if (status & fail)
|
||||
break;
|
||||
if ((jiffies - start) >= HZ) {
|
||||
if (time_after_eq(jiffies, start + HZ)) {
|
||||
timed_out = 1;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include <asm/board.h>
|
||||
#include <asm/io.h>
|
||||
|
@ -606,7 +607,7 @@ retry:
|
|||
#endif
|
||||
|
||||
while ((ei_ibp(base + EN0_ISR) & ENISR_RDC) == 0) {
|
||||
if (jiffies - start > OAKNET_WAIT) {
|
||||
if (time_after(jiffies, start + OAKNET_WAIT)) {
|
||||
printk("%s: timeout waiting for Tx RDC.\n", dev->name);
|
||||
oaknet_reset_8390(dev);
|
||||
NS8390_init(dev, TRUE);
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <linux/if_arp.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include <pcmcia/cs_types.h>
|
||||
#include <pcmcia/cs.h>
|
||||
|
@ -796,7 +797,7 @@ static void media_check(unsigned long arg)
|
|||
media = inw(ioaddr+WN4_MEDIA) & 0xc810;
|
||||
|
||||
/* Ignore collisions unless we've had no irq's recently */
|
||||
if (jiffies - lp->last_irq < HZ) {
|
||||
if (time_before(jiffies, lp->last_irq + HZ)) {
|
||||
media &= ~0x0010;
|
||||
} else {
|
||||
/* Try harder to detect carrier errors */
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <linux/ppp_channel.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/string.h>
|
||||
|
||||
|
@ -570,7 +571,7 @@ ppp_async_encode(struct asyncppp *ap)
|
|||
* character if necessary.
|
||||
*/
|
||||
if (islcp || flag_time == 0
|
||||
|| jiffies - ap->last_xmit >= flag_time)
|
||||
|| time_after_eq(jiffies, ap->last_xmit + flag_time))
|
||||
*buf++ = PPP_FLAG;
|
||||
ap->last_xmit = jiffies;
|
||||
fcs = PPP_INITFCS;
|
||||
|
|
|
@ -46,6 +46,7 @@ static const char version[] =
|
|||
#include <linux/etherdevice.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include <asm/system.h>
|
||||
#include <asm/io.h>
|
||||
|
@ -699,7 +700,7 @@ static void hardware_send_packet(struct net_device * dev, char *buf, int length)
|
|||
int ioaddr = dev->base_addr;
|
||||
int status = inw(SEEQ_STATUS);
|
||||
int transmit_ptr = 0;
|
||||
int tmp;
|
||||
unsigned long tmp;
|
||||
|
||||
if (net_debug>4) {
|
||||
printk("%s: send 0x%04x\n",dev->name,length);
|
||||
|
@ -724,7 +725,7 @@ static void hardware_send_packet(struct net_device * dev, char *buf, int length)
|
|||
|
||||
/* drain FIFO */
|
||||
tmp = jiffies;
|
||||
while ( (((status=inw(SEEQ_STATUS)) & SEEQSTAT_FIFO_EMPTY) == 0) && (jiffies - tmp < HZ))
|
||||
while ( (((status=inw(SEEQ_STATUS)) & SEEQSTAT_FIFO_EMPTY) == 0) && time_before(jiffies, tmp + HZ))
|
||||
mb();
|
||||
|
||||
/* doit ! */
|
||||
|
|
|
@ -83,6 +83,7 @@
|
|||
#include <linux/if_arp.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/if_shaper.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include <net/dst.h>
|
||||
#include <net/arp.h>
|
||||
|
@ -168,7 +169,7 @@ static int shaper_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||
/*
|
||||
* Queue over time. Spill packet.
|
||||
*/
|
||||
if(SHAPERCB(skb)->shapeclock-jiffies > SHAPER_LATENCY) {
|
||||
if(time_after(SHAPERCB(skb)->shapeclock,jiffies + SHAPER_LATENCY)) {
|
||||
dev_kfree_skb(skb);
|
||||
shaper->stats.tx_dropped++;
|
||||
} else
|
||||
|
|
|
@ -122,6 +122,7 @@
|
|||
#include <linux/spinlock.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include <net/checksum.h>
|
||||
|
||||
|
@ -512,7 +513,7 @@ static int streamer_reset(struct net_device *dev)
|
|||
|
||||
while (!((readw(streamer_mmio + SISR)) & SISR_SRB_REPLY)) {
|
||||
msleep_interruptible(100);
|
||||
if (jiffies - t > 40 * HZ) {
|
||||
if (time_after(jiffies, t + 40 * HZ)) {
|
||||
printk(KERN_ERR
|
||||
"IBM PCI tokenring card not responding\n");
|
||||
release_region(dev->base_addr, STREAMER_IO_SPACE);
|
||||
|
|
|
@ -100,6 +100,7 @@
|
|||
#include <linux/pci.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include <net/checksum.h>
|
||||
|
||||
|
@ -307,7 +308,7 @@ static int __devinit olympic_init(struct net_device *dev)
|
|||
t=jiffies;
|
||||
while((readl(olympic_mmio+BCTL)) & BCTL_SOFTRESET) {
|
||||
schedule();
|
||||
if(jiffies-t > 40*HZ) {
|
||||
if(time_after(jiffies, t + 40*HZ)) {
|
||||
printk(KERN_ERR "IBM PCI tokenring card not responding.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
@ -359,7 +360,7 @@ static int __devinit olympic_init(struct net_device *dev)
|
|||
t=jiffies;
|
||||
while (!readl(olympic_mmio+CLKCTL) & CLKCTL_PAUSE) {
|
||||
schedule() ;
|
||||
if(jiffies-t > 2*HZ) {
|
||||
if(time_after(jiffies, t + 2*HZ)) {
|
||||
printk(KERN_ERR "IBM Cardbus tokenring adapter not responsing.\n") ;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
@ -373,7 +374,7 @@ static int __devinit olympic_init(struct net_device *dev)
|
|||
t=jiffies;
|
||||
while(!((readl(olympic_mmio+SISR_RR)) & SISR_SRB_REPLY)) {
|
||||
schedule();
|
||||
if(jiffies-t > 15*HZ) {
|
||||
if(time_after(jiffies, t + 15*HZ)) {
|
||||
printk(KERN_ERR "IBM PCI tokenring card not responding.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
@ -519,7 +520,7 @@ static int olympic_open(struct net_device *dev)
|
|||
olympic_priv->srb_queued=0;
|
||||
break;
|
||||
}
|
||||
if ((jiffies-t) > 10*HZ) {
|
||||
if (time_after(jiffies, t + 10*HZ)) {
|
||||
printk(KERN_WARNING "%s: SRB timed out. \n",dev->name) ;
|
||||
olympic_priv->srb_queued=0;
|
||||
break ;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include "tulip.h"
|
||||
|
||||
|
||||
|
@ -68,7 +69,7 @@ void pnic_lnk_change(struct net_device *dev, int csr5)
|
|||
*/
|
||||
if (tulip_media_cap[dev->if_port] & MediaIsMII)
|
||||
return;
|
||||
if (! tp->nwayset || jiffies - dev->trans_start > 1*HZ) {
|
||||
if (! tp->nwayset || time_after(jiffies, dev->trans_start + 1*HZ)) {
|
||||
tp->csr6 = 0x00420000 | (tp->csr6 & 0x0000fdff);
|
||||
iowrite32(tp->csr6, ioaddr + CSR6);
|
||||
iowrite32(0x30, ioaddr + CSR12);
|
||||
|
|
|
@ -112,7 +112,7 @@ static const char StripVersion[] = "1.3A-STUART.CHESHIRE";
|
|||
#include <linux/ip.h>
|
||||
#include <linux/tcp.h>
|
||||
#include <linux/time.h>
|
||||
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
/************************************************************************/
|
||||
/* Useful structures and definitions */
|
||||
|
@ -1569,7 +1569,7 @@ static int strip_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||
del_timer(&strip_info->idle_timer);
|
||||
|
||||
|
||||
if (jiffies - strip_info->pps_timer > HZ) {
|
||||
if (time_after(jiffies, strip_info->pps_timer + HZ)) {
|
||||
unsigned long t = jiffies - strip_info->pps_timer;
|
||||
unsigned long rx_pps_count = (strip_info->rx_pps_count * HZ * 8 + t / 2) / t;
|
||||
unsigned long tx_pps_count = (strip_info->tx_pps_count * HZ * 8 + t / 2) / t;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/zorro.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include <asm/system.h>
|
||||
#include <asm/irq.h>
|
||||
|
@ -151,7 +152,7 @@ static int __devinit zorro8390_init(struct net_device *dev,
|
|||
z_writeb(z_readb(ioaddr + NE_RESET), ioaddr + NE_RESET);
|
||||
|
||||
while ((z_readb(ioaddr + NE_EN0_ISR) & ENISR_RESET) == 0)
|
||||
if (jiffies - reset_start_time > 2*HZ/100) {
|
||||
if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
|
||||
printk(KERN_WARNING " not found (no reset ack).\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
@ -273,7 +274,7 @@ static void zorro8390_reset_8390(struct net_device *dev)
|
|||
|
||||
/* This check _should_not_ be necessary, omit eventually. */
|
||||
while ((z_readb(NE_BASE+NE_EN0_ISR) & ENISR_RESET) == 0)
|
||||
if (jiffies - reset_start_time > 2*HZ/100) {
|
||||
if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
|
||||
printk(KERN_WARNING "%s: ne_reset_8390() did not complete.\n",
|
||||
dev->name);
|
||||
break;
|
||||
|
@ -400,7 +401,7 @@ static void zorro8390_block_output(struct net_device *dev, int count,
|
|||
dma_start = jiffies;
|
||||
|
||||
while ((z_readb(NE_BASE + NE_EN0_ISR) & ENISR_RDC) == 0)
|
||||
if (jiffies - dma_start > 2*HZ/100) { /* 20ms */
|
||||
if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */
|
||||
printk(KERN_ERR "%s: timeout waiting for Tx RDC.\n",
|
||||
dev->name);
|
||||
zorro8390_reset_8390(dev);
|
||||
|
|
Loading…
Reference in a new issue