r6040: fix ifconfig down and freeing of tx/rx descriptors
Subsystems (2)
PATCH 1/4 r6040: fix ifconfig down and freeing of tx/rx descriptors
From: Florian Fainelli <[email protected]>
Subject: [PATCH 1/4] 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:
---
drivers/net/r6040.c +20 -11
@@ -457,17 +457,6 @@ static void r6040_down(struct net_device *dev)iowrite16 (adrp[0 ], ioaddr +MID_0L );iowrite16 (adrp[1 ], ioaddr +MID_0M );iowrite16 (adrp[2 ], ioaddr +MID_0H ); -free_irq (dev->irq, dev); - -/* Free RX buffer */ -r6040_free_rxbufs (dev); - -/* Free TX buffer */ -r6040_free_txbufs (dev); - -/* Free Descriptor memory */ -pci_free_consistent (pdev,RX_DESC_SIZE , lp->rx_ring, lp->rx_ring_dma); -pci_free_consistent (pdev,TX_DESC_SIZE , lp->tx_ring, lp->tx_ring_dma); }static int r6040_close (struct net_device *dev)
@@ -481,8 +470,28 @@ static int r6040_close(struct net_device *dev)napi_disable (&lp->napi);netif_stop_queue (dev);r6040_down (dev); + +free_irq (dev->irq, dev); + +/* Free RX buffer */ +r6040_free_rxbufs (dev); + +/* Free TX buffer */ +r6040_free_txbufs (dev); +spin_unlock_irq (&lp->lock); +/* Free Descriptor memory */ +if (lp->rx_ring) { +pci_free_consistent (pdev,RX_DESC_SIZE , lp->rx_ring, lp->rx_ring_dma); + lp->rx_ring =0 ; + } + +if (lp->tx_ring) { +pci_free_consistent (pdev,TX_DESC_SIZE , lp->tx_ring, lp->tx_ring_dma); + lp->tx_ring =0 ; + } +return 0 ; }
From: Florian Fainelli <[email protected]>
Date: Fri, 9 Jan 2009 02:04:39 +0100
Quoted 10 lines
Subject: [PATCH 1/4] 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 <[email protected]>Signed-off-by Florian Fainelli <[email protected]>
Applied.
David Miller
maintainerFrom: David Miller <[email protected]>
Date: Fri, 09 Jan 2009 23:07:07 -0800 (PST)
Quoted 8 lines
From: Florian Fainelli <[email protected]>
Date: Fri, 9 Jan 2009 02:04:39 +0100Quoted 5 lines
Subject: [PATCH 1/4] 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:
Quoted 7 lines
Quoted 5 lines
WARNING: at arch/x86/kernel/pci-dma.c:376 dma_free_coherent+0x40/0x7d() Modules linked in:Signed-off-by Joe Chou <[email protected]>Signed-off-by Florian Fainelli <[email protected]>Applied.
Actually, this breaks the build.
The problem is that there is no 'pdev' in r6040_close() where you moved these pci_free_consistent() calls.
I guess on whatever platform you tried to compile test this, these interfaces are macros and thus ignore the 'pdev' argument.
I'll fix this but...