From: netdev-bot+sashiko@kernel.org
To: f@lex.la
Cc: netdev@vger.kernel.org, andrew@lunn.ch, andrew+netdev@lunn.ch,
hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net,
edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
horms@kernel.org, olteanv@gmail.com, Thangaraj.S@microchip.com,
UNGLinuxDriver@microchip.com, steve.glendinning@shawell.net,
f.fainelli@gmail.com, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v12 3/4] net: phy: take the interrupt back from the bus on detach
Date: Wed, 30 Sep 2026 00:58:21 +0000 [thread overview]
Message-ID: <179072990181.434549.15084696930848727858@kernel.org> (raw)
In-Reply-To: <20260927235733.2619081-4-f@lex.la>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] In this patch alone ("net: phy: take the interrupt back from the
bus on detach"), phydev->irq is restored only in phy_detach().
--
net: phy: take the interrupt back from the bus on detach
When a PHY is first bound to the generic driver, phy_probe() replaces
phydev->irq with PHY_POLL, and the value is never put back. After that,
the PHY stays in polling mode even once the real driver binds. This patch
restores phydev->irq from mdiobus->irq[] in phy_detach() before the
genphy driver is released.
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index 94b2e85e00a37..a9c71a2861186 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -1965,6 +1965,8 @@ void phy_detach(struct phy_device *phydev)
> * real driver could be loaded
> */
> if (phydev->is_genphy_driven) {
> + /* The release below lets phy_probe() write this field. */
> + phydev->irq = phydev->mdio.bus->irq[phydev->mdio.addr];
[Severity: Low]
phy_attach_direct() has a second way to undo the genphy bind, and that
path doesn't restore phydev->irq.
This patch only adds the restore to phy_detach(). phy_attach_direct() can
also back out of the genphy bind:
drivers/net/phy/phy_device.c:phy_attach_direct() {
...
if (phydev->is_genphy_driven) {
err = d->driver->probe(d);
if (err >= 0)
err = device_bind_driver(d);
if (err)
goto error_module_put;
}
...
error_module_put:
module_put(d->driver->owner);
phydev->is_genphy_driven = 0;
d->driver = NULL;
...
}
phy_probe() sets phydev->irq = PHY_POLL before steps that can still fail.
Two examples are an MDIO read error in genphy_read_abilities() and
-ENOMEM in phy_setup_ports(). device_bind_driver() can also fail.
In those cases the error_module_put path clears is_genphy_driven and
d->driver, but phydev->irq keeps the PHY_POLL value. If the PHY device
survives and a real driver binds later, the PHY would still be polled.
The next patch in the series, "net: phy: restore the interrupt when the
generic bind cycle fails", closes this gap. It saves phydev->irq in a local
at the start of phy_attach_direct() and writes it back under
error_module_put. So the gap only exists between these two commits.
Would it be worth folding that change into this patch, so both genphy
unbind paths restore phydev->irq in the same commit?
> device_release_driver(&phydev->mdio.dev);
> phydev->is_genphy_driven = 0;
> }
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260927235733.2619081-1-f%40lex.la
next prev parent reply other threads:[~2026-09-30 0:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-27 23:57 [PATCH net v12 0/4] net: phy: keep a PHY interrupt across a generic bind cycle Aleksei Sviridkin
2026-09-27 23:57 ` [PATCH net v12 1/4] net: usb: lan78xx: register the PHY interrupt with the MDIO bus Aleksei Sviridkin
2026-09-30 0:58 ` netdev-bot+sashiko
2026-09-30 12:50 ` Andrew Lunn
2026-09-27 23:57 ` [PATCH net v12 2/4] net: usb: smsc95xx: " Aleksei Sviridkin
2026-09-27 23:57 ` [PATCH net v12 3/4] net: phy: take the interrupt back from the bus on detach Aleksei Sviridkin
2026-09-30 0:58 ` netdev-bot+sashiko [this message]
2026-09-27 23:57 ` [PATCH net v12 4/4] net: phy: restore the interrupt when the generic bind cycle fails Aleksei Sviridkin
2026-09-30 0:58 ` netdev-bot+sashiko
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=179072990181.434549.15084696930848727858@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=Thangaraj.S@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=f.fainelli@gmail.com \
--cc=f@lex.la \
--cc=hkallweit1@gmail.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=steve.glendinning@shawell.net \
/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
all inboxes | Powered by JetHome®