netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Cc: Jim Liu <jim.t90615@gmail.com>,
	JJLIU0@nuvoton.com, florian.fainelli@broadcom.com,
	andrew@lunn.ch, hkallweit1@gmail.com, kuba@kernel.org,
	edumazet@google.com, pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] net: phy: broadcom: Correct BCM5221 PHY model detection failure
Date: Mon, 17 Mar 2025 10:28:33 +0000	[thread overview]
Message-ID: <Z9f5UQPRTPT8lbXm@shell.armlinux.org.uk> (raw)
In-Reply-To: <Z9fhqbfoQGSm1Njx@mev-dev.igk.intel.com>

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!

      reply	other threads:[~2025-03-17 10:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-17  3:50 [PATCH v1] net: phy: broadcom: Correct BCM5221 PHY model detection failure Jim Liu
2025-03-17  8:47 ` Michal Swiatkowski
2025-03-17 10:28   ` Russell King (Oracle) [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=Z9f5UQPRTPT8lbXm@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=JJLIU0@nuvoton.com \
    --cc=andrew@lunn.ch \
    --cc=edumazet@google.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=hkallweit1@gmail.com \
    --cc=jim.t90615@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.swiatkowski@linux.intel.com \
    --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;
as well as URLs for NNTP newsgroup(s).