From: Buday Csaba <buday.csaba@prolan.hu>
To: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: "Buday Csaba" <buday.csaba@prolan.hu>,
"Csókás Bence" <csokas.bence@prolan.hu>,
"Andrew Lunn" <andrew@lunn.ch>,
"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>
Subject: [PATCH 2/3] net: mdiobus: release reset_gpio in mdiobus_unregister_device()
Date: Wed, 9 Jul 2025 15:32:21 +0200 [thread overview]
Message-ID: <20250709133222.48802-3-buday.csaba@prolan.hu> (raw)
In-Reply-To: <20250709133222.48802-1-buday.csaba@prolan.hu>
reset_gpio is claimed in mdiobus_register_device(), but it is not
released in mdiobus_unregister_device().
When a device uses the reset_gpio property, it becomes impossible
to unregister it and register it again, because the GPIO remains
claimed.
This patch resolves that issue.
Signed-off-by: Buday Csaba <buday.csaba@prolan.hu>
Cc: Csókás Bence <csokas.bence@prolan.hu>
---
drivers/net/phy/mdio_bus.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 591e8fd33d8ea..a508cd81cd4ed 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -97,6 +97,7 @@ int mdiobus_unregister_device(struct mdio_device *mdiodev)
if (mdiodev->bus->mdio_map[mdiodev->addr] != mdiodev)
return -EINVAL;
+ gpiod_put(mdiodev->reset_gpio);
reset_control_put(mdiodev->reset_ctrl);
mdiodev->bus->mdio_map[mdiodev->addr] = NULL;
@@ -814,9 +815,6 @@ void mdiobus_unregister(struct mii_bus *bus)
if (!mdiodev)
continue;
- if (mdiodev->reset_gpio)
- gpiod_put(mdiodev->reset_gpio);
-
mdiodev->device_remove(mdiodev);
mdiodev->device_free(mdiodev);
}
--
2.39.5
next prev parent reply other threads:[~2025-07-09 13:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250709133222.48802-1-buday.csaba@prolan.hu>
2025-07-09 13:32 ` [PATCH 1/3] net: phy: smsc: add proper reset flags for LAN8710A Buday Csaba
2025-07-09 13:40 ` Andrew Lunn
2025-07-09 13:32 ` Buday Csaba [this message]
2025-07-09 13:38 ` [PATCH 2/3] net: mdiobus: release reset_gpio in mdiobus_unregister_device() Andrew Lunn
2025-07-09 13:32 ` [PATCH 3/3] net: mdio: reset PHY before attempting to access registers in fwnode_mdiobus_register_phy Buday Csaba
2025-07-09 13:41 ` Andrew Lunn
2025-07-10 10:11 ` Buday Csaba
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=20250709133222.48802-3-buday.csaba@prolan.hu \
--to=buday.csaba@prolan.hu \
--cc=andrew@lunn.ch \
--cc=csokas.bence@prolan.hu \
--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