diff options
author | Klaus Heinrich Kiwi <klaus@linux.vnet.ibm.com> | 2020-03-05 11:24:56 -0300 |
---|---|---|
committer | Oliver O'Halloran <oohall@gmail.com> | 2020-03-11 17:25:28 +1100 |
commit | b8b1ebc15f1c3eb011491bd10965f64a6a5ba3ab (patch) | |
tree | e5231468f81f8fde2162bf7a7797e520a822cf31 | |
parent | d6ab89dbdbb894e835b08022bf9d46999ffc9df6 (diff) | |
download | skiboot-b8b1ebc15f1c3eb011491bd10965f64a6a5ba3ab.zip skiboot-b8b1ebc15f1c3eb011491bd10965f64a6a5ba3ab.tar.gz skiboot-b8b1ebc15f1c3eb011491bd10965f64a6a5ba3ab.tar.bz2 |
core/pci.c: cleanup pci_add_loc_code()
Minor cleanups to add clarity after commit ab1b05d2
"PCI: create optional loc-code platform callback"
Signed-off-by: Klaus Heinrich Kiwi <klaus@linux.vnet.ibm.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
-rw-r--r-- | core/pci.c | 35 |
1 files changed, 15 insertions, 20 deletions
@@ -1385,42 +1385,37 @@ void pci_std_swizzle_irq_map(struct dt_node *np, static void pci_add_loc_code(struct dt_node *np) { - struct dt_node *p = np->parent; - const char *blcode = NULL; + struct dt_node *p; + const char *lcode = NULL; - while (p) { + for (p = np->parent; p; p = p->parent) { /* prefer slot-label by default */ - blcode = dt_prop_get_def(p, "ibm,slot-label", NULL); - if (blcode) + lcode = dt_prop_get_def(p, "ibm,slot-label", NULL); + if (lcode) break; /* otherwise use the fully qualified location code */ - blcode = dt_prop_get_def(p, "ibm,slot-location-code", NULL); - if (blcode) + lcode = dt_prop_get_def(p, "ibm,slot-location-code", NULL); + if (lcode) break; - - p = p->parent; } - if (!blcode) - blcode = dt_prop_get_def(np, "ibm,slot-location-code", NULL); + if (!lcode) + lcode = dt_prop_get_def(np, "ibm,slot-location-code", NULL); - if (!blcode) { + if (!lcode) { /* Fall back to finding a ibm,loc-code */ - p = np->parent; - - while (p) { - blcode = dt_prop_get_def(p, "ibm,loc-code", NULL); - if (blcode) + for (p = np->parent; p; p = p->parent) { + lcode = dt_prop_get_def(p, "ibm,loc-code", NULL); + if (lcode) break; - p = p->parent; } } - if (!blcode) + if (!lcode) return; - dt_add_property_string(np, "ibm,loc-code", blcode); + dt_add_property_string(np, "ibm,loc-code", lcode); } static void pci_print_summary_line(struct phb *phb, struct pci_device *pd, |