diff options
author | Xiongfeng Wang <wangxiongfeng2@huawei.com> | 2023-08-07 15:48:58 +0200 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2023-08-07 23:15:39 +0200 |
commit | 6f7dc3076717d48980d8214eee083ee401fbe66d (patch) | |
tree | 92266b61c479b9f50612bc15137cffa267a6d193 /drivers/pci/iov.c | |
parent | PCI/AER: Use pci_dev_id() to simplify the code (diff) | |
download | linux-6f7dc3076717d48980d8214eee083ee401fbe66d.tar.xz linux-6f7dc3076717d48980d8214eee083ee401fbe66d.zip |
PCI/IOV: Use pci_dev_id() to simplify the code
When we have a struct pci_dev *, use pci_dev_id() instead of manually
composing the ID with PCI_DEVID() from dev->bus->number and dev->devfn.
[bhelgaas: commit log]
Link: https://lore.kernel.org/r/20230807134858.116051-4-wangxiongfeng2@huawei.com
Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/iov.c')
-rw-r--r-- | drivers/pci/iov.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index b2e8322755c1..25dbe85c4217 100644 --- a/drivers/pci/iov.c +++ b/drivers/pci/iov.c @@ -41,8 +41,7 @@ int pci_iov_vf_id(struct pci_dev *dev) return -EINVAL; pf = pci_physfn(dev); - return (((dev->bus->number << 8) + dev->devfn) - - ((pf->bus->number << 8) + pf->devfn + pf->sriov->offset)) / + return (pci_dev_id(dev) - (pci_dev_id(pf) + pf->sriov->offset)) / pf->sriov->stride; } EXPORT_SYMBOL_GPL(pci_iov_vf_id); |