mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 v13 3/4] net: phy: take the interrupt back from the bus on detach
Date: Mon, 05 Oct 2026 13:26:37 +0000	[thread overview]
Message-ID: <179120679761.434549.12466957475136887665@kernel.org> (raw)
In-Reply-To: <20261001130236.106059-4-f@lex.la>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] In this commit only, the interrupt restore lives only in
  phy_detach() (drivers/net/phy/phy_device.c:1969).

--

net: phy: take the interrupt back from the bus on detach

This commit makes phy_detach() restore phydev->irq from the bus table
(mdio.bus->irq[]) when the generic driver was bound by
phy_attach_direct(). It undoes the PHY_POLL substitution done by
phy_probe() for genphy, so that a real driver bound later can use the
interrupt.

> 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: Medium]
This patch only restores the irq in phy_detach(). Is there a second way
out of the genphy bind cycle that still leaves phydev->irq at PHY_POLL?

In phy_attach_direct(), the generic probe and bind failures go straight
to error_module_put. That path never reaches the error label that calls
phy_detach():

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() overwrites the irq before any of its steps that can fail:

drivers/net/phy/phy_device.c:phy_probe() {
    ...
	if (!phy_drv_supports_irq(phydrv) && phy_interrupt_is_valid(phydev))
		phydev->irq = PHY_POLL;
    ...
}

The later steps include get_features, genphy_read_abilities() and
genphy_c45_pma_read_abilities() (all MDIO reads), phy_setup_ports() and
genphy_c45_read_eee_adv(). If one of them fails, or device_bind_driver()
fails, error_module_put clears is_genphy_driven and d->driver but does
not touch phydev->irq. A real driver that binds later would then still
poll, which is the symptom the commit message describes.

The last patch of this series, "net: phy: restore the interrupt when the
generic bind cycle fails", appears to close this gap. It saves
phydev->irq at the start of phy_attach_direct() and restores it under
error_module_put. At this commit on its own, though, the restore covers
only the phy_detach() path.

>  		device_release_driver(&phydev->mdio.dev);
>  		phydev->is_genphy_driven = 0;
>  	}

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261001130236.106059-1-f%40lex.la

  reply	other threads:[~2026-10-05 13:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01 13:02 [PATCH net v13 0/4] net: phy: keep a PHY interrupt across a generic bind cycle Aleksei Sviridkin
2026-10-01 13:02 ` [PATCH net v13 1/4] net: usb: lan78xx: register the PHY interrupt with the MDIO bus Aleksei Sviridkin
2026-10-05 16:52   ` Andrew Lunn
2026-10-01 13:02 ` [PATCH net v13 2/4] net: usb: smsc95xx: " Aleksei Sviridkin
2026-10-05 16:53   ` Andrew Lunn
2026-10-01 13:02 ` [PATCH net v13 3/4] net: phy: take the interrupt back from the bus on detach Aleksei Sviridkin
2026-10-05 13:26   ` netdev-bot+sashiko [this message]
2026-10-05 16:55   ` Andrew Lunn
2026-10-01 13:02 ` [PATCH net v13 4/4] net: phy: restore the interrupt when the generic bind cycle fails Aleksei Sviridkin

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=179120679761.434549.12466957475136887665@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®