From: Laurent Navet <laurent.navet@gmail.com>
To: davem@davemloft.net
Cc: Frank.Li@freescale.com, fabio.estevam@freescale.com,
shawn.guo@linaro.org, joe@perches.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
Laurent Navet <laurent.navet@gmail.com>
Subject: [PATCH] net: ethernet: freescale: use devm_ioremap_resource()
Date: Mon, 13 May 2013 21:37:54 +0200 [thread overview]
Message-ID: <1368473874-9569-1-git-send-email-laurent.navet@gmail.com> (raw)
Replace a call to deprecated devm_request_and_ioremap by devm_ioremap_resource.
also remove tests on 'r' since devm_ioremap_resource() checks for it
in a better way.
Found with coccicheck and this semantic patch:
scripts/coccinelle/api/devm_ioremap_resource.cocci
Signed-off-by: Laurent Navet <laurent.navet@gmail.com>
---
drivers/net/ethernet/freescale/fec_main.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index aff0310..0afc7ff 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1843,8 +1843,6 @@ fec_probe(struct platform_device *pdev)
pdev->id_entry = of_id->data;
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!r)
- return -ENXIO;
/* Init network device */
ndev = alloc_etherdev(sizeof(struct fec_enet_private));
@@ -1861,17 +1859,16 @@ fec_probe(struct platform_device *pdev)
(pdev->id_entry->driver_data & FEC_QUIRK_HAS_GBIT))
fep->pause_flag |= FEC_PAUSE_FLAG_AUTONEG;
- fep->hwp = devm_request_and_ioremap(&pdev->dev, r);
+ fep->hwp = devm_ioremap_resource(&pdev->dev, r);
+ if (IS_ERR(fep->hwp)) {
+ ret = PTR_ERR(fep->hwp);
+ goto failed_ioremap;
+ }
fep->pdev = pdev;
fep->dev_id = dev_id++;
fep->bufdesc_ex = 0;
- if (!fep->hwp) {
- ret = -ENOMEM;
- goto failed_ioremap;
- }
-
platform_set_drvdata(pdev, ndev);
ret = of_get_phy_mode(pdev->dev.of_node);
--
1.7.10.4
next reply other threads:[~2013-05-13 19:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-13 19:37 Laurent Navet [this message]
2013-05-14 6:21 ` [PATCH] net: ethernet: freescale: use devm_ioremap_resource() Frank Li
2013-05-14 7:09 ` Laurent Navet
2013-05-14 13:56 ` Frank Li
2013-05-28 18:32 ` Fabio Estevam
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=1368473874-9569-1-git-send-email-laurent.navet@gmail.com \
--to=laurent.navet@gmail.com \
--cc=Frank.Li@freescale.com \
--cc=davem@davemloft.net \
--cc=fabio.estevam@freescale.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=shawn.guo@linaro.org \
/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).