From: Laurent Navet <laurent.navet@gmail.com>
To: davem@davemloft.net
Cc: cernekee@gmail.com, sergei.shtylyov@cogentembedded.com,
jogo@openwrt.org, joe@perches.com, gregkh@linuxfoundation.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Laurent Navet <laurent.navet@gmail.com>
Subject: [PATCH] drivers: net: ethernet: broadcom: bcm63xx: use devm_ioremap_resource()
Date: Mon, 13 May 2013 15:53:01 +0200 [thread overview]
Message-ID: <1368453181-6637-1-git-send-email-laurent.navet@gmail.com> (raw)
Replace calls to deprecated devm_request_and_ioremap by devm_ioremap_resource.
also remove tests on 'res' since devm_ioremap_resource() checks for it
in a better form.
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/broadcom/bcm63xx_enet.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
index 0b3e23e..0497d0a 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -1628,7 +1628,7 @@ static int bcm_enet_probe(struct platform_device *pdev)
res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
res_irq_rx = platform_get_resource(pdev, IORESOURCE_IRQ, 1);
res_irq_tx = platform_get_resource(pdev, IORESOURCE_IRQ, 2);
- if (!res_mem || !res_irq || !res_irq_rx || !res_irq_tx)
+ if (!res_irq || !res_irq_rx || !res_irq_tx)
return -ENODEV;
ret = 0;
@@ -1641,9 +1641,9 @@ static int bcm_enet_probe(struct platform_device *pdev)
if (ret)
goto out;
- priv->base = devm_request_and_ioremap(&pdev->dev, res_mem);
- if (priv->base == NULL) {
- ret = -ENOMEM;
+ priv->base = devm_ioremap_resource(&pdev->dev, res_mem);
+ if (IS_ERR(priv->base)) {
+ ret = PTR_ERR(priv->base);
goto out;
}
@@ -1869,12 +1869,10 @@ static int bcm_enet_shared_probe(struct platform_device *pdev)
struct resource *res;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENODEV;
- bcm_enet_shared_base = devm_request_and_ioremap(&pdev->dev, res);
- if (!bcm_enet_shared_base)
- return -ENOMEM;
+ bcm_enet_shared_base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(bcm_enet_shared_base))
+ return PTR_ERR(bcm_enet_shared_base);
return 0;
}
--
1.7.10.4
next reply other threads:[~2013-05-13 13:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-13 13:53 Laurent Navet [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-05-12 15:56 [PATCH] drivers: net: ethernet: broadcom: bcm63xx: use devm_ioremap_resource() Laurent Navet
2013-05-12 15:53 ` Laurent Navet
2013-05-12 18:38 ` Sergei Shtylyov
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=1368453181-6637-1-git-send-email-laurent.navet@gmail.com \
--to=laurent.navet@gmail.com \
--cc=cernekee@gmail.com \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--cc=jogo@openwrt.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sergei.shtylyov@cogentembedded.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).