提交 ace58010 编写于 作者: S Steffen Trumtrar 提交者: David S. Miller

net/macb: make clk_enable atomic

Use clk_prepare_enable/clk_disable_unprepare to be safe on SMP systems.
Signed-off-by: NSteffen Trumtrar <s.trumtrar@pengutronix.de>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Fabio Estevam <festevam@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 a1ae385d
...@@ -1561,14 +1561,14 @@ static int __init macb_probe(struct platform_device *pdev) ...@@ -1561,14 +1561,14 @@ static int __init macb_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "failed to get macb_clk\n"); dev_err(&pdev->dev, "failed to get macb_clk\n");
goto err_out_free_dev; goto err_out_free_dev;
} }
clk_enable(bp->pclk); clk_prepare_enable(bp->pclk);
bp->hclk = clk_get(&pdev->dev, "hclk"); bp->hclk = clk_get(&pdev->dev, "hclk");
if (IS_ERR(bp->hclk)) { if (IS_ERR(bp->hclk)) {
dev_err(&pdev->dev, "failed to get hclk\n"); dev_err(&pdev->dev, "failed to get hclk\n");
goto err_out_put_pclk; goto err_out_put_pclk;
} }
clk_enable(bp->hclk); clk_prepare_enable(bp->hclk);
bp->regs = ioremap(regs->start, resource_size(regs)); bp->regs = ioremap(regs->start, resource_size(regs));
if (!bp->regs) { if (!bp->regs) {
...@@ -1658,9 +1658,9 @@ static int __init macb_probe(struct platform_device *pdev) ...@@ -1658,9 +1658,9 @@ static int __init macb_probe(struct platform_device *pdev)
err_out_iounmap: err_out_iounmap:
iounmap(bp->regs); iounmap(bp->regs);
err_out_disable_clocks: err_out_disable_clocks:
clk_disable(bp->hclk); clk_disable_unprepare(bp->hclk);
clk_put(bp->hclk); clk_put(bp->hclk);
clk_disable(bp->pclk); clk_disable_unprepare(bp->pclk);
err_out_put_pclk: err_out_put_pclk:
clk_put(bp->pclk); clk_put(bp->pclk);
err_out_free_dev: err_out_free_dev:
...@@ -1687,9 +1687,9 @@ static int __exit macb_remove(struct platform_device *pdev) ...@@ -1687,9 +1687,9 @@ static int __exit macb_remove(struct platform_device *pdev)
unregister_netdev(dev); unregister_netdev(dev);
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
iounmap(bp->regs); iounmap(bp->regs);
clk_disable(bp->hclk); clk_disable_unprepare(bp->hclk);
clk_put(bp->hclk); clk_put(bp->hclk);
clk_disable(bp->pclk); clk_disable_unprepare(bp->pclk);
clk_put(bp->pclk); clk_put(bp->pclk);
free_netdev(dev); free_netdev(dev);
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
...@@ -1707,8 +1707,8 @@ static int macb_suspend(struct platform_device *pdev, pm_message_t state) ...@@ -1707,8 +1707,8 @@ static int macb_suspend(struct platform_device *pdev, pm_message_t state)
netif_carrier_off(netdev); netif_carrier_off(netdev);
netif_device_detach(netdev); netif_device_detach(netdev);
clk_disable(bp->hclk); clk_disable_unprepare(bp->hclk);
clk_disable(bp->pclk); clk_disable_unprepare(bp->pclk);
return 0; return 0;
} }
...@@ -1718,8 +1718,8 @@ static int macb_resume(struct platform_device *pdev) ...@@ -1718,8 +1718,8 @@ static int macb_resume(struct platform_device *pdev)
struct net_device *netdev = platform_get_drvdata(pdev); struct net_device *netdev = platform_get_drvdata(pdev);
struct macb *bp = netdev_priv(netdev); struct macb *bp = netdev_priv(netdev);
clk_enable(bp->pclk); clk_prepare_enable(bp->pclk);
clk_enable(bp->hclk); clk_prepare_enable(bp->hclk);
netif_device_attach(netdev); netif_device_attach(netdev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册