linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ocxl: Use pci_dev_id() to simplify the code
@ 2023-08-11 10:20 Zheng Zengkai
  2023-08-11 13:00 ` Frederic Barrat
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Zheng Zengkai @ 2023-08-11 10:20 UTC (permalink / raw)
  To: fbarrat, ajd, mpe, npiggin, christophe.leroy
  Cc: linuxppc-dev, 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 mannually. Use pci_dev_id() to
simplify the code a little bit.

Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com>
---
 arch/powerpc/platforms/powernv/ocxl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/powernv/ocxl.c b/arch/powerpc/platforms/powernv/ocxl.c
index 629067781cec..64a9c7125c29 100644
--- a/arch/powerpc/platforms/powernv/ocxl.c
+++ b/arch/powerpc/platforms/powernv/ocxl.c
@@ -449,7 +449,7 @@ int pnv_ocxl_spa_setup(struct pci_dev *dev, void *spa_mem, int PE_mask,
 	if (!data)
 		return -ENOMEM;
 
-	bdfn = (dev->bus->number << 8) | dev->devfn;
+	bdfn = pci_dev_id(dev);
 	rc = opal_npu_spa_setup(phb->opal_id, bdfn, virt_to_phys(spa_mem),
 				PE_mask);
 	if (rc) {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ocxl: Use pci_dev_id() to simplify the code
  2023-08-11 10:20 [PATCH] ocxl: Use pci_dev_id() to simplify the code Zheng Zengkai
@ 2023-08-11 13:00 ` Frederic Barrat
  2023-08-14  7:07 ` Andrew Donnellan
  2023-08-23 11:55 ` Michael Ellerman
  2 siblings, 0 replies; 4+ messages in thread
From: Frederic Barrat @ 2023-08-11 13:00 UTC (permalink / raw)
  To: Zheng Zengkai, ajd, mpe, npiggin, christophe.leroy
  Cc: linuxppc-dev, wangxiongfeng2



On 11/08/2023 12:20, 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 mannually. Use pci_dev_id() to
> simplify the code a little bit.
> 
> Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com>
> ---

LGTM
Acked-by: Frederic Barrat <fbarrat@linux.ibm.com>

   Fred


>   arch/powerpc/platforms/powernv/ocxl.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/ocxl.c b/arch/powerpc/platforms/powernv/ocxl.c
> index 629067781cec..64a9c7125c29 100644
> --- a/arch/powerpc/platforms/powernv/ocxl.c
> +++ b/arch/powerpc/platforms/powernv/ocxl.c
> @@ -449,7 +449,7 @@ int pnv_ocxl_spa_setup(struct pci_dev *dev, void *spa_mem, int PE_mask,
>   	if (!data)
>   		return -ENOMEM;
>   
> -	bdfn = (dev->bus->number << 8) | dev->devfn;
> +	bdfn = pci_dev_id(dev);
>   	rc = opal_npu_spa_setup(phb->opal_id, bdfn, virt_to_phys(spa_mem),
>   				PE_mask);
>   	if (rc) {

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ocxl: Use pci_dev_id() to simplify the code
  2023-08-11 10:20 [PATCH] ocxl: Use pci_dev_id() to simplify the code Zheng Zengkai
  2023-08-11 13:00 ` Frederic Barrat
@ 2023-08-14  7:07 ` Andrew Donnellan
  2023-08-23 11:55 ` Michael Ellerman
  2 siblings, 0 replies; 4+ messages in thread
From: Andrew Donnellan @ 2023-08-14  7:07 UTC (permalink / raw)
  To: Zheng Zengkai, fbarrat, mpe, npiggin, christophe.leroy
  Cc: linuxppc-dev, wangxiongfeng2

On Fri, 2023-08-11 at 18:20 +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 mannually. Use pci_dev_id() to
> simplify the code a little bit.
> 
> Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com>

Acked-by: Andrew Donnellan <ajd@linux.ibm.com>

-- 
Andrew Donnellan    OzLabs, ADL Canberra
ajd@linux.ibm.com   IBM Australia Limited

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ocxl: Use pci_dev_id() to simplify the code
  2023-08-11 10:20 [PATCH] ocxl: Use pci_dev_id() to simplify the code Zheng Zengkai
  2023-08-11 13:00 ` Frederic Barrat
  2023-08-14  7:07 ` Andrew Donnellan
@ 2023-08-23 11:55 ` Michael Ellerman
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2023-08-23 11:55 UTC (permalink / raw)
  To: fbarrat, ajd, npiggin, christophe.leroy, Zheng Zengkai
  Cc: linuxppc-dev, wangxiongfeng2

On Fri, 11 Aug 2023 18:20:39 +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 mannually. Use pci_dev_id() to
> simplify the code a little bit.
> 
> 

Applied to powerpc/next.

[1/1] ocxl: Use pci_dev_id() to simplify the code
      https://git.kernel.org/powerpc/c/075a88d5eb2806712c64bed98c30b6890ec30311

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-23 12:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-11 10:20 [PATCH] ocxl: Use pci_dev_id() to simplify the code Zheng Zengkai
2023-08-11 13:00 ` Frederic Barrat
2023-08-14  7:07 ` Andrew Donnellan
2023-08-23 11:55 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).