aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-06-07 13:49:13 +0200
committerAndreas Färber <afaerber@suse.de>2013-06-07 14:55:33 +0200
commit4a17cc4f285d7ffe41847bf728cd88c736237416 (patch)
tree8660ca33cdb5f9852502a9287587ff27b5a529bc /hw
parent2ae0e48d5fd2cb7c5bc5c392edf2dc33ac2959d0 (diff)
isa: QOM'ify ISADevice
Rename its parent field and use DEVICE() where necessary. Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw')
-rw-r--r--hw/block/fdc.c16
-rw-r--r--hw/char/serial-isa.c14
-rw-r--r--hw/i386/pc.c9
-rw-r--r--hw/i386/pc_piix.c2
-rw-r--r--hw/intc/i8259_common.c22
-rw-r--r--hw/isa/i82378.c2
-rw-r--r--hw/isa/isa-bus.c4
-rw-r--r--hw/ppc/prep.c5
8 files changed, 41 insertions, 33 deletions
diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index 79ea625485..930f191d9e 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -2022,22 +2022,24 @@ static int fdctrl_connect_drives(FDCtrl *fdctrl)
ISADevice *fdctrl_init_isa(ISABus *bus, DriveInfo **fds)
{
- ISADevice *dev;
+ DeviceState *dev;
+ ISADevice *isadev;
- dev = isa_try_create(bus, TYPE_ISA_FDC);
- if (!dev) {
+ isadev = isa_try_create(bus, TYPE_ISA_FDC);
+ if (!isadev) {
return NULL;
}
+ dev = DEVICE(isadev);
if (fds[0]) {
- qdev_prop_set_drive_nofail(&dev->qdev, "driveA", fds[0]->bdrv);
+ qdev_prop_set_drive_nofail(dev, "driveA", fds[0]->bdrv);
}
if (fds[1]) {
- qdev_prop_set_drive_nofail(&dev->qdev, "driveB", fds[1]->bdrv);
+ qdev_prop_set_drive_nofail(dev, "driveB", fds[1]->bdrv);
}
- qdev_init_nofail(&dev->qdev);
+ qdev_init_nofail(dev);
- return dev;
+ return isadev;
}
void fdctrl_init_sysbus(qemu_irq irq, int dma_chann,
diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c
index 6e7e0dd057..e06a802e24 100644
--- a/hw/char/serial-isa.c
+++ b/hw/char/serial-isa.c
@@ -120,15 +120,17 @@ type_init(serial_register_types)
bool serial_isa_init(ISABus *bus, int index, CharDriverState *chr)
{
- ISADevice *dev;
+ DeviceState *dev;
+ ISADevice *isadev;
- dev = isa_try_create(bus, TYPE_ISA_SERIAL);
- if (!dev) {
+ isadev = isa_try_create(bus, TYPE_ISA_SERIAL);
+ if (!isadev) {
return false;
}
- qdev_prop_set_uint32(&dev->qdev, "index", index);
- qdev_prop_set_chr(&dev->qdev, "chardev", chr);
- if (qdev_init(&dev->qdev) < 0) {
+ dev = DEVICE(isadev);
+ qdev_prop_set_uint32(dev, "index", index);
+ qdev_prop_set_chr(dev, "chardev", chr);
+ if (qdev_init(dev) < 0) {
return false;
}
return true;
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index e9c91e44a1..0ad062c093 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1095,7 +1095,7 @@ DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus)
dev = pcidev ? &pcidev->qdev : NULL;
} else if (isa_bus) {
ISADevice *isadev = isa_vga_init(isa_bus);
- dev = isadev ? &isadev->qdev : NULL;
+ dev = isadev ? DEVICE(isadev) : NULL;
}
return dev;
}
@@ -1182,7 +1182,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
}
if (hpet) {
/* connect PIT to output control line of the HPET */
- qdev_connect_gpio_out(hpet, 0, qdev_get_gpio_in(&pit->qdev, 0));
+ qdev_connect_gpio_out(hpet, 0, qdev_get_gpio_in(DEVICE(pit), 0));
}
pcspk_init(isa_bus, pit);
}
@@ -1210,8 +1210,9 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
vmmouse = NULL;
}
if (vmmouse) {
- qdev_prop_set_ptr(&vmmouse->qdev, "ps2_mouse", i8042);
- qdev_init_nofail(&vmmouse->qdev);
+ DeviceState *dev = DEVICE(vmmouse);
+ qdev_prop_set_ptr(dev, "ps2_mouse", i8042);
+ qdev_init_nofail(dev);
}
port92 = isa_create_simple(isa_bus, "port92");
port92_init(port92, &a20_line[1]);
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index d6185705a6..af1e9afb04 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -199,7 +199,7 @@ static void pc_init1(MemoryRegion *system_memory,
dev = isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i],
ide_irq[i],
hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]);
- idebus[i] = qdev_get_child_bus(&dev->qdev, "ide.0");
+ idebus[i] = qdev_get_child_bus(DEVICE(dev), "ide.0");
}
}
diff --git a/hw/intc/i8259_common.c b/hw/intc/i8259_common.c
index 7613547734..803d037f68 100644
--- a/hw/intc/i8259_common.c
+++ b/hw/intc/i8259_common.c
@@ -80,16 +80,18 @@ static void pic_common_realize(DeviceState *dev, Error **errp)
ISADevice *i8259_init_chip(const char *name, ISABus *bus, bool master)
{
- ISADevice *dev;
-
- dev = isa_create(bus, name);
- qdev_prop_set_uint32(&dev->qdev, "iobase", master ? 0x20 : 0xa0);
- qdev_prop_set_uint32(&dev->qdev, "elcr_addr", master ? 0x4d0 : 0x4d1);
- qdev_prop_set_uint8(&dev->qdev, "elcr_mask", master ? 0xf8 : 0xde);
- qdev_prop_set_bit(&dev->qdev, "master", master);
- qdev_init_nofail(&dev->qdev);
-
- return dev;
+ DeviceState *dev;
+ ISADevice *isadev;
+
+ isadev = isa_create(bus, name);
+ dev = DEVICE(isadev);
+ qdev_prop_set_uint32(dev, "iobase", master ? 0x20 : 0xa0);
+ qdev_prop_set_uint32(dev, "elcr_addr", master ? 0x4d0 : 0x4d1);
+ qdev_prop_set_uint8(dev, "elcr_mask", master ? 0xf8 : 0xde);
+ qdev_prop_set_bit(dev, "master", master);
+ qdev_init_nofail(dev);
+
+ return isadev;
}
static const VMStateDescription vmstate_pic_common = {
diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
index 278e178173..a24cb98cba 100644
--- a/hw/isa/i82378.c
+++ b/hw/isa/i82378.c
@@ -201,7 +201,7 @@ static void i82378_init(DeviceState *dev, I82378State *s)
/* 2 82C37 (dma) */
isa = isa_create_simple(isabus, "i82374");
- qdev_connect_gpio_out(&isa->qdev, 0, s->out[1]);
+ qdev_connect_gpio_out(DEVICE(isa), 0, s->out[1]);
/* timer */
isa_create_simple(isabus, "mc146818rtc");
diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
index 7aa9b89b5c..136d17ede0 100644
--- a/hw/isa/isa-bus.c
+++ b/hw/isa/isa-bus.c
@@ -156,7 +156,7 @@ ISADevice *isa_create_simple(ISABus *bus, const char *name)
ISADevice *dev;
dev = isa_create(bus, name);
- qdev_init_nofail(&dev->qdev);
+ qdev_init_nofail(DEVICE(dev));
return dev;
}
@@ -240,7 +240,7 @@ static void isabus_register_types(void)
static char *isabus_get_fw_dev_path(DeviceState *dev)
{
- ISADevice *d = (ISADevice*)dev;
+ ISADevice *d = ISA_DEVICE(dev);
char path[40];
int off;
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index 9e770ab350..4fdc1649fd 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -605,8 +605,9 @@ static void ppc_prep_init(QEMUMachineInitArgs *args)
/* Super I/O (parallel + serial ports) */
isa = isa_create(isa_bus, TYPE_PC87312);
- qdev_prop_set_uint8(&isa->qdev, "config", 13); /* fdc, ser0, ser1, par0 */
- qdev_init_nofail(&isa->qdev);
+ dev = DEVICE(isa);
+ qdev_prop_set_uint8(dev, "config", 13); /* fdc, ser0, ser1, par0 */
+ qdev_init_nofail(dev);
/* Register 8 MB of ISA IO space (needed for non-contiguous map) */
memory_region_init_io(PPC_io_memory, &PPC_prep_io_ops, sysctrl,