Re: [PATCH v2 10/50] dino: return PCIBus from dino_init() using qdev_get_child_bus()
On 5/4/22 02:25, Mark Cave-Ayland wrote: This allows access to the PCI bus without having to reference parent_obj directly. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller --- hw/hppa/dino.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/hppa/dino.c b/hw/hppa/dino.c index 77b8089664..d89b48493f 100644 --- a/hw/hppa/dino.c +++ b/hw/hppa/dino.c @@ -523,14 +523,12 @@ PCIBus *dino_init(MemoryRegion *addr_space, { DeviceState *dev; DinoState *s; -PCIBus *b; +PCIBus *pci_bus; dev = qdev_new(TYPE_DINO_PCI_HOST_BRIDGE); object_property_set_link(OBJECT(dev), "memory-as", OBJECT(addr_space), _fatal); s = DINO_PCI_HOST_BRIDGE(dev); - -b = s->parent_obj.bus; sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), _fatal); memory_region_add_subregion(addr_space, DINO_HPA, @@ -539,7 +537,8 @@ PCIBus *dino_init(MemoryRegion *addr_space, *p_rtc_irq = qemu_allocate_irq(dino_set_timer_irq, s, 0); *p_ser_irq = qemu_allocate_irq(dino_set_serial_irq, s, 0); -return b; +pci_bus = PCI_BUS(qdev_get_child_bus(dev, "pci")); +return pci_bus; } static void dino_pcihost_reset(DeviceState *dev) Reviewed-by: Richard Henderson r~
[PATCH v2 10/50] dino: return PCIBus from dino_init() using qdev_get_child_bus()
This allows access to the PCI bus without having to reference parent_obj directly. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller --- hw/hppa/dino.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/hppa/dino.c b/hw/hppa/dino.c index 77b8089664..d89b48493f 100644 --- a/hw/hppa/dino.c +++ b/hw/hppa/dino.c @@ -523,14 +523,12 @@ PCIBus *dino_init(MemoryRegion *addr_space, { DeviceState *dev; DinoState *s; -PCIBus *b; +PCIBus *pci_bus; dev = qdev_new(TYPE_DINO_PCI_HOST_BRIDGE); object_property_set_link(OBJECT(dev), "memory-as", OBJECT(addr_space), _fatal); s = DINO_PCI_HOST_BRIDGE(dev); - -b = s->parent_obj.bus; sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), _fatal); memory_region_add_subregion(addr_space, DINO_HPA, @@ -539,7 +537,8 @@ PCIBus *dino_init(MemoryRegion *addr_space, *p_rtc_irq = qemu_allocate_irq(dino_set_timer_irq, s, 0); *p_ser_irq = qemu_allocate_irq(dino_set_serial_irq, s, 0); -return b; +pci_bus = PCI_BUS(qdev_get_child_bus(dev, "pci")); +return pci_bus; } static void dino_pcihost_reset(DeviceState *dev) -- 2.20.1