Skip to content

Commit

Permalink
net: ngbe: use pci_dev_id() to simplify the code
Browse files Browse the repository at this point in the history
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: Zheng Zengkai <zhengzengkai@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Zheng Zengkai authored and David S. Miller committed Aug 13, 2023
1 parent ca51d13 commit cf9b107
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/net/ethernet/wangxun/ngbe/ngbe_mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,7 @@ int ngbe_mdio_init(struct wx *wx)
mii_bus->write_c45 = ngbe_phy_write_reg_mdi_c45;
}

snprintf(mii_bus->id, MII_BUS_ID_SIZE, "ngbe-%x",
(pdev->bus->number << 8) | pdev->devfn);
snprintf(mii_bus->id, MII_BUS_ID_SIZE, "ngbe-%x", pci_dev_id(pdev));
ret = devm_mdiobus_register(&pdev->dev, mii_bus);
if (ret)
return ret;
Expand Down

0 comments on commit cf9b107

Please sign in to comment.