* [PATCH -next] PCI/P2PDMA: Use pci_dev_id() to simplify the code
@ 2023-08-11 11:10 Zheng Zengkai
2023-08-11 16:46 ` Bjorn Helgaas
2023-08-14 16:09 ` Logan Gunthorpe
0 siblings, 2 replies; 3+ messages in thread
From: Zheng Zengkai @ 2023-08-11 11:10 UTC (permalink / raw)
To: bhelgaas, logang; +Cc: linux-pci, wangxiongfeng2, zhengzengkai
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>
---
drivers/pci/p2pdma.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
index 6cd98ffca198..ec04d0ed157b 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);
}
/*
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH -next] PCI/P2PDMA: Use pci_dev_id() to simplify the code
2023-08-11 11:10 [PATCH -next] PCI/P2PDMA: Use pci_dev_id() to simplify the code Zheng Zengkai
@ 2023-08-11 16:46 ` Bjorn Helgaas
2023-08-14 16:09 ` Logan Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2023-08-11 16:46 UTC (permalink / raw)
To: Zheng Zengkai; +Cc: bhelgaas, logang, linux-pci, wangxiongfeng2
On Fri, Aug 11, 2023 at 07:10:57PM +0800, Zheng Zengkai wrote:
> 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>
Applied to pci/misc for v6.6, thanks!
> ---
> drivers/pci/p2pdma.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
> index 6cd98ffca198..ec04d0ed157b 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);
> }
>
> /*
> --
> 2.20.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH -next] PCI/P2PDMA: Use pci_dev_id() to simplify the code
2023-08-11 11:10 [PATCH -next] PCI/P2PDMA: Use pci_dev_id() to simplify the code Zheng Zengkai
2023-08-11 16:46 ` Bjorn Helgaas
@ 2023-08-14 16:09 ` Logan Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Logan Gunthorpe @ 2023-08-14 16:09 UTC (permalink / raw)
To: Zheng Zengkai, bhelgaas; +Cc: linux-pci, wangxiongfeng2
On 2023-08-11 05:10, Zheng Zengkai wrote:
> 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>
> ---
> drivers/pci/p2pdma.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
> index 6cd98ffca198..ec04d0ed157b 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);
> }
>
> /*
Looks good to me, thanks!
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Logan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-14 16:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-11 11:10 [PATCH -next] PCI/P2PDMA: Use pci_dev_id() to simplify the code Zheng Zengkai
2023-08-11 16:46 ` Bjorn Helgaas
2023-08-14 16:09 ` Logan Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox