Commit 63973461 authored by Joachim Eastwood's avatar Joachim Eastwood Committed by David S. Miller

net/at91_ether: convert to devm_* functions

Signed-off-by: default avatarJoachim Eastwood <manabian@gmail.com>
parent 04879e5c
...@@ -30,9 +30,8 @@ ...@@ -30,9 +30,8 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/gfp.h> #include <linux/gfp.h>
#include <linux/phy.h> #include <linux/phy.h>
#include <linux/io.h>
#include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include "macb.h" #include "macb.h"
...@@ -472,26 +471,25 @@ static int __init at91ether_probe(struct platform_device *pdev) ...@@ -472,26 +471,25 @@ static int __init at91ether_probe(struct platform_device *pdev)
spin_lock_init(&lp->lock); spin_lock_init(&lp->lock);
dev->base_addr = regs->start; /* physical base address */ dev->base_addr = regs->start; /* physical base address */
lp->regs = ioremap(regs->start, regs->end - regs->start + 1); lp->regs = devm_ioremap(&pdev->dev, regs->start, resource_size(regs));
if (!lp->regs) { if (!lp->regs) {
res = -ENOMEM; res = -ENOMEM;
goto err_free_dev; goto err_free_dev;
} }
/* Clock */ /* Clock */
lp->pclk = clk_get(&pdev->dev, "ether_clk"); lp->pclk = devm_clk_get(&pdev->dev, "ether_clk");
if (IS_ERR(lp->pclk)) { if (IS_ERR(lp->pclk)) {
res = PTR_ERR(lp->pclk); res = PTR_ERR(lp->pclk);
goto err_ioumap; goto err_free_dev;
} }
clk_enable(lp->pclk); clk_enable(lp->pclk);
/* Install the interrupt handler */ /* Install the interrupt handler */
dev->irq = platform_get_irq(pdev, 0); dev->irq = platform_get_irq(pdev, 0);
if (request_irq(dev->irq, at91ether_interrupt, 0, dev->name, dev)) { res = devm_request_irq(&pdev->dev, dev->irq, at91ether_interrupt, 0, dev->name, dev);
res = -EBUSY; if (res)
goto err_disable_clock; goto err_disable_clock;
}
ether_setup(dev); ether_setup(dev);
dev->netdev_ops = &at91ether_netdev_ops; dev->netdev_ops = &at91ether_netdev_ops;
...@@ -515,7 +513,7 @@ static int __init at91ether_probe(struct platform_device *pdev) ...@@ -515,7 +513,7 @@ static int __init at91ether_probe(struct platform_device *pdev)
/* Register the network interface */ /* Register the network interface */
res = register_netdev(dev); res = register_netdev(dev);
if (res) if (res)
goto err_free_irq; goto err_disable_clock;
if (macb_mii_init(lp) != 0) if (macb_mii_init(lp) != 0)
goto err_out_unregister_netdev; goto err_out_unregister_netdev;
...@@ -537,14 +535,8 @@ static int __init at91ether_probe(struct platform_device *pdev) ...@@ -537,14 +535,8 @@ static int __init at91ether_probe(struct platform_device *pdev)
err_out_unregister_netdev: err_out_unregister_netdev:
unregister_netdev(dev); unregister_netdev(dev);
err_free_irq:
platform_set_drvdata(pdev, NULL);
free_irq(dev->irq, dev);
err_disable_clock: err_disable_clock:
clk_disable(lp->pclk); clk_disable(lp->pclk);
clk_put(lp->pclk);
err_ioumap:
iounmap(lp->regs);
err_free_dev: err_free_dev:
free_netdev(dev); free_netdev(dev);
return res; return res;
...@@ -562,10 +554,7 @@ static int __devexit at91ether_remove(struct platform_device *pdev) ...@@ -562,10 +554,7 @@ static int __devexit at91ether_remove(struct platform_device *pdev)
kfree(lp->mii_bus->irq); kfree(lp->mii_bus->irq);
mdiobus_free(lp->mii_bus); mdiobus_free(lp->mii_bus);
unregister_netdev(dev); unregister_netdev(dev);
free_irq(dev->irq, dev);
iounmap(lp->regs);
clk_disable(lp->pclk); clk_disable(lp->pclk);
clk_put(lp->pclk);
free_netdev(dev); free_netdev(dev);
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
......
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