From: Soren Brinkmann <soren.brinkmann@xilinx.com>
To: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Michal Simek <michal.simek@xilinx.com>,
Soren Brinkmann <soren.brinkmann@xilinx.com>
Subject: [PATCH RFC 3/5] net: macb: Use devm_ioremap()
Date: Mon, 14 Oct 2013 16:58:58 -0700 [thread overview]
Message-ID: <1381795140-10792-4-git-send-email-soren.brinkmann@xilinx.com> (raw)
In-Reply-To: <1381795140-10792-1-git-send-email-soren.brinkmann@xilinx.com>
Use the device managed version of ioremap to remap IO memory,
simplifying error paths.
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
---
drivers/net/ethernet/cadence/macb.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 62aa136889a4..436aecc31732 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -17,6 +17,7 @@
#include <linux/circ_buf.h>
#include <linux/slab.h>
#include <linux/init.h>
+#include <linux/io.h>
#include <linux/gpio.h>
#include <linux/interrupt.h>
#include <linux/netdevice.h>
@@ -1816,7 +1817,7 @@ static int __init macb_probe(struct platform_device *pdev)
goto err_out_disable_pclk;
}
- bp->regs = ioremap(regs->start, resource_size(regs));
+ bp->regs = devm_ioremap(&pdev->dev, regs->start, resource_size(regs));
if (!bp->regs) {
dev_err(&pdev->dev, "failed to map registers, aborting.\n");
err = -ENOMEM;
@@ -1828,7 +1829,7 @@ static int __init macb_probe(struct platform_device *pdev)
if (err) {
dev_err(&pdev->dev, "Unable to request IRQ %d (error %d)\n",
dev->irq, err);
- goto err_out_iounmap;
+ goto err_out_disable_clocks;
}
dev->netdev_ops = &macb_netdev_ops;
@@ -1916,8 +1917,6 @@ err_out_unregister_netdev:
unregister_netdev(dev);
err_out_free_irq:
free_irq(dev->irq, dev);
-err_out_iounmap:
- iounmap(bp->regs);
err_out_disable_clocks:
clk_disable_unprepare(bp->hclk);
err_out_disable_pclk:
@@ -1944,7 +1943,6 @@ static int __exit macb_remove(struct platform_device *pdev)
mdiobus_free(bp->mii_bus);
unregister_netdev(dev);
free_irq(dev->irq, dev);
- iounmap(bp->regs);
clk_disable_unprepare(bp->hclk);
clk_disable_unprepare(bp->pclk);
free_netdev(dev);
--
1.8.4
next prev parent reply other threads:[~2013-10-14 23:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-14 23:58 [PATCH RFC 0/5] Ethernet support for Zynq Soren Brinkmann
2013-10-14 23:58 ` [PATCH RFC 1/5] net: macb: Migrate to dev_pm_ops Soren Brinkmann
2013-10-15 7:41 ` Nicolas Ferre
2013-10-14 23:58 ` [PATCH RFC 2/5] net: macb: Migrate to devm clock interface Soren Brinkmann
2013-10-15 7:44 ` Nicolas Ferre
2013-10-14 23:58 ` Soren Brinkmann [this message]
2013-10-15 7:45 ` [PATCH RFC 3/5] net: macb: Use devm_ioremap() Nicolas Ferre
2013-10-14 23:58 ` [PATCH RFC 4/5] net: macb: Use devm_request_irq() Soren Brinkmann
2013-10-15 7:46 ` Nicolas Ferre
2013-10-15 19:21 ` Sergei Shtylyov
2013-10-15 20:20 ` Sören Brinkmann
2013-10-15 20:38 ` Sergei Shtylyov
2013-10-14 23:59 ` [PATCH RFC 5/5] net: macb: Adjust tx_clk when link speed changes Soren Brinkmann
2013-10-15 7:54 ` Nicolas Ferre
2013-10-15 7:58 ` Michal Simek
2013-10-15 15:34 ` Sören Brinkmann
2013-11-22 19:31 ` Sören Brinkmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1381795140-10792-4-git-send-email-soren.brinkmann@xilinx.com \
--to=soren.brinkmann@xilinx.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@atmel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).