* phb_index is not being used and if required can be obtained from sphb * use helper to get drc_index in this function
Suggested-by: Alexey Kardashevskiy <a...@ozlabs.ru> Signed-off-by: Nikunj A Dadhania <nik...@linux.vnet.ibm.com> --- hw/ppc/spapr_pci.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index a7c17be..0594f38 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -937,14 +937,17 @@ static void populate_resource_props(PCIDevice *d, ResourceProps *rp) rp->assigned_len = assigned_idx * sizeof(ResourceFields); } +static uint32_t spapr_phb_get_pci_drc_index(sPAPRPHBState *phb, + PCIDevice *pdev); + static int spapr_populate_pci_child_dt(PCIDevice *dev, void *fdt, int offset, - int phb_index, int drc_index, sPAPRPHBState *sphb) { ResourceProps rp; bool is_bridge = false; int pci_status, err; char *buf = NULL; + uint32_t drc_index = spapr_phb_get_pci_drc_index(sphb, dev); if (pci_default_read_config(dev, PCI_HEADER_TYPE, 1) == PCI_HEADER_TYPE_BRIDGE) { @@ -1042,9 +1045,6 @@ typedef struct sPAPRFDT { sPAPRPHBState *sphb; } sPAPRFDT; -static uint32_t spapr_phb_get_pci_drc_index(sPAPRPHBState *phb, - PCIDevice *pdev); - /* create OF node for pci device and required OF DT properties */ static int spapr_create_pci_child_dt(PCIDevice *dev, sPAPRFDT *p) { @@ -1052,7 +1052,6 @@ static int spapr_create_pci_child_dt(PCIDevice *dev, sPAPRFDT *p) int slot = PCI_SLOT(dev->devfn); int func = PCI_FUNC(dev->devfn); char nodename[FDT_NAME_MAX]; - uint32_t drc_index = spapr_phb_get_pci_drc_index(p->sphb, dev); if (func != 0) { snprintf(nodename, FDT_NAME_MAX, "pci@%x,%x", slot, func); @@ -1060,8 +1059,7 @@ static int spapr_create_pci_child_dt(PCIDevice *dev, sPAPRFDT *p) snprintf(nodename, FDT_NAME_MAX, "pci@%x", slot); } offset = fdt_add_subnode(p->fdt, p->node_off, nodename); - ret = spapr_populate_pci_child_dt(dev, p->fdt, offset, p->sphb->index, - drc_index, p->sphb); + ret = spapr_populate_pci_child_dt(dev, p->fdt, offset, p->sphb); g_assert(!ret); if (ret) { return 0; -- 1.8.3.1