3c501: Bring into compliance with the coding style
3c501 leads the way... 8) Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
committed by
David S. Miller
parent
68d579fb93
commit
a35f5de776
@@ -229,8 +229,7 @@ static int __init el1_probe1(struct net_device *dev, int ioaddr)
|
|||||||
* Read the station address PROM data from the special port.
|
* Read the station address PROM data from the special port.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < 6; i++) {
|
||||||
{
|
|
||||||
outw(i, ioaddr + EL1_DATAPTR);
|
outw(i, ioaddr + EL1_DATAPTR);
|
||||||
station_addr[i] = inb(ioaddr + EL1_SAPROM);
|
station_addr[i] = inb(ioaddr + EL1_SAPROM);
|
||||||
}
|
}
|
||||||
@@ -241,27 +240,23 @@ static int __init el1_probe1(struct net_device *dev, int ioaddr)
|
|||||||
|
|
||||||
if (station_addr[0] == 0x02 && station_addr[1] == 0x60
|
if (station_addr[0] == 0x02 && station_addr[1] == 0x60
|
||||||
&& station_addr[2] == 0x8c)
|
&& station_addr[2] == 0x8c)
|
||||||
{
|
|
||||||
mname = "3c501";
|
mname = "3c501";
|
||||||
} else if (station_addr[0] == 0x00 && station_addr[1] == 0x80
|
else if (station_addr[0] == 0x00 && station_addr[1] == 0x80
|
||||||
&& station_addr[2] == 0xC8)
|
&& station_addr[2] == 0xC8)
|
||||||
{
|
|
||||||
mname = "NP943";
|
mname = "NP943";
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
release_region(ioaddr, EL1_IO_EXTENT);
|
release_region(ioaddr, EL1_IO_EXTENT);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We auto-IRQ by shutting off the interrupt line and letting it float
|
* We auto-IRQ by shutting off the interrupt line and letting it
|
||||||
* high.
|
* float high.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
dev->irq = irq;
|
dev->irq = irq;
|
||||||
|
|
||||||
if (dev->irq < 2)
|
if (dev->irq < 2) {
|
||||||
{
|
|
||||||
unsigned long irq_mask;
|
unsigned long irq_mask;
|
||||||
|
|
||||||
irq_mask = probe_irq_on();
|
irq_mask = probe_irq_on();
|
||||||
@@ -274,8 +269,7 @@ static int __init el1_probe1(struct net_device *dev, int ioaddr)
|
|||||||
mdelay(20);
|
mdelay(20);
|
||||||
autoirq = probe_irq_off(irq_mask);
|
autoirq = probe_irq_off(irq_mask);
|
||||||
|
|
||||||
if (autoirq == 0)
|
if (autoirq == 0) {
|
||||||
{
|
|
||||||
printk(KERN_WARNING "%s probe at %#x failed to detect IRQ line.\n",
|
printk(KERN_WARNING "%s probe at %#x failed to detect IRQ line.\n",
|
||||||
mname, ioaddr);
|
mname, ioaddr);
|
||||||
release_region(ioaddr, EL1_IO_EXTENT);
|
release_region(ioaddr, EL1_IO_EXTENT);
|
||||||
@@ -292,7 +286,8 @@ static int __init el1_probe1(struct net_device *dev, int ioaddr)
|
|||||||
if (autoirq)
|
if (autoirq)
|
||||||
dev->irq = autoirq;
|
dev->irq = autoirq;
|
||||||
|
|
||||||
printk(KERN_INFO "%s: %s EtherLink at %#lx, using %sIRQ %d.\n", dev->name, mname, dev->base_addr,
|
printk(KERN_INFO "%s: %s EtherLink at %#lx, using %sIRQ %d.\n",
|
||||||
|
dev->name, mname, dev->base_addr,
|
||||||
autoirq ? "auto":"assigned ", dev->irq);
|
autoirq ? "auto":"assigned ", dev->irq);
|
||||||
|
|
||||||
#ifdef CONFIG_IP_MULTICAST
|
#ifdef CONFIG_IP_MULTICAST
|
||||||
@@ -343,7 +338,8 @@ static int el_open(struct net_device *dev)
|
|||||||
if (el_debug > 2)
|
if (el_debug > 2)
|
||||||
printk(KERN_DEBUG "%s: Doing el_open()...", dev->name);
|
printk(KERN_DEBUG "%s: Doing el_open()...", dev->name);
|
||||||
|
|
||||||
if ((retval = request_irq(dev->irq, &el_interrupt, 0, dev->name, dev)))
|
retval = request_irq(dev->irq, &el_interrupt, 0, dev->name, dev);
|
||||||
|
if (retval)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
spin_lock_irqsave(&lp->lock, flags);
|
spin_lock_irqsave(&lp->lock, flags);
|
||||||
@@ -372,7 +368,8 @@ static void el_timeout(struct net_device *dev)
|
|||||||
|
|
||||||
if (el_debug)
|
if (el_debug)
|
||||||
printk(KERN_DEBUG "%s: transmit timed out, txsr %#2x axsr=%02x rxsr=%02x.\n",
|
printk(KERN_DEBUG "%s: transmit timed out, txsr %#2x axsr=%02x rxsr=%02x.\n",
|
||||||
dev->name, inb(TX_STATUS), inb(AX_STATUS), inb(RX_STATUS));
|
dev->name, inb(TX_STATUS),
|
||||||
|
inb(AX_STATUS), inb(RX_STATUS));
|
||||||
dev->stats.tx_errors++;
|
dev->stats.tx_errors++;
|
||||||
outb(TX_NORM, TX_CMD);
|
outb(TX_NORM, TX_CMD);
|
||||||
outb(RX_NORM, RX_CMD);
|
outb(RX_NORM, RX_CMD);
|
||||||
@@ -425,8 +422,7 @@ static int el_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||||||
|
|
||||||
netif_stop_queue(dev);
|
netif_stop_queue(dev);
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
int len = skb->len;
|
int len = skb->len;
|
||||||
int pad = 0;
|
int pad = 0;
|
||||||
int gp_start;
|
int gp_start;
|
||||||
@@ -455,24 +451,28 @@ static int el_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||||||
lp->txing = 1;
|
lp->txing = 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Turn interrupts back on while we spend a pleasant afternoon
|
* Turn interrupts back on while we spend a pleasant
|
||||||
* loading bytes into the board
|
* afternoon loading bytes into the board
|
||||||
*/
|
*/
|
||||||
|
|
||||||
spin_unlock_irqrestore(&lp->lock, flags);
|
spin_unlock_irqrestore(&lp->lock, flags);
|
||||||
|
|
||||||
outw(0x00, RX_BUF_CLR); /* Set rx packet area to 0. */
|
/* Set rx packet area to 0. */
|
||||||
outw(gp_start, GP_LOW); /* aim - packet will be loaded into buffer start */
|
outw(0x00, RX_BUF_CLR);
|
||||||
outsb(DATAPORT,buf,len); /* load buffer (usual thing each byte increments the pointer) */
|
/* aim - packet will be loaded into buffer start */
|
||||||
|
outw(gp_start, GP_LOW);
|
||||||
|
/* load buffer (usual thing each byte increments the pointer) */
|
||||||
|
outsb(DATAPORT, buf, len);
|
||||||
if (pad) {
|
if (pad) {
|
||||||
while (pad--) /* Zero fill buffer tail */
|
while (pad--) /* Zero fill buffer tail */
|
||||||
outb(0, DATAPORT);
|
outb(0, DATAPORT);
|
||||||
}
|
}
|
||||||
outw(gp_start, GP_LOW); /* the board reuses the same register */
|
/* the board reuses the same register */
|
||||||
|
outw(gp_start, GP_LOW);
|
||||||
|
|
||||||
if(lp->loading != 2)
|
if (lp->loading != 2) {
|
||||||
{
|
/* fire ... Trigger xmit. */
|
||||||
outb(AX_XMIT, AX_CMD); /* fire ... Trigger xmit. */
|
outb(AX_XMIT, AX_CMD);
|
||||||
lp->loading = 0;
|
lp->loading = 0;
|
||||||
dev->trans_start = jiffies;
|
dev->trans_start = jiffies;
|
||||||
if (el_debug > 2)
|
if (el_debug > 2)
|
||||||
@@ -482,7 +482,8 @@ static int el_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||||||
}
|
}
|
||||||
/* A receive upset our load, despite our best efforts */
|
/* A receive upset our load, despite our best efforts */
|
||||||
if (el_debug > 2)
|
if (el_debug > 2)
|
||||||
printk(KERN_DEBUG "%s: burped during tx load.\n", dev->name);
|
printk(KERN_DEBUG "%s: burped during tx load.\n",
|
||||||
|
dev->name);
|
||||||
spin_lock_irqsave(&lp->lock, flags);
|
spin_lock_irqsave(&lp->lock, flags);
|
||||||
}
|
}
|
||||||
while (1);
|
while (1);
|
||||||
@@ -534,52 +535,49 @@ static irqreturn_t el_interrupt(int irq, void *dev_id)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (el_debug > 3)
|
if (el_debug > 3)
|
||||||
printk(KERN_DEBUG "%s: el_interrupt() aux=%#02x", dev->name, axsr);
|
printk(KERN_DEBUG "%s: el_interrupt() aux=%#02x",
|
||||||
|
dev->name, axsr);
|
||||||
|
|
||||||
if (lp->loading == 1 && !lp->txing)
|
if (lp->loading == 1 && !lp->txing)
|
||||||
printk(KERN_WARNING "%s: Inconsistent state loading while not in tx\n",
|
printk(KERN_WARNING "%s: Inconsistent state loading while not in tx\n",
|
||||||
dev->name);
|
dev->name);
|
||||||
|
|
||||||
if (lp->txing)
|
if (lp->txing) {
|
||||||
{
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Board in transmit mode. May be loading. If we are
|
* Board in transmit mode. May be loading. If we are
|
||||||
* loading we shouldn't have got this.
|
* loading we shouldn't have got this.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int txsr = inb(TX_STATUS);
|
int txsr = inb(TX_STATUS);
|
||||||
|
|
||||||
if(lp->loading==1)
|
if (lp->loading == 1) {
|
||||||
{
|
if (el_debug > 2) {
|
||||||
if(el_debug > 2)
|
printk(KERN_DEBUG "%s: Interrupt while loading [",
|
||||||
{
|
dev->name);
|
||||||
printk(KERN_DEBUG "%s: Interrupt while loading [", dev->name);
|
printk(" txsr=%02x gp=%04x rp=%04x]\n",
|
||||||
printk(KERN_DEBUG " txsr=%02x gp=%04x rp=%04x]\n", txsr, inw(GP_LOW),inw(RX_LOW));
|
txsr, inw(GP_LOW), inw(RX_LOW));
|
||||||
}
|
}
|
||||||
lp->loading=2; /* Force a reload */
|
/* Force a reload */
|
||||||
|
lp->loading = 2;
|
||||||
spin_unlock(&lp->lock);
|
spin_unlock(&lp->lock);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (el_debug > 6)
|
if (el_debug > 6)
|
||||||
printk(KERN_DEBUG " txsr=%02x gp=%04x rp=%04x", txsr, inw(GP_LOW),inw(RX_LOW));
|
printk(KERN_DEBUG " txsr=%02x gp=%04x rp=%04x",
|
||||||
|
txsr, inw(GP_LOW), inw(RX_LOW));
|
||||||
|
|
||||||
if ((axsr & 0x80) && (txsr & TX_READY) == 0)
|
if ((axsr & 0x80) && (txsr & TX_READY) == 0) {
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
* FIXME: is there a logic to whether to keep on trying or
|
* FIXME: is there a logic to whether to keep
|
||||||
* reset immediately ?
|
* on trying or reset immediately ?
|
||||||
*/
|
*/
|
||||||
if (el_debug > 1)
|
if (el_debug > 1)
|
||||||
printk(KERN_DEBUG "%s: Unusual interrupt during Tx, txsr=%02x axsr=%02x"
|
printk(KERN_DEBUG "%s: Unusual interrupt during Tx, txsr=%02x axsr=%02x gp=%03x rp=%03x.\n",
|
||||||
" gp=%03x rp=%03x.\n", dev->name, txsr, axsr,
|
dev->name, txsr, axsr,
|
||||||
inw(ioaddr + EL1_DATAPTR), inw(ioaddr + EL1_RXPTR));
|
inw(ioaddr + EL1_DATAPTR),
|
||||||
|
inw(ioaddr + EL1_RXPTR));
|
||||||
lp->txing = 0;
|
lp->txing = 0;
|
||||||
netif_wake_queue(dev);
|
netif_wake_queue(dev);
|
||||||
}
|
} else if (txsr & TX_16COLLISIONS) {
|
||||||
else if (txsr & TX_16COLLISIONS)
|
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
* Timed out
|
* Timed out
|
||||||
*/
|
*/
|
||||||
@@ -589,9 +587,7 @@ static irqreturn_t el_interrupt(int irq, void *dev_id)
|
|||||||
lp->txing = 0;
|
lp->txing = 0;
|
||||||
dev->stats.tx_aborted_errors++;
|
dev->stats.tx_aborted_errors++;
|
||||||
netif_wake_queue(dev);
|
netif_wake_queue(dev);
|
||||||
}
|
} else if (txsr & TX_COLLISION) {
|
||||||
else if (txsr & TX_COLLISION)
|
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
* Retrigger xmit.
|
* Retrigger xmit.
|
||||||
*/
|
*/
|
||||||
@@ -599,7 +595,8 @@ static irqreturn_t el_interrupt(int irq, void *dev_id)
|
|||||||
if (el_debug > 6)
|
if (el_debug > 6)
|
||||||
printk(KERN_DEBUG " retransmitting after a collision.\n");
|
printk(KERN_DEBUG " retransmitting after a collision.\n");
|
||||||
/*
|
/*
|
||||||
* Poor little chip can't reset its own start pointer
|
* Poor little chip can't reset its own start
|
||||||
|
* pointer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
outb(AX_SYS, AX_CMD);
|
outb(AX_SYS, AX_CMD);
|
||||||
@@ -608,9 +605,7 @@ static irqreturn_t el_interrupt(int irq, void *dev_id)
|
|||||||
dev->stats.collisions++;
|
dev->stats.collisions++;
|
||||||
spin_unlock(&lp->lock);
|
spin_unlock(&lp->lock);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
* It worked.. we will now fall through and receive
|
* It worked.. we will now fall through and receive
|
||||||
*/
|
*/
|
||||||
@@ -621,13 +616,11 @@ static irqreturn_t el_interrupt(int irq, void *dev_id)
|
|||||||
/*
|
/*
|
||||||
* This is safe the interrupt is atomic WRT itself.
|
* This is safe the interrupt is atomic WRT itself.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
lp->txing = 0;
|
lp->txing = 0;
|
||||||
netif_wake_queue(dev); /* In case more to transmit */
|
/* In case more to transmit */
|
||||||
|
netif_wake_queue(dev);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
* In receive mode.
|
* In receive mode.
|
||||||
*/
|
*/
|
||||||
@@ -640,21 +633,17 @@ static irqreturn_t el_interrupt(int irq, void *dev_id)
|
|||||||
*/
|
*/
|
||||||
if (rxsr & RX_MISSED)
|
if (rxsr & RX_MISSED)
|
||||||
dev->stats.rx_missed_errors++;
|
dev->stats.rx_missed_errors++;
|
||||||
else if (rxsr & RX_RUNT)
|
else if (rxsr & RX_RUNT) {
|
||||||
{ /* Handled to avoid board lock-up. */
|
/* Handled to avoid board lock-up. */
|
||||||
dev->stats.rx_length_errors++;
|
dev->stats.rx_length_errors++;
|
||||||
if (el_debug > 5)
|
if (el_debug > 5)
|
||||||
printk(KERN_DEBUG " runt.\n");
|
printk(KERN_DEBUG " runt.\n");
|
||||||
}
|
} else if (rxsr & RX_GOOD) {
|
||||||
else if (rxsr & RX_GOOD)
|
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
* Receive worked.
|
* Receive worked.
|
||||||
*/
|
*/
|
||||||
el_receive(dev);
|
el_receive(dev);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
* Nothing? Something is broken!
|
* Nothing? Something is broken!
|
||||||
*/
|
*/
|
||||||
@@ -702,8 +691,7 @@ static void el_receive(struct net_device *dev)
|
|||||||
if (el_debug > 4)
|
if (el_debug > 4)
|
||||||
printk(KERN_DEBUG " el_receive %d.\n", pkt_len);
|
printk(KERN_DEBUG " el_receive %d.\n", pkt_len);
|
||||||
|
|
||||||
if ((pkt_len < 60) || (pkt_len > 1536))
|
if (pkt_len < 60 || pkt_len > 1536) {
|
||||||
{
|
|
||||||
if (el_debug)
|
if (el_debug)
|
||||||
printk(KERN_DEBUG "%s: bogus packet, length=%d\n", dev->name, pkt_len);
|
printk(KERN_DEBUG "%s: bogus packet, length=%d\n", dev->name, pkt_len);
|
||||||
dev->stats.rx_over_errors++;
|
dev->stats.rx_over_errors++;
|
||||||
@@ -722,14 +710,11 @@ static void el_receive(struct net_device *dev)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
outw(0x00, GP_LOW);
|
outw(0x00, GP_LOW);
|
||||||
if (skb == NULL)
|
if (skb == NULL) {
|
||||||
{
|
|
||||||
printk(KERN_INFO "%s: Memory squeeze, dropping packet.\n", dev->name);
|
printk(KERN_INFO "%s: Memory squeeze, dropping packet.\n", dev->name);
|
||||||
dev->stats.rx_dropped++;
|
dev->stats.rx_dropped++;
|
||||||
return;
|
return;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
skb_reserve(skb, 2); /* Force 16 byte alignment */
|
skb_reserve(skb, 2); /* Force 16 byte alignment */
|
||||||
/*
|
/*
|
||||||
* The read increments through the bytes. The interrupt
|
* The read increments through the bytes. The interrupt
|
||||||
@@ -794,7 +779,8 @@ static int el1_close(struct net_device *dev)
|
|||||||
int ioaddr = dev->base_addr;
|
int ioaddr = dev->base_addr;
|
||||||
|
|
||||||
if (el_debug > 2)
|
if (el_debug > 2)
|
||||||
printk(KERN_INFO "%s: Shutting down Ethernet card at %#x.\n", dev->name, ioaddr);
|
printk(KERN_INFO "%s: Shutting down Ethernet card at %#x.\n",
|
||||||
|
dev->name, ioaddr);
|
||||||
|
|
||||||
netif_stop_queue(dev);
|
netif_stop_queue(dev);
|
||||||
|
|
||||||
@@ -822,18 +808,14 @@ static void set_multicast_list(struct net_device *dev)
|
|||||||
{
|
{
|
||||||
int ioaddr = dev->base_addr;
|
int ioaddr = dev->base_addr;
|
||||||
|
|
||||||
if(dev->flags&IFF_PROMISC)
|
if (dev->flags & IFF_PROMISC) {
|
||||||
{
|
|
||||||
outb(RX_PROM, RX_CMD);
|
outb(RX_PROM, RX_CMD);
|
||||||
inb(RX_STATUS);
|
inb(RX_STATUS);
|
||||||
}
|
} else if (dev->mc_list || dev->flags & IFF_ALLMULTI) {
|
||||||
else if (dev->mc_list || dev->flags&IFF_ALLMULTI)
|
/* Multicast or all multicast is the same */
|
||||||
{
|
outb(RX_MULT, RX_CMD);
|
||||||
outb(RX_MULT, RX_CMD); /* Multicast or all multicast is the same */
|
|
||||||
inb(RX_STATUS); /* Clear status. */
|
inb(RX_STATUS); /* Clear status. */
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
outb(RX_NORM, RX_CMD);
|
outb(RX_NORM, RX_CMD);
|
||||||
inb(RX_STATUS);
|
inb(RX_STATUS);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user