]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: txgbe: use pci_dev_id() helper
authorYu Liao <liaoyu15@huawei.com>
Mon, 26 Aug 2024 01:21:00 +0000 (09:21 +0800)
committerJakub Kicinski <kuba@kernel.org>
Tue, 27 Aug 2024 21:20:13 +0000 (14:20 -0700)
PCI core API pci_dev_id() can be used to get the BDF number for a PCI
device. We don't need to compose it manually. Use pci_dev_id() to
simplify the code a little bit.

Signed-off-by: Yu Liao <liaoyu15@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20240826012100.3975175-1-liaoyu15@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c

index 5f502265f0a63ea658ca45d003fb8743e3fb8ff7..67b61afdde96ce31256196265e83b1c90b3a25ce 100644 (file)
@@ -688,8 +688,7 @@ static int txgbe_ext_phy_init(struct txgbe *txgbe)
        mii_bus->parent = &pdev->dev;
        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);
+       snprintf(mii_bus->id, MII_BUS_ID_SIZE, "txgbe-%x", pci_dev_id(pdev));
 
        ret = devm_mdiobus_register(&pdev->dev, mii_bus);
        if (ret) {