PCI/P2PDMA: Use pci_dev_id() to simplify the code
authorZheng Zengkai <zhengzengkai@huawei.com>
Fri, 11 Aug 2023 11:10:57 +0000 (19:10 +0800)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 14 Aug 2023 17:05:05 +0000 (12:05 -0500)
When we have a struct pci_dev *, use pci_dev_id() instead of manually
composing the ID from dev->bus->number and dev->devfn.

[bhelgaas: commit log]
Link: https://lore.kernel.org/r/20230811111057.31900-1-zhengzengkai@huawei.com
Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
drivers/pci/p2pdma.c

index 6cd98ffca198406628d57df85577a3c755508704..ec04d0ed157b5a6eefe68e8fc2502aa514606229 100644 (file)
@@ -532,8 +532,7 @@ static bool host_bridge_whitelist(struct pci_dev *a, struct pci_dev *b,
 
 static unsigned long map_types_idx(struct pci_dev *client)
 {
-       return (pci_domain_nr(client->bus) << 16) |
-               (client->bus->number << 8) | client->devfn;
+       return (pci_domain_nr(client->bus) << 16) | pci_dev_id(client);
 }
 
 /*