powerpc/powernv/npu: Use pci_dev_id() helper

Use new helper pci_dev_id() to simplify the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
This commit is contained in:
Heiner Kallweit 2019-04-24 21:14:25 +02:00 committed by Bjorn Helgaas
parent a195016a59
commit 51c51a48de

View file

@ -1213,8 +1213,7 @@ int pnv_npu2_map_lpar_dev(struct pci_dev *gpdev, unsigned int lparid,
* Currently we only support radix and non-zero LPCR only makes sense * Currently we only support radix and non-zero LPCR only makes sense
* for hash tables so skiboot expects the LPCR parameter to be a zero. * for hash tables so skiboot expects the LPCR parameter to be a zero.
*/ */
ret = opal_npu_map_lpar(nphb->opal_id, ret = opal_npu_map_lpar(nphb->opal_id, pci_dev_id(gpdev), lparid,
PCI_DEVID(gpdev->bus->number, gpdev->devfn), lparid,
0 /* LPCR bits */); 0 /* LPCR bits */);
if (ret) { if (ret) {
dev_err(&gpdev->dev, "Error %d mapping device to LPAR\n", ret); dev_err(&gpdev->dev, "Error %d mapping device to LPAR\n", ret);
@ -1224,7 +1223,7 @@ int pnv_npu2_map_lpar_dev(struct pci_dev *gpdev, unsigned int lparid,
dev_dbg(&gpdev->dev, "init context opalid=%llu msr=%lx\n", dev_dbg(&gpdev->dev, "init context opalid=%llu msr=%lx\n",
nphb->opal_id, msr); nphb->opal_id, msr);
ret = opal_npu_init_context(nphb->opal_id, 0/*__unused*/, msr, ret = opal_npu_init_context(nphb->opal_id, 0/*__unused*/, msr,
PCI_DEVID(gpdev->bus->number, gpdev->devfn)); pci_dev_id(gpdev));
if (ret < 0) if (ret < 0)
dev_err(&gpdev->dev, "Failed to init context: %d\n", ret); dev_err(&gpdev->dev, "Failed to init context: %d\n", ret);
else else
@ -1258,7 +1257,7 @@ int pnv_npu2_unmap_lpar_dev(struct pci_dev *gpdev)
dev_dbg(&gpdev->dev, "destroy context opalid=%llu\n", dev_dbg(&gpdev->dev, "destroy context opalid=%llu\n",
nphb->opal_id); nphb->opal_id);
ret = opal_npu_destroy_context(nphb->opal_id, 0/*__unused*/, ret = opal_npu_destroy_context(nphb->opal_id, 0/*__unused*/,
PCI_DEVID(gpdev->bus->number, gpdev->devfn)); pci_dev_id(gpdev));
if (ret < 0) { if (ret < 0) {
dev_err(&gpdev->dev, "Failed to destroy context: %d\n", ret); dev_err(&gpdev->dev, "Failed to destroy context: %d\n", ret);
return ret; return ret;
@ -1266,8 +1265,7 @@ int pnv_npu2_unmap_lpar_dev(struct pci_dev *gpdev)
/* Set LPID to 0 anyway, just to be safe */ /* Set LPID to 0 anyway, just to be safe */
dev_dbg(&gpdev->dev, "Map LPAR opalid=%llu lparid=0\n", nphb->opal_id); dev_dbg(&gpdev->dev, "Map LPAR opalid=%llu lparid=0\n", nphb->opal_id);
ret = opal_npu_map_lpar(nphb->opal_id, ret = opal_npu_map_lpar(nphb->opal_id, pci_dev_id(gpdev), 0 /*LPID*/,
PCI_DEVID(gpdev->bus->number, gpdev->devfn), 0 /*LPID*/,
0 /* LPCR bits */); 0 /* LPCR bits */);
if (ret) if (ret)
dev_err(&gpdev->dev, "Error %d mapping device to LPAR\n", ret); dev_err(&gpdev->dev, "Error %d mapping device to LPAR\n", ret);