[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241202212331.7238-4-rosenp@gmail.com>
Date: Mon, 2 Dec 2024 13:23:23 -0800
From: Rosen Penev <rosenp@...il.com>
To: netdev@...r.kernel.org
Cc: Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Claudiu Manoil <claudiu.manoil@....com>,
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH net-next 03/11] net: fsl_pq_mdio: use platform_get_resource
Replace of_address_to_resource with platform_get_resource. No need to
use the of_node when the pdev is sufficient.
Signed-off-by: Rosen Penev <rosenp@...il.com>
---
drivers/net/ethernet/freescale/fsl_pq_mdio.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
index d7f9d99fe782..f14607555f33 100644
--- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c
+++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
@@ -414,7 +414,7 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev)
struct device_node *tbi;
struct mii_bus *new_bus;
struct device_node *np;
- struct resource res;
+ struct resource *res;
int err;
data = device_get_match_data(dev);
@@ -433,15 +433,15 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev)
new_bus->write = &fsl_pq_mdio_write;
new_bus->reset = &fsl_pq_mdio_reset;
- np = dev->of_node;
- err = of_address_to_resource(np, 0, &res);
- if (err < 0) {
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res) {
dev_err(dev, "could not obtain address information\n");
- return err;
+ return -ENOMEM;
}
+ np = dev->of_node;
snprintf(new_bus->id, MII_BUS_ID_SIZE, "%pOFn@...x", np,
- (unsigned long long)res.start);
+ (unsigned long long)res->start);
priv->map = of_iomap(np, 0);
if (!priv->map)
@@ -453,7 +453,7 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev)
* contains the offset of the MII registers inside the mapped register
* space.
*/
- if (data->mii_offset > resource_size(&res)) {
+ if (data->mii_offset > resource_size(res)) {
dev_err(dev, "invalid register map\n");
err = -EINVAL;
goto error;
@@ -480,13 +480,12 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev)
err = -EBUSY;
goto error;
}
- set_tbipa(*prop, pdev,
- data->get_tbipa, priv->map, &res);
+ set_tbipa(*prop, pdev, data->get_tbipa, priv->map, res);
}
}
if (data->ucc_configure)
- data->ucc_configure(res.start, res.end);
+ data->ucc_configure(res->start, res->end);
err = of_mdiobus_register(new_bus, np);
if (err) {
--
2.47.0
Powered by blists - more mailing lists