summaryrefslogtreecommitdiff
path: root/hw/pci.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-12-09 10:51:49 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2012-02-03 10:41:04 -0600
commit4be9f0d11cf2dbb1eb3f55b33c87d6df3aa7d578 (patch)
tree63f72eaf204e81336e4ab4341a10eaf6147c5f68 /hw/pci.c
parentba02430f1a681173cff5336c626d6edc5ea268db (diff)
downloadqemu-4be9f0d11cf2dbb1eb3f55b33c87d6df3aa7d578.tar.gz
qdev: make DeviceInfo private
Introduce accessors and remove any code that directly accesses DeviceInfo members. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/pci.c')
-rw-r--r--hw/pci.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/hw/pci.c b/hw/pci.c
index 6a0b1f512d..235ea001a9 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -1673,6 +1673,7 @@ static int pci_add_option_rom(PCIDevice *pdev, bool is_default_rom)
char *path;
void *ptr;
char name[32];
+ const VMStateDescription *vmsd;
if (!pdev->romfile)
return 0;
@@ -1709,10 +1710,13 @@ static int pci_add_option_rom(PCIDevice *pdev, bool is_default_rom)
size = 1 << qemu_fls(size);
}
- if (qdev_get_info(&pdev->qdev)->vmsd)
- snprintf(name, sizeof(name), "%s.rom", qdev_get_info(&pdev->qdev)->vmsd->name);
- else
+ vmsd = qdev_get_vmsd(DEVICE(pdev));
+
+ if (vmsd) {
+ snprintf(name, sizeof(name), "%s.rom", vmsd->name);
+ } else {
snprintf(name, sizeof(name), "%s.rom", object_get_typename(OBJECT(pdev)));
+ }
pdev->has_rom = true;
memory_region_init_ram(&pdev->rom, name, size);
vmstate_register_ram(&pdev->rom, &pdev->qdev);
@@ -1953,8 +1957,7 @@ static int pci_qdev_find_recursive(PCIBus *bus,
}
/* roughly check if given qdev is pci device */
- if (qdev_get_info(qdev)->init == &pci_qdev_init &&
- qdev->parent_bus->info == &pci_bus_info) {
+ if (object_dynamic_cast(OBJECT(qdev), TYPE_PCI_DEVICE)) {
*pdev = PCI_DEVICE(qdev);
return 0;
}