[Skiboot] [PATCH 8/9] npu2: Remove redundant assignment to p->phb_nvlink.scan_map

Andrew Donnellan andrew.donnellan at au1.ibm.com
Thu Jan 10 11:06:37 AEDT 2019


On 10/1/19 2:58 am, Reza Arbab wrote:
> In npu2_populate_devices(), we do
> 
>      p->phb_nvlink.scan_map |= 0x1 << ((dev->bdfn & 0xf8) >> 3);
>      :
> 
>      dev->nvlink.pvd = pci_virt_add_device(&p->phb_nvlink, dev->bdfn, 0x100, dev);
>      /* At this point, dev->nvlink.pvd->bdfn = dev->bdfn */
> 
>      if (dev->nvlink.pvd) {
>          p->phb_nvlink.scan_map |= 0x1 << ((dev->nvlink.pvd->bdfn & 0xf8) >> 3);
>          :
>      }
> 
> Because dev->nvlink.pvd->bdfn equals dev->bdfn, the second assignment to
> scan_map is redundant. Remove it.
> 
> Signed-off-by: Reza Arbab <arbab at linux.ibm.com>

Reviewed-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>

(though perhaps it makes more sense to get rid of the first scan map 
assignment and leave this one? idk)

> ---
>   hw/npu2.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/hw/npu2.c b/hw/npu2.c
> index 8418e04..68a5382 100644
> --- a/hw/npu2.c
> +++ b/hw/npu2.c
> @@ -1838,11 +1838,8 @@ static void npu2_populate_devices(struct npu2 *p,
>   
>   		/* Initialize PCI virtual device */
>   		dev->nvlink.pvd = pci_virt_add_device(&p->phb_nvlink, dev->bdfn, 0x100, dev);
> -		if (dev->nvlink.pvd) {
> -			p->phb_nvlink.scan_map |=
> -				0x1 << ((dev->nvlink.pvd->bdfn & 0xf8) >> 3);
> +		if (dev->nvlink.pvd)
>   			npu2_populate_cfg(dev);
> -		}
>   
>   		index++;
>   	}
> 

-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan at au1.ibm.com  IBM Australia Limited



More information about the Skiboot mailing list