From: Yangtao Li <frank.li@vivo.com>
To: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Yangtao Li <frank.li@vivo.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 4/4] net: ethernet: broadcom: Convert to devm_platform_ioremap_resource()
Date: Thu, 6 Jul 2023 20:08:50 +0800 [thread overview]
Message-ID: <20230706120850.11026-4-frank.li@vivo.com> (raw)
In-Reply-To: <20230706120850.11026-1-frank.li@vivo.com>
Use devm_platform_ioremap_resource() to simplify code.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
index 2cf96892e565..e6b28077449b 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -2648,17 +2648,18 @@ static int bcm_enetsw_probe(struct platform_device *pdev)
struct bcm_enet_priv *priv;
struct net_device *dev;
struct bcm63xx_enetsw_platform_data *pd;
- struct resource *res_mem;
int ret, irq_rx, irq_tx;
if (!bcm_enet_shared_base[0])
return -EPROBE_DEFER;
- res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
irq_rx = platform_get_irq(pdev, 0);
+ if (irq_rx < 0)
+ return irq_rx;
+
irq_tx = platform_get_irq(pdev, 1);
- if (!res_mem || irq_rx < 0)
- return -ENODEV;
+ if (irq_tx < 0)
+ return irq_tx;
dev = alloc_etherdev(sizeof(*priv));
if (!dev)
@@ -2690,7 +2691,7 @@ static int bcm_enetsw_probe(struct platform_device *pdev)
if (ret)
goto out;
- priv->base = devm_ioremap_resource(&pdev->dev, res_mem);
+ priv->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(priv->base)) {
ret = PTR_ERR(priv->base);
goto out;
--
2.39.0
next prev parent reply other threads:[~2023-07-06 12:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-06 12:08 [PATCH 1/4] net: emaclite: Use devm_platform_get_and_ioremap_resource() Yangtao Li
2023-07-06 12:08 ` [PATCH 2/4] tsnep: " Yangtao Li
2023-07-06 12:08 ` [PATCH 3/4] net: wiznet: " Yangtao Li
2023-07-06 12:08 ` Yangtao Li [this message]
2023-07-06 12:29 ` [PATCH 1/4] net: emaclite: " Alexander Lobakin
2023-07-06 15:48 ` Jakub Kicinski
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=20230706120850.11026-4-frank.li@vivo.com \
--to=frank.li@vivo.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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
all inboxes | Powered by JetHome®