[Very RFC 36/46] powernv/npu: Remove open-coded PE lookup for GPU device

Alexey Kardashevskiy aik at ozlabs.ru
Wed Nov 27 16:45:31 AEDT 2019



On 20/11/2019 12:28, Oliver O'Halloran wrote:
> Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
> ---
>  arch/powerpc/platforms/powernv/npu-dma.c | 13 ++-----------
>  1 file changed, 2 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/npu-dma.c b/arch/powerpc/platforms/powernv/npu-dma.c
> index b95b9e3c4c98..68bfaef44862 100644
> --- a/arch/powerpc/platforms/powernv/npu-dma.c
> +++ b/arch/powerpc/platforms/powernv/npu-dma.c
> @@ -97,25 +97,16 @@ EXPORT_SYMBOL(pnv_pci_get_npu_dev);
>  static struct pnv_ioda_pe *get_gpu_pci_dev_and_pe(struct pnv_ioda_pe *npe,
>  						  struct pci_dev **gpdev)
>  {
> -	struct pnv_phb *phb;
> -	struct pci_controller *hose;
>  	struct pci_dev *pdev;
>  	struct pnv_ioda_pe *pe;
> -	struct pci_dn *pdn;
>  
>  	pdev = pnv_pci_get_gpu_dev(npe->pdev);
>  	if (!pdev)
>  		return NULL;
>  
> -	pdn = pci_get_pdn(pdev);
> -	if (WARN_ON(!pdn || pdn->pe_number == IODA_INVALID_PE))
> -		return NULL;
> -
> -	hose = pci_bus_to_host(pdev->bus);
> -	phb = hose->private_data;
> -	pe = &phb->ioda.pe_array[pdn->pe_number];
> +	pe = pnv_ioda_get_pe(pdev);
>  
> -	if (gpdev)
> +	if (pe && pdev)


s/pdev/gpdev/



>  		*gpdev = pdev;
>  
>  	return pe;
> 

-- 
Alexey


More information about the Linuxppc-dev mailing list