Skip to content

Commit

Permalink
net: smsc: 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 6ecb2ce commit adc4d18
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/net/ethernet/smsc/smsc9420.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit adc4d18

Please sign in to comment.