Re: [PATCH net-next 03/12] net: phy: Don't create the sysfs links for PHYs behind a mux
From: Maxime Chevallier
Date: Sun Dec 06 2026 - 09:31:31 EST
On 12/5/26 13:18, netdev-bot+sashiko@xxxxxxxxxx wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential
> issue(s) to consider.
[...]
> [Severity: Medium]
> Does skipping the whole helper also drop the attached_dev link for mux
> PHYs? phy_sysfs_create_links() creates two links:
>
> err = sysfs_create_link(&phydev->mdio.dev.kobj, &dev->dev.kobj,
> "attached_dev");
> ...
> err = sysfs_create_link_nowarn(&dev->dev.kobj,
> &phydev->mdio.dev.kobj,
> "phydev");
>
> The attached_dev link is created under each PHY's own mdio device kobject.
> Several PHYs behind the same mux therefore can't collide on it. Only the
> netdev side "phydev" link can conflict.
>
> Later in the series, phy_mux_attach() calls phy_mux_port_bind_phy(), which
> sets phydev->mux_port, and then calls phy_attach_direct():
>
> ret = phy_mux_port_bind_phy(port);
> ...
> ret = phy_attach_direct(dev, port->phydev, phy_flags,
> port->interface);
>
> phy_attach_direct() still sets phydev->attached_dev = dev and adds the PHY
> to the link topology. Every mux PHY is attached to the netdev, but
> /sys/class/mdio_bus/<bus>/<device>/attached_dev is never created for any
> of them.
>
> Documentation/ABI/testing/sysfs-class-net-phydev describes attached_dev as
> a symbolic link to the network device this PHY device is attached to. It
> makes no exception for muxes. The phydev entry in
> Documentation/ABI/testing/sysfs-class-net doesn't mention the mux case
> either.
>
> Skipping the netdev side phydev link seems fine, because phy_mux_attach()
> sets dev->phydev = NULL anyway.
>
> Would it make sense to keep creating attached_dev for mux PHYs and only
> skip the netdev side link? If not, could the exception be documented in
> the ABI files?
True yeah, I can adddress that, so in sysfs :
- phydev's attached_dev stays
- netdev's phydev disapears.
Maxime