qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] spapr pci: getting rid of "busname" property


From: Alexey Kardashevskiy
Subject: [Qemu-devel] [PATCH] spapr pci: getting rid of "busname" property
Date: Wed, 20 Feb 2013 18:18:35 +1100

As sPAPRPHBState struct incapsulates DeviceState struct,
the "id" property can be set from the command line.
So there is no need in the "busname" property which is only used
to pass a PCI bus name from the spapr-pci-host-bridge device to
pci_register_bus().

Signed-off-by: Alexey Kardashevskiy <address@hidden>
---
 hw/spapr_pci.c |   13 +++++++------
 hw/spapr_pci.h |    1 -
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/hw/spapr_pci.c b/hw/spapr_pci.c
index a6885c4..45373ec 100644
--- a/hw/spapr_pci.c
+++ b/hw/spapr_pci.c
@@ -519,6 +519,7 @@ static int spapr_phb_init(SysBusDevice *s)
     sPAPRPHBState *sphb = SPAPR_PCI_HOST_BRIDGE(s);
     PCIHostState *phb = PCI_HOST_BRIDGE(s);
     char *namebuf;
+    const char *busname;
     int i;
     PCIBus *bus;
 
@@ -575,9 +576,6 @@ static int spapr_phb_init(SysBusDevice *s)
     }               
 
     sphb->dtbusname = g_strdup_printf("address@hidden" PRIx64, sphb->buid);
-    if (!sphb->busname) {
-        sphb->busname = sphb->dtbusname;
-    }
 
     namebuf = alloca(strlen(sphb->dtbusname) + 32);
 
@@ -621,7 +619,11 @@ static int spapr_phb_init(SysBusDevice *s)
                                     &sphb->msiwindow);
     }
 
-    bus = pci_register_bus(DEVICE(s), sphb->busname,
+    busname = s->qdev.id;
+    if (!busname || !busname[0]) {
+        busname = sphb->dtbusname;
+    }
+    bus = pci_register_bus(DEVICE(s), busname,
                            pci_spapr_set_irq, pci_spapr_map_irq, sphb,
                            &sphb->memspace, &sphb->iospace,
                            PCI_DEVFN(0, 0), PCI_NUM_PINS);
@@ -663,7 +665,6 @@ static void spapr_phb_reset(DeviceState *qdev)
 }
 
 static Property spapr_phb_properties[] = {
-    DEFINE_PROP_STRING("busname", sPAPRPHBState, busname),
     DEFINE_PROP_INT32("index", sPAPRPHBState, index, -1),
     DEFINE_PROP_HEX64("buid", sPAPRPHBState, buid, -1),
     DEFINE_PROP_HEX32("liobn", sPAPRPHBState, dma_liobn, -1),
@@ -750,7 +751,7 @@ PCIHostState *spapr_create_phb(sPAPREnvironment *spapr, int 
index,
 
     dev = qdev_create(NULL, TYPE_SPAPR_PCI_HOST_BRIDGE);
     qdev_prop_set_uint32(dev, "index", index);
-    qdev_prop_set_string(dev, "busname", busname);
+    dev->id = g_strdup(busname);
     qdev_init_nofail(dev);
 
     return PCI_HOST_BRIDGE(dev);
diff --git a/hw/spapr_pci.h b/hw/spapr_pci.h
index b05241d..35960d7 100644
--- a/hw/spapr_pci.h
+++ b/hw/spapr_pci.h
@@ -39,7 +39,6 @@ typedef struct sPAPRPHBState {
 
     int32_t index;
     uint64_t buid;
-    char *busname;
     char *dtbusname;
 
     MemoryRegion memspace, iospace;
-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]