Commit 4773f76b authored by Gavin Shan's avatar Gavin Shan Committed by Michael Ellerman

powerpc/powernv: Simplify pnv_ioda_configure_pe()

Nested if statements are always bad and the patch avoids one by
checking PHB type and bail in advance if necessary.
Signed-off-by: default avatarGavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent b131a842
...@@ -684,26 +684,28 @@ static int pnv_ioda_configure_pe(struct pnv_phb *phb, struct pnv_ioda_pe *pe) ...@@ -684,26 +684,28 @@ static int pnv_ioda_configure_pe(struct pnv_phb *phb, struct pnv_ioda_pe *pe)
phb->ioda.pe_rmap[rid] = pe->pe_number; phb->ioda.pe_rmap[rid] = pe->pe_number;
/* Setup one MVTs on IODA1 */ /* Setup one MVTs on IODA1 */
if (phb->type == PNV_PHB_IODA1) { if (phb->type != PNV_PHB_IODA1) {
pe->mve_number = pe->pe_number; pe->mve_number = 0;
rc = opal_pci_set_mve(phb->opal_id, pe->mve_number, goto out;
pe->pe_number); }
pe->mve_number = pe->pe_number;
rc = opal_pci_set_mve(phb->opal_id, pe->mve_number, pe->pe_number);
if (rc != OPAL_SUCCESS) {
pe_err(pe, "OPAL error %ld setting up MVE %d\n",
rc, pe->mve_number);
pe->mve_number = -1;
} else {
rc = opal_pci_set_mve_enable(phb->opal_id,
pe->mve_number, OPAL_ENABLE_MVE);
if (rc) { if (rc) {
pe_err(pe, "OPAL error %ld setting up MVE %d\n", pe_err(pe, "OPAL error %ld enabling MVE %d\n",
rc, pe->mve_number); rc, pe->mve_number);
pe->mve_number = -1; pe->mve_number = -1;
} else {
rc = opal_pci_set_mve_enable(phb->opal_id,
pe->mve_number, OPAL_ENABLE_MVE);
if (rc) {
pe_err(pe, "OPAL error %ld enabling MVE %d\n",
rc, pe->mve_number);
pe->mve_number = -1;
}
} }
} else if (phb->type == PNV_PHB_IODA2) }
pe->mve_number = 0;
out:
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment