Re: [PATCH v1] net: phy: broadcom: Correct BCM5221 PHY model detection failure
From: Russell King (Oracle)
Date: Mon Mar 17 2025 - 06:34:45 EST
On Mon, Mar 17, 2025 at 09:47:37AM +0100, Michal Swiatkowski wrote:
> It will be nice to have wider explanation what it is fixing in commit
> message. Is phydev->phy_id different than phydev->driver->phy_id? Looks
> like masking isn't crucial as phydev->driver->phy_id is initialized by
> PHY_ID_BCM5221 which is already masked.
The two are very different, and this driver just gets it totally wrong.
phydev->phy_id is the ID read from the PHY. It includes the revision
field.
phydev->drv is one of the phy_driver entries at the bottom of the file.
These contain whatever the driver author puts there, which in this
case would be PHY_ID_BCM5221, and PHY_ID_BCM5221 is defined without
the revision number.
So doing the masking is entirely redundant if you're comparing the
drv->phy_id that was initialised with a definition against the same
definition.
As pointed out in my review with v2, there's more problems in this
driver _because_ this has not been understood. In an attempt to get
rid of some of this stuff, I introduced phydev_id_compare() and
phy_id_compare() helpers into core phylib code, but didn't get
around to updating broadcom.c. See my comments against v2.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!