diff mbox

[v2,06/26] q35: use type-safe cast instead of directly access of parent dev

Message ID 51D9F41C.4000200@suse.de
State New
Headers show

Commit Message

Andreas Färber July 7, 2013, 11:05 p.m. UTC
Am 01.07.2013 12:18, schrieb Hu Tao:
> And remove variables if possible.
> 
> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
> ---
>  hw/pci-host/q35.c | 35 ++++++++++++++++++-----------------
>  1 file changed, 18 insertions(+), 17 deletions(-)

Thanks, converted the remaining ones as attached and queued on qom-next:
https://github.com/afaerber/qemu-cpu/commits/qom-next

Do note that we will need to later touch the PCIBus again to use
pci_bus_new_inplace().

Andreas
diff mbox

Patch

diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 480d981..bdac09e 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -59,7 +59,7 @@  static void pc_q35_init(QEMUMachineInitArgs *args)
     const char *boot_device = args->boot_device;
     ram_addr_t below_4g_mem_size, above_4g_mem_size;
     Q35PCIHost *q35_host;
-    PCIDevice *q35_pci;
+    PCIHostState *phb;
     PCIBus *host_bus;
     PCIDevice *lpc;
     BusState *idebus[MAX_SATA_PORTS];
@@ -134,8 +134,8 @@  static void pc_q35_init(QEMUMachineInitArgs *args)
     q35_host->mch.above_4g_mem_size = above_4g_mem_size;
     /* pci */
     qdev_init_nofail(DEVICE(q35_host));
-    q35_pci = PCI_DEVICE(q35_host);
-    host_bus = q35_pci->bus;
+    phb = PCI_HOST_BRIDGE(q35_host);
+    host_bus = phb->bus;
     /* create ISA bus */
     lpc = pci_create_simple_multifunction(host_bus, PCI_DEVFN(ICH9_LPC_DEV,
                                           ICH9_LPC_FUNC), true,