netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: phy: Assign the c45 id to phy_id property when matched.
@ 2023-06-12 14:33 Jianhui Zhao
  2023-06-12 15:10 ` Russell King (Oracle)
  2023-06-12 15:37 ` Andrew Lunn
  0 siblings, 2 replies; 3+ messages in thread
From: Jianhui Zhao @ 2023-06-12 14:33 UTC (permalink / raw)
  To: andrew
  Cc: hkallweit1, linux, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel, Jianhui Zhao

If a phydevice use c45, its phy_id property is always 0 previously.
This change make the phy_id property has a valid value assigned from
c45 id.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
---
 drivers/net/phy/phy_device.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 17d0d0555a79..81a4bc043ee2 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -541,8 +541,10 @@ static int phy_bus_match(struct device *dev, struct device_driver *drv)
 
 			if ((phydrv->phy_id & phydrv->phy_id_mask) ==
 			    (phydev->c45_ids.device_ids[i] &
-			     phydrv->phy_id_mask))
+			     phydrv->phy_id_mask)) {
+				phydev->phy_id = phydev->c45_ids.device_ids[i];
 				return 1;
+			}
 		}
 		return 0;
 	} else {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: phy: Assign the c45 id to phy_id property when matched.
  2023-06-12 14:33 [PATCH] net: phy: Assign the c45 id to phy_id property when matched Jianhui Zhao
@ 2023-06-12 15:10 ` Russell King (Oracle)
  2023-06-12 15:37 ` Andrew Lunn
  1 sibling, 0 replies; 3+ messages in thread
From: Russell King (Oracle) @ 2023-06-12 15:10 UTC (permalink / raw)
  To: Jianhui Zhao
  Cc: andrew, hkallweit1, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel

On Mon, Jun 12, 2023 at 10:33:20PM +0800, Jianhui Zhao wrote:
> If a phydevice use c45, its phy_id property is always 0 previously.
> This change make the phy_id property has a valid value assigned from
> c45 id.
> 
> Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>

Please see my replies to your proposal. I don't think this is a good
solution.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: phy: Assign the c45 id to phy_id property when matched.
  2023-06-12 14:33 [PATCH] net: phy: Assign the c45 id to phy_id property when matched Jianhui Zhao
  2023-06-12 15:10 ` Russell King (Oracle)
@ 2023-06-12 15:37 ` Andrew Lunn
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2023-06-12 15:37 UTC (permalink / raw)
  To: Jianhui Zhao
  Cc: hkallweit1, linux, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel

On Mon, Jun 12, 2023 at 10:33:20PM +0800, Jianhui Zhao wrote:
> If a phydevice use c45, its phy_id property is always 0 previously.
> This change make the phy_id property has a valid value assigned from
> c45 id.

It is more than a valid value. It is the ID which was used to match
the device to a driver.

But as Russell pointed out, it is only valid if a match is made. And
if a match is made, you know what driver is loaded via the symlink in
sysfs. The more interesting use case is no match is performed and you
want to figure out why. And for that, you need all the IDs, since any
can be used to match to a driver.

So, back to a directory of all the IDs

I also asked that you update the sysfs documentation. I've asked this
twice now, and you have not done it. A patch will not be accepted
without the sysfs API documentation.

     Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-12 15:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-12 14:33 [PATCH] net: phy: Assign the c45 id to phy_id property when matched Jianhui Zhao
2023-06-12 15:10 ` Russell King (Oracle)
2023-06-12 15:37 ` Andrew Lunn

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).