aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/r6040.c
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2009-01-10 02:19:26 -0500
committerDavid S. Miller <davem@davemloft.net>2009-01-11 03:03:38 -0500
commit58854c6b411e9e9f46b39bd7092022f639c41904 (patch)
tree016f5684864371473b7834c723fa4e0dfcd929c9 /drivers/net/r6040.c
parent216c32d4407ea6951d6832773fdb3de058e12c62 (diff)
r6040: fix ifconfig down and freeing of tx/rx descriptors
This patch fixes warnings and such traces that appear when doing an ifconfig down on the interface: WARNING: at arch/x86/kernel/pci-dma.c:376 dma_free_coherent+0x40/0x7d() Modules linked in: Signed-off-by: Joe Chou <joe.chou@rdc.com.tw> Signed-off-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/r6040.c')
-rw-r--r--drivers/net/r6040.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index cf3a082bc89d..b59837e80750 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -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