Netdev List
 help / color / mirror / Atom feed
From: Aleksei Sviridkin <f@lex.la>
To: Andrew Lunn <andrew@lunn.ch>
Cc: hkallweit1@gmail.com, linux@armlinux.org.uk, olteanv@gmail.com,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v4 2/2] net: phy: restore the interrupt after a generic-driver bind cycle
Date: Sat,  5 Sep 2026 00:07:22 +0000	[thread overview]
Message-ID: <20260905000722.422652-1-f@lex.la> (raw)
In-Reply-To: <69f2a065-6855-454a-96cf-1ceb9656369b@lunn.ch>

On Wed, 2 Sep 2026 22:53, Andrew Lunn wrote:
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>

Thanks, but please hold that one. The Sashiko bot pointed at bus->irq[]
afterwards and it is right, so v4 does not do what its changelog says on
a fair number of buses. I would rather tell you before sending a v5 that
changes the approach.

mdiobus_alloc_size() fills the whole table with PHY_POLL, and consumers
that install the interrupt only on the phy_device never touch it.
smsc95xx does "pdata->phydev->irq = phy_irq" and lan78xx does
"phydev->irq = dev->domain_data.phyirq", both without a matching write
to bus->irq[]. There my helper reads PHY_POLL back out and restores
nothing, while the comment I put next to it claims the table still holds
the pre-bind value. Only fwnode_mdio, stmmac_mdio and mlxbf_gige mirror
it, so only they are covered.

The same bot made a second point I cannot argue with: the == PHY_POLL
test cannot tell a bind-installed PHY_POLL from one the caller asked
for. PHY_F_NO_IRQ in phy_attach_direct(), and ixp4xx_eth, ax88796c and
emac-mac after connect, all write it deliberately. On a bus that does
mirror a live interrupt, phy_detach() would hand back a number the board
took out of service.

So the shape I would like to send instead: save phydev->irq in
phy_probe() before it is overwritten, and put it back in phy_remove().
That drops the table as a source, drops the provenance guess, and it is
the symmetric undo, since phy_remove() already reverts other probe-time
state and is reachable through a sysfs unbind that never goes near
phy_detach().

The part I would rather agree with you first is where the saved value
lives. A field in struct phy_device is the obvious answer and also the
most expensive one. Is that acceptable, or would you rather it went
somewhere else?

  reply	other threads:[~2026-09-05  0:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02  8:05 [PATCH net v4 0/2] net: fix a stale phylink PHY pointer and a lost PHY interrupt Aleksei Sviridkin
2026-09-02  8:05 ` [PATCH net v4 1/2] net: phylink: unwind the PHY binding when bringup fails late Aleksei Sviridkin
2026-09-02  8:05 ` [PATCH net v4 2/2] net: phy: restore the interrupt after a generic-driver bind cycle Aleksei Sviridkin
2026-09-02 20:53   ` Andrew Lunn
2026-09-05  0:07     ` Aleksei Sviridkin [this message]
2026-09-04  8:05   ` 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=20260905000722.422652-1-f@lex.la \
    --to=f@lex.la \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --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