Commit 8736a430 authored by Chris Wright's avatar Chris Wright Committed by Stephen Hemminger

[netdrvr] use cpu_relax() in busy loop, or mdelay instead of busy loop

Replace busy loop nop with cpu_relax(), and just use mdelay where it's better.
parent 2fbaf0b6
......@@ -123,6 +123,7 @@ static const char version[] =
#include <linux/config.h> /* for CONFIG_IP_MULTICAST */
#include <linux/spinlock.h>
#include <linux/ethtool.h>
#include <linux/delay.h>
#include <asm/uaccess.h>
#include <asm/bitops.h>
......@@ -241,7 +242,7 @@ static int __init el1_probe1(struct net_device *dev, int ioaddr)
if (dev->irq < 2)
{
unsigned long irq_mask, delay;
unsigned long irq_mask;
irq_mask = probe_irq_on();
inb(RX_STATUS); /* Clear pending interrupts. */
......@@ -250,8 +251,7 @@ static int __init el1_probe1(struct net_device *dev, int ioaddr)
outb(0x00, AX_CMD);
delay = jiffies + HZ/50;
while (time_before(jiffies, delay)) ;
mdelay(20);
autoirq = probe_irq_off(irq_mask);
if (autoirq == 0)
......
......@@ -298,17 +298,13 @@ inline static void adapter_reset(struct net_device *dev)
set_hsf(dev, HSF_PCB_NAK);
}
outb_control(adapter->hcr_val | ATTN | DIR, dev);
timeout = jiffies + 1*HZ/100;
while (time_before_eq(jiffies, timeout));
mdelay(10);
outb_control(adapter->hcr_val & ~ATTN, dev);
timeout = jiffies + 1*HZ/100;
while (time_before_eq(jiffies, timeout));
mdelay(10);
outb_control(adapter->hcr_val | FLSH, dev);
timeout = jiffies + 1*HZ/100;
while (time_before_eq(jiffies, timeout));
mdelay(10);
outb_control(adapter->hcr_val & ~FLSH, dev);
timeout = jiffies + 1*HZ/100;
while (time_before_eq(jiffies, timeout));
mdelay(10);
outb_control(orig_hcr, dev);
if (!start_receive(dev, &adapter->tx_pcb))
......
......@@ -1757,7 +1757,8 @@ static int __init ace_init(struct net_device *dev)
* Wait for the firmware to spin up - max 3 seconds.
*/
myjif = jiffies + 3 * HZ;
while (time_before(jiffies, myjif) && !ap->fw_running);
while (time_before(jiffies, myjif) && !ap->fw_running)
cpu_relax();
if (!ap->fw_running) {
printk(KERN_ERR "%s: Firmware NOT running!\n", dev->name);
......
......@@ -897,14 +897,12 @@ static int eepro_grab_irq(struct net_device *dev)
eepro_sw2bank0(ioaddr); /* Switch back to Bank 0 */
if (request_irq (*irqp, NULL, SA_SHIRQ, "bogus", dev) != EBUSY) {
unsigned long irq_mask, delay;
unsigned long irq_mask;
/* Twinkle the interrupt, and check if it's seen */
irq_mask = probe_irq_on();
eepro_diag(ioaddr); /* RESET the 82595 */
delay = jiffies + HZ/50;
while (time_before(jiffies, delay)) ;
mdelay(20);
if (*irqp == probe_irq_off(irq_mask)) /* It's a good IRQ line */
break;
......
......@@ -564,7 +564,7 @@ ewrk3_hw_init(struct net_device *dev, u_long iobase)
if (dev->irq < 2) {
#ifndef MODULE
u_char irqnum;
unsigned long irq_mask, delay;
unsigned long irq_mask;
irq_mask = probe_irq_on();
......@@ -578,8 +578,7 @@ ewrk3_hw_init(struct net_device *dev, u_long iobase)
irqnum = irq[((icr & IRQ_SEL) >> 4)];
delay = jiffies + HZ/50;
while (time_before(jiffies, delay)) ;
mdelay(20);
dev->irq = probe_irq_off(irq_mask);
if ((dev->irq) && (irqnum == dev->irq)) {
printk(" and uses IRQ%d.\n", dev->irq);
......
......@@ -543,7 +543,7 @@ static int __init lance_probe1(struct net_device *dev, int ioaddr, int irq, int
if (dev->irq >= 2)
printk(" assigned IRQ %d", dev->irq);
else if (lance_version != 0) { /* 7990 boards need DMA detection first. */
unsigned long irq_mask, delay;
unsigned long irq_mask;
/* To auto-IRQ we enable the initialization-done and DMA error
interrupts. For ISA boards we get a DMA error, but VLB and PCI
......@@ -553,8 +553,7 @@ static int __init lance_probe1(struct net_device *dev, int ioaddr, int irq, int
/* Trigger an initialization just for the interrupt. */
outw(0x0041, ioaddr+LANCE_DATA);
delay = jiffies + HZ/50;
while (time_before(jiffies, delay)) ;
mdelay(20);
dev->irq = probe_irq_off(irq_mask);
if (dev->irq)
printk(", probed IRQ %d", dev->irq);
......@@ -621,13 +620,12 @@ static int __init lance_probe1(struct net_device *dev, int ioaddr, int irq, int
if (lance_version == 0 && dev->irq == 0) {
/* We may auto-IRQ now that we have a DMA channel. */
/* Trigger an initialization just for the interrupt. */
unsigned long irq_mask, delay;
unsigned long irq_mask;
irq_mask = probe_irq_on();
outw(0x0041, ioaddr+LANCE_DATA);
delay = jiffies + HZ/25;
while (time_before(jiffies, delay)) ;
mdelay(40);
dev->irq = probe_irq_off(irq_mask);
if (dev->irq == 0) {
printk(" Failed to detect the 7990 IRQ line.\n");
......
......@@ -255,14 +255,13 @@ static int __init ni5010_probe1(struct net_device *dev, int ioaddr)
if (dev->irq == 0xff)
;
else if (dev->irq < 2) {
unsigned long irq_mask, delay;
unsigned long irq_mask;
PRINTK2((KERN_DEBUG "%s: I/O #5 passed!\n", dev->name));
irq_mask = probe_irq_on();
trigger_irq(ioaddr);
delay = jiffies + HZ/50;
while (time_before(jiffies, delay)) ;
mdelay(20);
dev->irq = probe_irq_off(irq_mask);
PRINTK2((KERN_DEBUG "%s: I/O #6 passed!\n", dev->name));
......
......@@ -492,14 +492,13 @@ static int __init ni52_probe1(struct net_device *dev,int ioaddr)
if(dev->irq < 2)
{
unsigned long irq_mask, delay;
unsigned long irq_mask;
irq_mask = probe_irq_on();
ni_reset586();
ni_attn586();
delay = jiffies + HZ/50;
while (time_before(jiffies, delay)) ;
mdelay(20);
dev->irq = probe_irq_off(irq_mask);
if(!dev->irq)
{
......
......@@ -720,7 +720,8 @@ static int rr_init1(struct net_device *dev)
* Give the FirmWare time to chew on the `get running' command.
*/
myjif = jiffies + 5 * HZ;
while (time_before(jiffies, myjif) && !rrpriv->fw_running);
while (time_before(jiffies, myjif) && !rrpriv->fw_running)
cpu_relax();
netif_start_queue(dev);
......
......@@ -53,6 +53,7 @@
#include <linux/skbuff.h>
#include <linux/timer.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <net/arp.h>
......@@ -337,13 +338,12 @@ sbni_probe1( struct net_device *dev, unsigned long ioaddr, int irq )
outb( 0, ioaddr + CSR0 );
if( irq < 2 ) {
unsigned long irq_mask, delay;
unsigned long irq_mask;
irq_mask = probe_irq_on();
outb( EN_INT | TR_REQ, ioaddr + CSR0 );
outb( PR_RES, ioaddr + CSR1 );
delay = jiffies + HZ/20;
while (time_before(jiffies, delay)) ;
mdelay(50);
irq = probe_irq_off(irq_mask);
outb( 0, ioaddr + CSR0 );
......
......@@ -235,7 +235,7 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
int reg4 = inb(ioaddr+4);
if (ancient || reg1 == 0xff) { /* Ack!! No way to read the IRQ! */
short nic_addr = ioaddr+WD_NIC_OFFSET;
unsigned long irq_mask, delay;
unsigned long irq_mask;
/* We have an old-style ethercard that doesn't report its IRQ
line. Do autoirq to find the IRQ line. Note that this IS NOT
......@@ -248,8 +248,7 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
outb_p(0x00, nic_addr + EN0_RCNTLO);
outb_p(0x00, nic_addr + EN0_RCNTHI);
outb(E8390_RREAD+E8390_START, nic_addr); /* Trigger it... */
delay = jiffies + HZ/50;
while (time_before(jiffies, delay)) ;
mdelay(20);
dev->irq = probe_irq_off(irq_mask);
outb_p(0x00, nic_addr+EN0_IMR); /* Mask all intrs. again. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment