@@ -109,12 +109,10 @@ static const struct regmap_config ipq8064_mdio_regmap_config = {
static int
ipq8064_mdio_probe(struct platform_device *pdev)
{
- struct device_node *np = pdev->dev.of_node;
struct ipq8064_mdio *priv;
struct resource *res;
struct mii_bus *bus;
void __iomem *base;
- int ret;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
@@ -140,19 +138,7 @@ ipq8064_mdio_probe(struct platform_device *pdev)
if (IS_ERR(priv->base))
return PTR_ERR(priv->base);
- ret = of_mdiobus_register(bus, np);
- if (ret)
- return ret;
-
- platform_set_drvdata(pdev, bus);
- return 0;
-}
-
-static void ipq8064_mdio_remove(struct platform_device *pdev)
-{
- struct mii_bus *bus = platform_get_drvdata(pdev);
-
- mdiobus_unregister(bus);
+ return devm_mdiobus_register(&pdev->dev, bus);
}
static const struct of_device_id ipq8064_mdio_dt_ids[] = {
@@ -163,7 +149,6 @@ MODULE_DEVICE_TABLE(of, ipq8064_mdio_dt_ids);
static struct platform_driver ipq8064_mdio_driver = {
.probe = ipq8064_mdio_probe,
- .remove = ipq8064_mdio_remove,
.driver = {
.name = "ipq8064-mdio",
.of_match_table = ipq8064_mdio_dt_ids,
Change of_mdiobus_register to devm_mdiobus_register as devm allows removing the _remove function as well as slightly cleaning up the probe function. Regular mdiobus_register is fine here as the platform device's of_node is used. Removes two variables from _probe. Signed-off-by: Rosen Penev <rosenp@gmail.com> --- drivers/net/mdio/mdio-ipq8064.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-)