summaryrefslogtreecommitdiff
path: root/target/linux/ramips/files
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2009-10-26 17:17:29 +0000
committerGabor Juhos <juhosg@openwrt.org>2009-10-26 17:17:29 +0000
commitf69b042df920a3e16691c90f8b6b5dfb257097b3 (patch)
treecf17900417cad4bc0641f972f1d4dfc199cbbf3d /target/linux/ramips/files
parentdefb7c005984fb3337a5c6766cce283950427d5f (diff)
downloadmtk-20170518-f69b042df920a3e16691c90f8b6b5dfb257097b3.zip
mtk-20170518-f69b042df920a3e16691c90f8b6b5dfb257097b3.tar.gz
mtk-20170518-f69b042df920a3e16691c90f8b6b5dfb257097b3.tar.bz2
ramips: add ramips_cleanup_dma helper
SVN-Revision: 18169
Diffstat (limited to 'target/linux/ramips/files')
-rw-r--r--target/linux/ramips/files/drivers/net/ramips.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/target/linux/ramips/files/drivers/net/ramips.c b/target/linux/ramips/files/drivers/net/ramips.c
index 622cd60..a4118ab 100644
--- a/target/linux/ramips/files/drivers/net/ramips.c
+++ b/target/linux/ramips/files/drivers/net/ramips.c
@@ -50,6 +50,18 @@ ramips_fe_rr(unsigned reg)
return __raw_readl(ramips_fe_base + reg);
}
+static void
+ramips_cleanup_dma(struct net_device *dev)
+{
+ struct raeth_priv *priv = netdev_priv(dev);
+
+ dma_free_coherent(NULL, NUM_RX_DESC * sizeof(struct ramips_rx_dma),
+ priv->rx, priv->phy_rx);
+
+ dma_free_coherent(NULL, NUM_TX_DESC * sizeof(struct ramips_tx_dma),
+ priv->tx, priv->phy_tx);
+}
+
static int
ramips_alloc_dma(struct net_device *dev)
{
@@ -297,10 +309,7 @@ ramips_eth_stop(struct net_device *dev)
netif_stop_queue(dev);
tasklet_kill(&priv->tx_housekeeping_tasklet);
tasklet_kill(&priv->rx_tasklet);
- dma_free_coherent(NULL, NUM_TX_DESC * sizeof(struct ramips_tx_dma),
- priv->tx, priv->phy_tx);
- dma_free_coherent(NULL, NUM_RX_DESC * sizeof(struct ramips_rx_dma),
- priv->rx, priv->phy_rx);
+ ramips_cleanup_dma(dev);
printk(KERN_DEBUG "ramips_eth: stopped\n");
return 0;
}