2021-06-09 12:16:13

by Yang Yingliang

[permalink] [raw]
Subject: [PATCH net-next] net: ethernet: ravb: Use devm_platform_get_and_ioremap_resource()

Use devm_platform_get_and_ioremap_resource() to simplify
code.

Signed-off-by: Yang Yingliang <[email protected]>
---
drivers/net/ethernet/renesas/ravb_main.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 4afff320dfd0..69c50f81e1cb 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2047,13 +2047,6 @@ static int ravb_probe(struct platform_device *pdev)
return -EINVAL;
}

- /* Get base address */
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- dev_err(&pdev->dev, "invalid resource\n");
- return -EINVAL;
- }
-
ndev = alloc_etherdev_mqs(sizeof(struct ravb_private),
NUM_TX_QUEUE, NUM_RX_QUEUE);
if (!ndev)
@@ -2065,9 +2058,6 @@ static int ravb_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev);
pm_runtime_get_sync(&pdev->dev);

- /* The Ether-specific entries in the device structure. */
- ndev->base_addr = res->start;
-
chip_id = (enum ravb_chip_id)of_device_get_match_data(&pdev->dev);

if (chip_id == RCAR_GEN3)
@@ -2089,12 +2079,15 @@ static int ravb_probe(struct platform_device *pdev)
priv->num_rx_ring[RAVB_BE] = BE_RX_RING_SIZE;
priv->num_tx_ring[RAVB_NC] = NC_TX_RING_SIZE;
priv->num_rx_ring[RAVB_NC] = NC_RX_RING_SIZE;
- priv->addr = devm_ioremap_resource(&pdev->dev, res);
+ priv->addr = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
if (IS_ERR(priv->addr)) {
error = PTR_ERR(priv->addr);
goto out_release;
}

+ /* The Ether-specific entries in the device structure. */
+ ndev->base_addr = res->start;
+
spin_lock_init(&priv->lock);
INIT_WORK(&priv->work, ravb_tx_timeout_work);

--
2.25.1


2021-06-09 15:01:26

by Sergei Shtylyov

[permalink] [raw]
Subject: Re: [PATCH net-next] net: ethernet: ravb: Use devm_platform_get_and_ioremap_resource()

On 6/9/21 4:24 AM, Yang Yingliang wrote:

> Use devm_platform_get_and_ioremap_resource() to simplify
> code.

Not as hard as it seemed at the 1st glance. :-)

> Signed-off-by: Yang Yingliang <[email protected]>

Reviewed-by: Sergei Shtylyov <[email protected]>

[...]

MBR, Sergei

2021-06-09 21:02:41

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH net-next] net: ethernet: ravb: Use devm_platform_get_and_ioremap_resource()

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Wed, 9 Jun 2021 09:24:44 +0800 you wrote:
> Use devm_platform_get_and_ioremap_resource() to simplify
> code.
>
> Signed-off-by: Yang Yingliang <[email protected]>
> ---
> drivers/net/ethernet/renesas/ravb_main.c | 15 ++++-----------
> 1 file changed, 4 insertions(+), 11 deletions(-)

Here is the summary with links:
- [net-next] net: ethernet: ravb: Use devm_platform_get_and_ioremap_resource()
https://git.kernel.org/netdev/net-next/c/e89a2cdb1cca

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html