[PATCH] ocxl: Use pci_dev_id() to simplify the code

Frederic Barrat fbarrat at linux.ibm.com
Fri Aug 11 23:00:28 AEST 2023



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 at huawei.com>
> ---

LGTM
Acked-by: Frederic Barrat <fbarrat at 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) {


More information about the Linuxppc-dev mailing list