From: Zheng Zengkai Date: Fri, 11 Aug 2023 11:10:57 +0000 (+0800) Subject: PCI/P2PDMA: Use pci_dev_id() to simplify the code X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=0e8207f54cf5902367080a0e648d3adae6c019a1;p=linux.git PCI/P2PDMA: 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 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 Signed-off-by: Bjorn Helgaas Reviewed-by: Logan Gunthorpe --- diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c index 6cd98ffca1984..ec04d0ed157b5 100644 --- a/drivers/pci/p2pdma.c +++ b/drivers/pci/p2pdma.c @@ -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); } /*