qemu-devel
[Top][All Lists]
Advanced

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

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


From: Alexey Kardashevskiy
Subject: [Qemu-devel] [PATCH] spapr pci: get rid of "busname" property
Date: Thu, 28 Feb 2013 14:05:26 +1100

As the sPAPRPHBState struct includes the DeviceState struct which
already has an "id" propetry, and this property can be set from
the command line, there is no need in an additional "busname"
property to specify a bus name. So the bus device "id" property can
be used to name a bus.

The patch removes the "busname" property from sPAPR PHB device.

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 d017d5a..888c907 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, sphb->dtbusname,
+    busname = s->qdev.id;
+    if (!busname || !busname[0]) {
+        busname = sphb->dtbusname;
+    }
+    bus = pci_register_bus(DEVICE(s), busname, sphb->dtbusname,
                            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 0749fee..3eecc6d 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]