[PATCH v2 1/2] net: phy: mscc-miim: Use devm_platform_ioremap_resource() in mscc_miim_probe()

From: Markus Elfring
Date: Fri Sep 27 2019 - 04:17:14 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 27 Sep 2019 09:24:03 +0200

Simplify this function implementation a bit by using
a known wrapper function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---

v2:
Alexandre Belloni pointed the need for adjustments out.
https://lore.kernel.org/r/20190926193239.GC6825@xxxxxxxxx/

* The mapping of internal phy registers should be treated as optional.
* An other prefix would be preferred in the commit subject.


drivers/net/phy/mdio-mscc-miim.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/net/phy/mdio-mscc-miim.c b/drivers/net/phy/mdio-mscc-miim.c
index badbc99bedd3..aabb13982251 100644
--- a/drivers/net/phy/mdio-mscc-miim.c
+++ b/drivers/net/phy/mdio-mscc-miim.c
@@ -120,10 +120,6 @@ static int mscc_miim_probe(struct platform_device *pdev)
struct mscc_miim_dev *dev;
int ret;

- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENODEV;
-
bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*dev));
if (!bus)
return -ENOMEM;
@@ -136,7 +132,7 @@ static int mscc_miim_probe(struct platform_device *pdev)
bus->parent = &pdev->dev;

dev = bus->priv;
- dev->regs = devm_ioremap_resource(&pdev->dev, res);
+ dev->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(dev->regs)) {
dev_err(&pdev->dev, "Unable to map MIIM registers\n");
return PTR_ERR(dev->regs);
--
2.23.0