Commit b48e0bab authored by Soren Brinkmann's avatar Soren Brinkmann Committed by David S. Miller

net: macb: Migrate to devm clock interface

Migrate to using the device managed interface for clocks and clean up
the associated error paths.
Signed-off-by: default avatarSoren Brinkmann <soren.brinkmann@xilinx.com>
Acked-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0dfc3e18
...@@ -1790,19 +1790,31 @@ static int __init macb_probe(struct platform_device *pdev) ...@@ -1790,19 +1790,31 @@ static int __init macb_probe(struct platform_device *pdev)
spin_lock_init(&bp->lock); spin_lock_init(&bp->lock);
INIT_WORK(&bp->tx_error_task, macb_tx_error_task); INIT_WORK(&bp->tx_error_task, macb_tx_error_task);
bp->pclk = clk_get(&pdev->dev, "pclk"); bp->pclk = devm_clk_get(&pdev->dev, "pclk");
if (IS_ERR(bp->pclk)) { if (IS_ERR(bp->pclk)) {
dev_err(&pdev->dev, "failed to get macb_clk\n"); err = PTR_ERR(bp->pclk);
dev_err(&pdev->dev, "failed to get macb_clk (%u)\n", err);
goto err_out_free_dev; goto err_out_free_dev;
} }
clk_prepare_enable(bp->pclk);
bp->hclk = clk_get(&pdev->dev, "hclk"); bp->hclk = devm_clk_get(&pdev->dev, "hclk");
if (IS_ERR(bp->hclk)) { if (IS_ERR(bp->hclk)) {
dev_err(&pdev->dev, "failed to get hclk\n"); err = PTR_ERR(bp->hclk);
goto err_out_put_pclk; dev_err(&pdev->dev, "failed to get hclk (%u)\n", err);
goto err_out_free_dev;
}
err = clk_prepare_enable(bp->pclk);
if (err) {
dev_err(&pdev->dev, "failed to enable pclk (%u)\n", err);
goto err_out_free_dev;
}
err = clk_prepare_enable(bp->hclk);
if (err) {
dev_err(&pdev->dev, "failed to enable hclk (%u)\n", err);
goto err_out_disable_pclk;
} }
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) {
...@@ -1908,10 +1920,8 @@ static int __init macb_probe(struct platform_device *pdev) ...@@ -1908,10 +1920,8 @@ static int __init macb_probe(struct platform_device *pdev)
iounmap(bp->regs); iounmap(bp->regs);
err_out_disable_clocks: err_out_disable_clocks:
clk_disable_unprepare(bp->hclk); clk_disable_unprepare(bp->hclk);
clk_put(bp->hclk); err_out_disable_pclk:
clk_disable_unprepare(bp->pclk); clk_disable_unprepare(bp->pclk);
err_out_put_pclk:
clk_put(bp->pclk);
err_out_free_dev: err_out_free_dev:
free_netdev(dev); free_netdev(dev);
err_out: err_out:
...@@ -1936,9 +1946,7 @@ static int __exit macb_remove(struct platform_device *pdev) ...@@ -1936,9 +1946,7 @@ static int __exit macb_remove(struct platform_device *pdev)
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
iounmap(bp->regs); iounmap(bp->regs);
clk_disable_unprepare(bp->hclk); clk_disable_unprepare(bp->hclk);
clk_put(bp->hclk);
clk_disable_unprepare(bp->pclk); clk_disable_unprepare(bp->pclk);
clk_put(bp->pclk);
free_netdev(dev); free_netdev(dev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment