Commit 6ecb2ced authored by Zheng Zengkai's avatar Zheng Zengkai Committed by David S. Miller

tg3: Use pci_dev_id() to simplify the code

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: default avatarZheng Zengkai <zhengzengkai@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fcbb7974
...@@ -1539,8 +1539,7 @@ static int tg3_mdio_init(struct tg3 *tp) ...@@ -1539,8 +1539,7 @@ static int tg3_mdio_init(struct tg3 *tp)
return -ENOMEM; return -ENOMEM;
tp->mdio_bus->name = "tg3 mdio bus"; tp->mdio_bus->name = "tg3 mdio bus";
snprintf(tp->mdio_bus->id, MII_BUS_ID_SIZE, "%x", snprintf(tp->mdio_bus->id, MII_BUS_ID_SIZE, "%x", pci_dev_id(tp->pdev));
(tp->pdev->bus->number << 8) | tp->pdev->devfn);
tp->mdio_bus->priv = tp; tp->mdio_bus->priv = tp;
tp->mdio_bus->parent = &tp->pdev->dev; tp->mdio_bus->parent = &tp->pdev->dev;
tp->mdio_bus->read = &tg3_mdio_read; tp->mdio_bus->read = &tg3_mdio_read;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment