[Skiboot] [PATCH] core/pci.c: cleanup pci_add_loc_code()
Klaus Heinrich Kiwi
klaus at linux.vnet.ibm.com
Fri Mar 6 01:24:56 AEDT 2020
Minor cleanups to add clarity after commit ab1b05d2
"PCI: create optional loc-code platform callback"
Signed-off-by: Klaus Heinrich Kiwi <klaus at linux.vnet.ibm.com>
---
core/pci.c | 35 +++++++++++++++--------------------
1 file changed, 15 insertions(+), 20 deletions(-)
diff --git a/core/pci.c b/core/pci.c
index d211207b..cc7353be 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -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,
--
2.17.1
More information about the Skiboot
mailing list