netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: txgbe: Simplify code with pci_dev_id()
@ 2024-09-03  7:23 Zhang Zekun
  2024-09-04 23:35 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang Zekun @ 2024-09-03  7:23 UTC (permalink / raw)
  To: jiawenwu, mengyuanlou, avem, netdev; +Cc: zhangzekun11

Use pci_dev_id() to get the BDF number of a pci device, and we don't
calculate it manually. This can simplify the code a bit.

Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
---
 drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
index 5f502265f0a6..e8e293b1dd61 100644
--- a/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
+++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
@@ -689,7 +689,7 @@ static int txgbe_ext_phy_init(struct txgbe *txgbe)
 	mii_bus->phy_mask = GENMASK(31, 1);
 	mii_bus->priv = wx;
 	snprintf(mii_bus->id, MII_BUS_ID_SIZE, "txgbe-%x",
-		 (pdev->bus->number << 8) | pdev->devfn);
+		 pci_dev_id(pdev));
 
 	ret = devm_mdiobus_register(&pdev->dev, mii_bus);
 	if (ret) {
-- 
2.17.1


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

end of thread, other threads:[~2024-09-04 23:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-03  7:23 [PATCH net-next] net: txgbe: Simplify code with pci_dev_id() Zhang Zekun
2024-09-04 23:35 ` Jakub Kicinski

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