diff options
author | Andreas Färber <afaerber@suse.de> | 2013-07-24 22:43:22 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-07-29 21:06:27 +0200 |
commit | 8d8e34815e46a45afaa2689b49d5f97b6306b7f3 (patch) | |
tree | 233bd9b139d23294396e4f5402e8747c2d63722b /hw | |
parent | ae8e04903138a51d15faaf501ea83569cd6cffa5 (diff) |
imx_serial: QOM cast cleanup
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/char/imx_serial.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c index 5c17eaa577..7f16835aeb 100644 --- a/hw/char/imx_serial.c +++ b/hw/char/imx_serial.c @@ -43,8 +43,12 @@ do { printf("imx_serial: " fmt , ##args); } while (0) # define IPRINTF(fmt, args...) do {} while (0) #endif -typedef struct { - SysBusDevice busdev; +#define TYPE_IMX_SERIAL "imx-serial" +#define IMX_SERIAL(obj) OBJECT_CHECK(IMXSerialState, (obj), TYPE_IMX_SERIAL) + +typedef struct IMXSerialState { + SysBusDevice parent_obj; + MemoryRegion iomem; int32_t readbuff; @@ -169,7 +173,7 @@ static void imx_serial_reset(IMXSerialState *s) static void imx_serial_reset_at_boot(DeviceState *dev) { - IMXSerialState *s = container_of(dev, IMXSerialState, busdev.qdev); + IMXSerialState *s = IMX_SERIAL(dev); imx_serial_reset(s); @@ -383,7 +387,7 @@ static const struct MemoryRegionOps imx_serial_ops = { static int imx_serial_init(SysBusDevice *dev) { - IMXSerialState *s = FROM_SYSBUS(IMXSerialState, dev); + IMXSerialState *s = IMX_SERIAL(dev); memory_region_init_io(&s->iomem, OBJECT(s), &imx_serial_ops, s, @@ -410,7 +414,7 @@ void imx_serial_create(int uart, const hwaddr addr, qemu_irq irq) const char chr_name[] = "serial"; char label[ARRAY_SIZE(chr_name) + 1]; - dev = qdev_create(NULL, "imx-serial"); + dev = qdev_create(NULL, TYPE_IMX_SERIAL); if (uart >= MAX_SERIAL_PORTS) { hw_error("Cannot assign uart %d: QEMU supports only %d ports\n", @@ -455,7 +459,7 @@ static void imx_serial_class_init(ObjectClass *klass, void *data) } static const TypeInfo imx_serial_info = { - .name = "imx-serial", + .name = TYPE_IMX_SERIAL, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(IMXSerialState), .class_init = imx_serial_class_init, |