netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: Synchronize c45_ids to phy_id
@ 2025-05-22 13:19 Yajun Deng
  2025-05-22 13:26 ` Russell King (Oracle)
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Yajun Deng @ 2025-05-22 13:19 UTC (permalink / raw)
  To: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni
  Cc: netdev, linux-kernel, Yajun Deng

The phy_id_show() function emit the phy_id for the phy device. If the phy
device is a c45 device, the phy_id is empty. In other words, phy_id_show()
only works with the c22 device.

Synchronize c45_ids to phy_id, phy_id_show() will work with both the c22
and c45 devices.

Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
 drivers/net/phy/phy_device.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 2eb735e68dd8..6fed3e84e1a6 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -690,8 +690,12 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id,
 	dev->pma_extable = -ENODATA;
 	dev->is_c45 = is_c45;
 	dev->phy_id = phy_id;
-	if (c45_ids)
+	if (c45_ids) {
 		dev->c45_ids = *c45_ids;
+		dev->phy_id = dev->c45_ids.device_ids[MDIO_MMD_PMAPMD];
+		if (!dev->phy_id)
+			dev->phy_id = dev->c45_ids.device_ids[MDIO_MMD_PCS];
+	}
 	dev->irq = bus->irq[addr];
 
 	dev_set_name(&mdiodev->dev, PHY_ID_FMT, bus->id, addr);
-- 
2.25.1


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

end of thread, other threads:[~2025-05-28  6:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-22 13:19 [PATCH net-next] net: phy: Synchronize c45_ids to phy_id Yajun Deng
2025-05-22 13:26 ` Russell King (Oracle)
2025-05-22 13:39 ` Andrew Lunn
2025-05-23  2:10   ` Yajun Deng
2025-05-23 13:03     ` Andrew Lunn
2025-05-23 17:39       ` Russell King (Oracle)
2025-05-23 17:37     ` Russell King (Oracle)
2025-05-24  1:36       ` Yajun Deng
2025-05-28  6:35 ` kernel test robot

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