From: Markus Elfring <Markus.Elfring@web.de>
To: netdev@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Florian Fainelli <f.fainelli@gmail.com>,
Pawel Dembicki <paweldembicki@gmail.com>,
Vivien Didelot <vivien.didelot@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 1/2] net: dsa: vsc73xx: Use devm_platform_ioremap_resource() in vsc73xx_platform_probe()
Date: Fri, 20 Sep 2019 16:28:00 +0200 [thread overview]
Message-ID: <dbc78014-6ed4-5080-8208-0a5930a3bf6e@web.de> (raw)
In-Reply-To: <98fee5f4-1e45-a0c6-2a38-9201b201c6eb@web.de>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 20 Sep 2019 15:23:39 +0200
Simplify this function implementation by using a known wrapper function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/net/dsa/vitesse-vsc73xx-platform.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/drivers/net/dsa/vitesse-vsc73xx-platform.c b/drivers/net/dsa/vitesse-vsc73xx-platform.c
index 0541785f9fee..a3bbf9bd1bf1 100644
--- a/drivers/net/dsa/vitesse-vsc73xx-platform.c
+++ b/drivers/net/dsa/vitesse-vsc73xx-platform.c
@@ -89,7 +89,6 @@ static int vsc73xx_platform_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct vsc73xx_platform *vsc_platform;
- struct resource *res = NULL;
int ret;
vsc_platform = devm_kzalloc(dev, sizeof(*vsc_platform), GFP_KERNEL);
@@ -101,16 +100,7 @@ static int vsc73xx_platform_probe(struct platform_device *pdev)
vsc_platform->vsc.dev = dev;
vsc_platform->vsc.priv = vsc_platform;
vsc_platform->vsc.ops = &vsc73xx_platform_ops;
-
- /* obtain I/O memory space */
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- dev_err(&pdev->dev, "cannot obtain I/O memory space\n");
- ret = -ENXIO;
- return ret;
- }
-
- vsc_platform->base_addr = devm_ioremap_resource(&pdev->dev, res);
+ vsc_platform->base_addr = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(vsc_platform->base_addr)) {
dev_err(&pdev->dev, "cannot request I/O memory space\n");
ret = -ENXIO;
--
2.23.0
next prev parent reply other threads:[~2019-09-20 14:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-20 14:25 [PATCH 0/2] net: dsa: vsc73xx: Adjustments for vsc73xx_platform_probe() Markus Elfring
2019-09-20 14:28 ` Markus Elfring [this message]
2019-09-20 15:08 ` [PATCH 1/2] net: dsa: vsc73xx: Use devm_platform_ioremap_resource() in vsc73xx_platform_probe() Andrew Lunn
2019-09-20 14:30 ` [PATCH 2/2] net: dsa: vsc73xx: Return an error code as a constant " Markus Elfring
2019-09-20 15:08 ` Andrew Lunn
2019-09-20 15:09 ` [PATCH 0/2] net: dsa: vsc73xx: Adjustments for vsc73xx_platform_probe() Andrew Lunn
2019-09-20 15:30 ` [0/2] " Markus Elfring
2019-09-20 16:36 ` Florian Fainelli
2019-09-20 22:12 ` Jakub Kicinski
2019-09-21 7:12 ` Markus Elfring
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=dbc78014-6ed4-5080-8208-0a5930a3bf6e@web.de \
--to=markus.elfring@web.de \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=paweldembicki@gmail.com \
--cc=vivien.didelot@gmail.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).