aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/r6040.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-01-18 12:15:49 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-18 12:15:49 -0500
commitaf37501c792107c2bde1524bdae38d9a247b841a (patch)
treeb50ee90d29e72956b8b7d8d19677fe5996755d49 /drivers/net/r6040.c
parentd859e29fe34cb833071b20aef860ee94fbad9bb2 (diff)
parent99937d6455cea95405ac681c86a857d0fcd530bd (diff)
Merge branch 'core/percpu' into perfcounters/core
Conflicts: arch/x86/include/asm/pda.h We merge tip/core/percpu into tip/perfcounters/core because of a semantic and contextual conflict: the former eliminates the PDA, while the latter extends it with apic_perf_irqs field. Resolve the conflict by moving the new field to the irq_cpustat structure on 64-bit too. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers/net/r6040.c')
-rw-r--r--drivers/net/r6040.c43
1 files changed, 28 insertions, 15 deletions
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index cf3a082bc89d..72fd9e97c190 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -49,8 +49,8 @@
49#include <asm/processor.h> 49#include <asm/processor.h>
50 50
51#define DRV_NAME "r6040" 51#define DRV_NAME "r6040"
52#define DRV_VERSION "0.20" 52#define DRV_VERSION "0.21"
53#define DRV_RELDATE "07Jan2009" 53#define DRV_RELDATE "09Jan2009"
54 54
55/* PHY CHIP Address */ 55/* PHY CHIP Address */
56#define PHY1_ADDR 1 /* For MAC1 */ 56#define PHY1_ADDR 1 /* For MAC1 */
@@ -457,22 +457,12 @@ static void r6040_down(struct net_device *dev)
457 iowrite16(adrp[0], ioaddr + MID_0L); 457 iowrite16(adrp[0], ioaddr + MID_0L);
458 iowrite16(adrp[1], ioaddr + MID_0M); 458 iowrite16(adrp[1], ioaddr + MID_0M);
459 iowrite16(adrp[2], ioaddr + MID_0H); 459 iowrite16(adrp[2], ioaddr + MID_0H);
460 free_irq(dev->irq, dev);
461
462 /* Free RX buffer */
463 r6040_free_rxbufs(dev);
464
465 /* Free TX buffer */
466 r6040_free_txbufs(dev);
467
468 /* Free Descriptor memory */
469 pci_free_consistent(pdev, RX_DESC_SIZE, lp->rx_ring, lp->rx_ring_dma);
470 pci_free_consistent(pdev, TX_DESC_SIZE, lp->tx_ring, lp->tx_ring_dma);
471} 460}
472 461
473static int r6040_close(struct net_device *dev) 462static int r6040_close(struct net_device *dev)
474{ 463{
475 struct r6040_private *lp = netdev_priv(dev); 464 struct r6040_private *lp = netdev_priv(dev);
465 struct pci_dev *pdev = lp->pdev;
476 466
477 /* deleted timer */ 467 /* deleted timer */
478 del_timer_sync(&lp->timer); 468 del_timer_sync(&lp->timer);
@@ -481,8 +471,28 @@ static int r6040_close(struct net_device *dev)
481 napi_disable(&lp->napi); 471 napi_disable(&lp->napi);
482 netif_stop_queue(dev); 472 netif_stop_queue(dev);
483 r6040_down(dev); 473 r6040_down(dev);
474
475 free_irq(dev->irq, dev);
476
477 /* Free RX buffer */
478 r6040_free_rxbufs(dev);
479
480 /* Free TX buffer */
481 r6040_free_txbufs(dev);
482
484 spin_unlock_irq(&lp->lock); 483 spin_unlock_irq(&lp->lock);
485 484
485 /* Free Descriptor memory */
486 if (lp->rx_ring) {
487 pci_free_consistent(pdev, RX_DESC_SIZE, lp->rx_ring, lp->rx_ring_dma);
488 lp->rx_ring = 0;
489 }
490
491 if (lp->tx_ring) {
492 pci_free_consistent(pdev, TX_DESC_SIZE, lp->tx_ring, lp->tx_ring_dma);
493 lp->tx_ring = 0;
494 }
495
486 return 0; 496 return 0;
487} 497}
488 498
@@ -1049,6 +1059,7 @@ static const struct net_device_ops r6040_netdev_ops = {
1049 .ndo_set_multicast_list = r6040_multicast_list, 1059 .ndo_set_multicast_list = r6040_multicast_list,
1050 .ndo_change_mtu = eth_change_mtu, 1060 .ndo_change_mtu = eth_change_mtu,
1051 .ndo_validate_addr = eth_validate_addr, 1061 .ndo_validate_addr = eth_validate_addr,
1062 .ndo_set_mac_address = eth_mac_addr,
1052 .ndo_do_ioctl = r6040_ioctl, 1063 .ndo_do_ioctl = r6040_ioctl,
1053 .ndo_tx_timeout = r6040_tx_timeout, 1064 .ndo_tx_timeout = r6040_tx_timeout,
1054#ifdef CONFIG_NET_POLL_CONTROLLER 1065#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -1143,8 +1154,10 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
1143 1154
1144 /* Some bootloader/BIOSes do not initialize 1155 /* Some bootloader/BIOSes do not initialize
1145 * MAC address, warn about that */ 1156 * MAC address, warn about that */
1146 if (!(adrp[0] || adrp[1] || adrp[2])) 1157 if (!(adrp[0] || adrp[1] || adrp[2])) {
1147 printk(KERN_WARNING DRV_NAME ": MAC address not initialized\n"); 1158 printk(KERN_WARNING DRV_NAME ": MAC address not initialized, generating random\n");
1159 random_ether_addr(dev->dev_addr);
1160 }
1148 1161
1149 /* Link new device into r6040_root_dev */ 1162 /* Link new device into r6040_root_dev */
1150 lp->pdev = pdev; 1163 lp->pdev = pdev;