From 3afe7e14a42309578d324df5fe1b303a496a8466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 25 Nov 2012 18:05:53 +0100 Subject: i8254: QOM'ify some more MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce type constant and avoid DO_UPCAST(). Prepares for PIT realizefn. Signed-off-by: Andreas Färber --- include/hw/timer/i8254.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'include/hw/timer') diff --git a/include/hw/timer/i8254.h b/include/hw/timer/i8254.h index 75bb530..016f990 100644 --- a/include/hw/timer/i8254.h +++ b/include/hw/timer/i8254.h @@ -37,18 +37,22 @@ typedef struct PITChannelInfo { int out; } PITChannelInfo; +#define TYPE_I8254 "isa-pit" + static inline ISADevice *pit_init(ISABus *bus, int base, int isa_irq, qemu_irq alt_irq) { - ISADevice *dev; + DeviceState *dev; + ISADevice *d; - dev = isa_create(bus, "isa-pit"); - qdev_prop_set_uint32(&dev->qdev, "iobase", base); - qdev_init_nofail(&dev->qdev); - qdev_connect_gpio_out(&dev->qdev, 0, - isa_irq >= 0 ? isa_get_irq(dev, isa_irq) : alt_irq); + d = isa_create(bus, TYPE_I8254); + dev = DEVICE(d); + qdev_prop_set_uint32(dev, "iobase", base); + qdev_init_nofail(dev); + qdev_connect_gpio_out(dev, 0, + isa_irq >= 0 ? isa_get_irq(d, isa_irq) : alt_irq); - return dev; + return d; } static inline ISADevice *kvm_pit_init(ISABus *bus, int base) -- cgit v1.1