mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rosen Penev" <rosenp@gmail.com>
To: "Andrew Lunn" <andrew@lunn.ch>, "Rosen Penev" <rosenp@gmail.com>
Cc: <netdev@vger.kernel.org>, "Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Christian Lamparter" <chunkeey@googlemail.com>,
	"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net] net: emac: release DT PHY resources on teardown
Date: Tue, 20 Oct 2026 20:11:02 -0700	[thread overview]
Message-ID: <DMA6QT4SYA41.3VGVOVAWYQMS6@gmail.com> (raw)
In-Reply-To: <59c8f008-9ca0-4620-9a54-e73da131ab6c@lunn.ch>

On Tue Oct 20, 2026 at 6:05 PM PDT, Andrew Lunn wrote:
> On Tue, Oct 20, 2026 at 03:30:02PM -0700, Rosen Penev wrote:
>> Disconnect PHYLIB PHYs and deregister fixed PHYs during both probe
>> unwind and driver removal. Without this cleanup, unbinding a DT-based
>> EMAC can leave its PHY attached to the freed netdev, while fixed-link
>> instances retain their registered fixed PHY.
>
> This driver is quite convoluted with its PHY handling.
I agree. I got this LLM to convert the whole thing to phylink. It tested
a bunch of stuff over serial and ethernet, which works. That's net-next
material though. It'll probably get rejected.
>
> Please split this into two, phy_disconnect() and
> of_phy_deregister_fixed_link() and add better commit messages.
>
> 	if ((dev->phy_address == 0xffffffff && dev->phy_map == 0xffffffff) ||
> 	    of_phy_is_fixed_link(np)) {
>
> 		/* PHY-less configuration. */
> 		dev->phy.address = -1;
> ...
> 		if (of_phy_is_fixed_link(np)) {
> 			int res = emac_dt_mdio_probe(dev);
>
> 			if (res)
> 				return res;
>
> 			res = of_phy_register_fixed_link(np);
>
> The logic here is more complex than
>
>> +	if (of_phy_is_fixed_link(np))
>> +		of_phy_deregister_fixed_link(np);
>
> So you need to explain in the commit message why it is correct.
>
>> +static void emac_cleanup_phy(struct emac_instance *dev)
>> +{
>> +	struct device_node *np = dev->ofdev->dev.of_node;
>> +
>> +	if (dev->ndev->phydev && dev->phy.address >= 0)
>> +		phy_disconnect(dev->ndev->phydev);
>
> It is also not clear this is correct, since a fixed-link should be
> connected to, yet a fixed link has dev->phy.address == -1?
>
> 	Andrew



      reply	other threads:[~2026-10-21  3:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20 22:30 Rosen Penev
2026-10-20 22:33 ` netdev-bot+sinfo
2026-10-20 22:37   ` Rosen Penev
2026-10-21  0:51     ` Andrew Lunn
2026-10-21  1:05 ` Andrew Lunn
2026-10-21  3:11   ` Rosen Penev [this message]

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=DMA6QT4SYA41.3VGVOVAWYQMS6@gmail.com \
    --to=rosenp@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=chunkeey@googlemail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®