Hi Eric, On Tue, Apr 28, 2015 at 8:07 AM, Eric Snowberg <eric.snowberg@xxxxxxxxxx> wrote: > Add PCI slot numbers within sysfs for sun4v hardware. Larger > sun4v systems contain nested PCI bridges and slots further > down on these bridges were not being populated within sysfs. > Also add AHCI style PCI slot numbers within sysfs for sun4v > hardware since the OF 'slot-names' information is not available > on all sun4v platforms. > > Signed-off-by: Eric Snowberg <eric.snowberg@xxxxxxxxxx> > --- > arch/sparc/kernel/pci.c | 37 +++++++++++++++++++++++++++++++++++++ > 1 files changed, 37 insertions(+), 0 deletions(-) > > diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c > index 6f7251f..3a5c402 100644 > --- a/arch/sparc/kernel/pci.c > +++ b/arch/sparc/kernel/pci.c > @@ -1054,6 +1086,11 @@ static int __init of_pci_slot_init(void) > while ((pbus = pci_find_next_bus(pbus)) != NULL) { > struct device_node *node; > > + if (tlb_type == hypervisor) { > + pci_sun4v_bus_slot_names(pbus); > + continue; > + } > + One last thing: would it be worth it to put the following before the while loop instead of having the test inside it? I dislike invariant tests in loops. (Incremental patch attached) + if (tlb_type == hypervisor) { + while ((pbus = pci_find_next_bus(pbus)) != NULL) + pci_sun4v_bus_slot_names(pbus); + + return 0; + } Thanks, -- Julian Calaby Email: julian.calaby@xxxxxxxxx Profile: http://www.google.com/profiles/julian.calaby/
From 0a9175addfde57ba6d7255a6db0bb65316fd861c Mon Sep 17 00:00:00 2001 From: Julian Calaby <julian.calaby@xxxxxxxxx> Date: Tue, 28 Apr 2015 20:45:49 +1000 Subject: [PATCH] sparc64: pci: Move hypervisor test out of loop Signed-off-by: Julian Calaby <julian.calaby@xxxxxxxxx> --- arch/sparc/kernel/pci.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c index 3a5c402..d5f06bd 100644 --- a/arch/sparc/kernel/pci.c +++ b/arch/sparc/kernel/pci.c @@ -1083,14 +1083,16 @@ static int __init of_pci_slot_init(void) { struct pci_bus *pbus = NULL; + if (tlb_type == hypervisor) { + while ((pbus = pci_find_next_bus(pbus)) != NULL) + pci_sun4v_bus_slot_names(pbus); + + return 0; + } + while ((pbus = pci_find_next_bus(pbus)) != NULL) { struct device_node *node; - if (tlb_type == hypervisor) { - pci_sun4v_bus_slot_names(pbus); - continue; - } - if (pbus->self) { /* PCI->PCI bridge */ node = pbus->self->dev.of_node; -- 2.1.4