From 01774ddbcf42c9521fa66679f947eb49327b8e18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Thu, 25 Jul 2013 01:13:54 +0200 Subject: tcx: QOM cast cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce a type constant, use QOM casts and rename the parent field. Signed-off-by: Andreas Färber --- hw/display/tcx.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'hw/display') diff --git a/hw/display/tcx.c b/hw/display/tcx.c index 9fd48b5f8b..24876d33ef 100644 --- a/hw/display/tcx.c +++ b/hw/display/tcx.c @@ -34,8 +34,12 @@ #define TCX_THC_NREGS_24 0x1000 #define TCX_TEC_NREGS 0x1000 +#define TYPE_TCX "SUNW,tcx" +#define TCX(obj) OBJECT_CHECK(TCXState, (obj), TYPE_TCX) + typedef struct TCXState { - SysBusDevice busdev; + SysBusDevice parent_obj; + QemuConsole *con; uint8_t *vram; uint32_t *vram24, *cplane; @@ -423,7 +427,7 @@ static const VMStateDescription vmstate_tcx = { static void tcx_reset(DeviceState *d) { - TCXState *s = container_of(d, TCXState, busdev.qdev); + TCXState *s = TCX(d); /* Initialize palette */ memset(s->r, 0, 256); @@ -523,7 +527,7 @@ static const GraphicHwOps tcx24_ops = { static int tcx_init1(SysBusDevice *dev) { - TCXState *s = FROM_SYSBUS(TCXState, dev); + TCXState *s = TCX(dev); ram_addr_t vram_offset = 0; int size; uint8_t *vram_base; @@ -609,7 +613,7 @@ static void tcx_class_init(ObjectClass *klass, void *data) } static const TypeInfo tcx_info = { - .name = "SUNW,tcx", + .name = TYPE_TCX, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(TCXState), .class_init = tcx_class_init, -- cgit v1.2.1