summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/smsc
diff options
context:
space:
mode:
authorZheng Zengkai <zhengzengkai@huawei.com>2023-08-11 13:07:00 +0200
committerDavid S. Miller <davem@davemloft.net>2023-08-13 13:30:39 +0200
commitadc4d18538ec5e7ae44323130257c2ba47da2d57 (patch)
treecfd764012313eb46a8b8ec1aa32b187341b37c8f /drivers/net/ethernet/smsc
parenttg3: Use pci_dev_id() to simplify the code (diff)
downloadlinux-adc4d18538ec5e7ae44323130257c2ba47da2d57.tar.xz
linux-adc4d18538ec5e7ae44323130257c2ba47da2d57.zip
net: smsc: 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: Zheng Zengkai <zhengzengkai@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/smsc')
-rw-r--r--drivers/net/ethernet/smsc/smsc9420.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/net/ethernet/smsc/smsc9420.c b/drivers/net/ethernet/smsc/smsc9420.c
index 3b26f1d86beb..e1c4a11c1f18 100644
--- a/drivers/net/ethernet/smsc/smsc9420.c
+++ b/drivers/net/ethernet/smsc/smsc9420.c
@@ -1144,8 +1144,7 @@ static int smsc9420_mii_init(struct net_device *dev)
goto err_out_1;
}
pd->mii_bus->name = DRV_MDIONAME;
- snprintf(pd->mii_bus->id, MII_BUS_ID_SIZE, "%x",
- (pd->pdev->bus->number << 8) | pd->pdev->devfn);
+ snprintf(pd->mii_bus->id, MII_BUS_ID_SIZE, "%x", pci_dev_id(pd->pdev));
pd->mii_bus->priv = pd;
pd->mii_bus->read = smsc9420_mii_read;
pd->mii_bus->write = smsc9420_mii_write;