Re: [PATCH net-next 1/2] net: mdio-ipq8064: use platform_get_resource

From: Heiner Kallweit
Date: Tue Dec 03 2024 - 18:04:44 EST


On 03.12.2024 23:16, Rosen Penev wrote:
> There's no need to get the of_node explicitly. platform_get_resource
> already does this.
>
> Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
> ---
> drivers/net/mdio/mdio-ipq8064.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/mdio/mdio-ipq8064.c b/drivers/net/mdio/mdio-ipq8064.c
> index 6253a9ab8b69..e3d311ce3810 100644
> --- a/drivers/net/mdio/mdio-ipq8064.c
> +++ b/drivers/net/mdio/mdio-ipq8064.c
> @@ -111,15 +111,16 @@ ipq8064_mdio_probe(struct platform_device *pdev)
> {
> struct device_node *np = pdev->dev.of_node;
> struct ipq8064_mdio *priv;
> - struct resource res;
> + struct resource *res;
> struct mii_bus *bus;
> void __iomem *base;
> int ret;
>
> - if (of_address_to_resource(np, 0, &res))
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!res)
> return -ENOMEM;
>
> - base = devm_ioremap(&pdev->dev, res.start, resource_size(&res));
> + base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
> if (!base)
> return -ENOMEM;
>

Why not directly switching to devm_platform_get_and_ioremap_resource()?