[Very RFC 39/46] powernv/npu: Avoid pci_dn when mapping device_node to a pci_dev

Alexey Kardashevskiy aik at ozlabs.ru
Wed Nov 27 17:58:43 AEDT 2019



On 20/11/2019 12:28, Oliver O'Halloran wrote:
> There's no need to use the pci_dn to find a device_node from a pci_dev.
> Just search for the node pointed to by the pci_dev's of_node pointer.



Reviewed-by: Alexey Kardashevskiy <aik at ozlabs.ru>



> 
> Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
> ---
>  arch/powerpc/platforms/powernv/npu-dma.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/npu-dma.c b/arch/powerpc/platforms/powernv/npu-dma.c
> index 68bfaef44862..72d3749da02c 100644
> --- a/arch/powerpc/platforms/powernv/npu-dma.c
> +++ b/arch/powerpc/platforms/powernv/npu-dma.c
> @@ -21,11 +21,11 @@
>  
>  static struct pci_dev *get_pci_dev(struct device_node *dn)
>  {
> -	struct pci_dn *pdn = PCI_DN(dn);
> -	struct pci_dev *pdev;
> +	struct pci_dev *pdev = NULL;
>  
> -	pdev = pci_get_domain_bus_and_slot(pci_domain_nr(pdn->phb->bus),
> -					   pdn->busno, pdn->devfn);
> +	for_each_pci_dev(pdev)
> +		if (pdev->dev.of_node == dn)
> +			break;
>  
>  	/*
>  	 * pci_get_domain_bus_and_slot() increased the reference count of
> 

-- 
Alexey


More information about the Linuxppc-dev mailing list