Netdev List
 help / color / mirror / Atom feed
From: Linkui Xiao <xiaolinkui@126.com>
To: andrew@lunn.ch
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, pabeni@redhat.com, rosenp@gmail.com,
	jacob.e.keller@intel.com, daniel.machon@microchip.com,
	chunkeey@gmail.com, kees+treewide@kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	xiaolinkui@kylinos.cn, Linkui Xiao <xiaolinkui@126.com>
Subject: Re: [PATCH net] net: ibm: emac: attach the fixed-link PHY with of_phy_connect()
Date: Mon, 23 Nov 2026 17:10:12 +0800	[thread overview]
Message-ID: <20261123091012.730441-1-xiaolinkui@126.com> (raw)
In-Reply-To: <ef2eb733-4b94-4c2e-9165-0b324733a482@lunn.ch>

Hi Andrew,

Thanks for the review, and for pointing out the missing teardown.

> This commit message is overly verbose and contains a lot of irrelevant
> information.

Agreed. v2 1/2 is three paragraphs: what breaks, why of_phy_connect(), and
why the new phy_disconnect() calls belong in the same change. I dropped the
walk through phy_prepare_data(), the list of other drivers, the archaeology
about 08e39982ef64, and the "no in-tree DTS does this" paragraph. The cover
letter notes the AI assistance per
Documentation/process/generated-content.rst.

> Why is emacs_adjust_link() still called?

of_phy_connect() only stores the handler in phydev->adjust_link, attach
never calls it. The state machine is not started on this path either -
emac_mdio_init_phy() runs only for the phy-handle case - so nothing else
fills in dev->phy, which emac_configure() reads to build MR1. A fixed link
cannot change, so calling it once is enough.

Answering that turned up a second bug. Since d99b408ed8e5 ("net: phy:
fixed_phy: remove not needed initialization of phy_device members") the
phy_device no longer carries the DT status, so that call currently copies
SPEED_UNKNOWN and DUPLEX_UNKNOWN and the MAC is programmed for 10 Mbit/s
half duplex. That is 2/2 of v2, which adds a phy_read_status() after the
attach. emac_mdio_read_link() already does exactly that for the phy-handle
path.

> This last sentence about phy_disconnect() was one of the things i thought
> about while looking at the change, but because the commit messages was so
> long, i had given up reading it....

Fair, and leaving it out was the wrong call: this patch is what creates the
attached state, so it should also tear it down. v2 calls phy_disconnect() in
emac_remove() and at err_detach_tah, and of_phy_deregister_fixed_link() in
both places, plus the connect failure branch. That also fixes the
phy-handle path, which called phy_start() without ever calling phy_stop().
emac_remove() unregisters the netdev first, so detaching without RTNL is
fine.

v2 is posted as a new thread: [PATCH net v2 0/2].

Cross compiled for powerpc with W=1 out of ppc44x_defconfig, clean. No
hardware here, so no runtime test.

Thanks,
Linkui


  reply	other threads:[~2026-11-23  9:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12  7:53 [PATCH net] net: ibm: emac: attach the fixed-link PHY with of_phy_connect() Linkui Xiao
2026-11-13 13:50 ` Andrew Lunn
2026-11-23  9:10   ` Linkui Xiao [this message]
2026-11-16 13:51 ` netdev-bot+sashiko
2026-11-23  9:20   ` Linkui Xiao

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=20261123091012.730441-1-xiaolinkui@126.com \
    --to=xiaolinkui@126.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=chunkeey@gmail.com \
    --cc=daniel.machon@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=kees+treewide@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rosenp@gmail.com \
    --cc=xiaolinkui@kylinos.cn \
    /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