Skip to content

Commit 6f7dc30

Browse files
fenghusthubjorn-helgaas
authored andcommitted
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>
1 parent f7f7c3d commit 6f7dc30

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/pci/iov.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ int pci_iov_vf_id(struct pci_dev *dev)
4141
return -EINVAL;
4242

4343
pf = pci_physfn(dev);
44-
return (((dev->bus->number << 8) + dev->devfn) -
45-
((pf->bus->number << 8) + pf->devfn + pf->sriov->offset)) /
44+
return (pci_dev_id(dev) - (pci_dev_id(pf) + pf->sriov->offset)) /
4645
pf->sriov->stride;
4746
}
4847
EXPORT_SYMBOL_GPL(pci_iov_vf_id);

0 commit comments

Comments
 (0)