summary refs log tree commit diff stats
path: root/hw/pci.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-09-15 19:23:25 +0000
committerBlue Swirl <blauwirbel@gmail.com>2009-09-15 19:23:25 +0000
commit71077c1cb07c9c73ec279c119d526d2600132ac9 (patch)
treea9b920c37becaff3e372b1835e1264a28127eb29 /hw/pci.c
parentffabf0371832aa398f647bc18b4d3c50609c1493 (diff)
downloadfocaccia-qemu-71077c1cb07c9c73ec279c119d526d2600132ac9.tar.gz
focaccia-qemu-71077c1cb07c9c73ec279c119d526d2600132ac9.zip
qdev/pci: add pci_create_noinit()
Like pci_create_simple() but doesn't call qdev_init(), so one can
set properties before initializing the device.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw/pci.c')
-rw-r--r--hw/pci.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/hw/pci.c b/hw/pci.c
index c12b0beaae..64d70ed237 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -923,15 +923,20 @@ void pci_qdev_register_many(PCIDeviceInfo *info)
     }
 }
 
-PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)
+PCIDevice *pci_create_noinit(PCIBus *bus, int devfn, const char *name)
 {
     DeviceState *dev;
 
     dev = qdev_create(&bus->qbus, name);
     qdev_prop_set_uint32(dev, "addr", devfn);
-    qdev_init(dev);
+    return DO_UPCAST(PCIDevice, qdev, dev);
+}
 
-    return (PCIDevice *)dev;
+PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)
+{
+    PCIDevice *dev = pci_create_noinit(bus, devfn, name);
+    qdev_init(&dev->qdev);
+    return dev;
 }
 
 static int pci_find_space(PCIDevice *pdev, uint8_t size)