Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff5688ae authored by Marcelo Feitoza Parisi's avatar Marcelo Feitoza Parisi Committed by Jeff Garzik
Browse files

[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: default avatarMarcelo Feitoza Parisi <marcelo@feitoza.com.br>
Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarJeff Garzik <jgarzik@pobox.com>
parent e03d72b9
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -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)) {
+2 −1
Original line number Diff line number Diff line
@@ -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;
				}
+4 −3
Original line number Diff line number Diff line
@@ -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);
+2 −1
Original line number Diff line number Diff line
@@ -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;
+2 −1
Original line number Diff line number Diff line
@@ -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);
Loading