netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rosen Penev <rosenp@gmail.com>
To: netdev@vger.kernel.org
Cc: Andrew Lunn <andrew@lunn.ch>,
	ansuelsmth@gmail.com, Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH net-next 2/2] net: mdio-ipq8064: remove _remove function
Date: Sun, 17 Nov 2024 13:31:31 -0800	[thread overview]
Message-ID: <20241117213131.14200-3-rosenp@gmail.com> (raw)
In-Reply-To: <20241117213131.14200-1-rosenp@gmail.com>

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(-)

diff --git a/drivers/net/mdio/mdio-ipq8064.c b/drivers/net/mdio/mdio-ipq8064.c
index e3d311ce3810..9f13e16edb17 100644
--- a/drivers/net/mdio/mdio-ipq8064.c
+++ b/drivers/net/mdio/mdio-ipq8064.c
@@ -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,
-- 
2.47.0


  parent reply	other threads:[~2024-11-17 21:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-17 21:31 [PATCH net-next 0/2] net: mdio-ipq8064: simplify with devm Rosen Penev
2024-11-17 21:31 ` [PATCH net-next 1/2] net: mdio-ipq8064: use platform_get_resource Rosen Penev
2024-11-17 21:31 ` Rosen Penev [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-12-03 22:16 [PATCHv2 net-next 0/2] simplify with devm Rosen Penev
2024-12-03 22:16 ` [PATCH net-next 2/2] net: mdio-ipq8064: remove _remove function Rosen Penev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241117213131.14200-3-rosenp@gmail.com \
    --to=rosenp@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=ansuelsmth@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).