summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorSean Wang <sean.wang@mediatek.com>2016-09-01 05:47:32 +0300
committerDavid S. Miller <davem@davemloft.net>2016-09-01 06:53:48 +0300
commit79e9a41438527a4cc2b426a2dfb92cd0825d7d29 (patch)
tree8ce6cbc46475cf7182a7a7c6550c8964896a983b /drivers/net
parent7c6b0d76fa02213393815e3b6d5e4a415bf3f0e2 (diff)
downloadlinux-79e9a41438527a4cc2b426a2dfb92cd0825d7d29.tar.xz
net: ethernet: mediatek: fix issue of driver removal with interface is up
mtk_stop() must be called to stop for freeing DMA resources acquired and restoring state changed by mtk_open() firstly when module removal. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/mediatek/mtk_eth_soc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index bf5b7e1d9450..556951e66978 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -1906,6 +1906,14 @@ err_free_dev:
static int mtk_remove(struct platform_device *pdev)
{
struct mtk_eth *eth = platform_get_drvdata(pdev);
+ int i;
+
+ /* stop all devices to make sure that dma is properly shut down */
+ for (i = 0; i < MTK_MAC_COUNT; i++) {
+ if (!eth->netdev[i])
+ continue;
+ mtk_stop(eth->netdev[i]);
+ }
clk_disable_unprepare(eth->clks[MTK_CLK_ETHIF]);
clk_disable_unprepare(eth->clks[MTK_CLK_ESW]);