tcx: QOM cast cleanup

Introduce a type constant, use QOM casts and rename the parent field.

Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
Andreas Färber 2013-07-25 01:13:54 +02:00
parent 5d7a11e438
commit 01774ddbcf
1 changed files with 8 additions and 4 deletions

View File

@ -34,8 +34,12 @@
#define TCX_THC_NREGS_24 0x1000 #define TCX_THC_NREGS_24 0x1000
#define TCX_TEC_NREGS 0x1000 #define TCX_TEC_NREGS 0x1000
#define TYPE_TCX "SUNW,tcx"
#define TCX(obj) OBJECT_CHECK(TCXState, (obj), TYPE_TCX)
typedef struct TCXState { typedef struct TCXState {
SysBusDevice busdev; SysBusDevice parent_obj;
QemuConsole *con; QemuConsole *con;
uint8_t *vram; uint8_t *vram;
uint32_t *vram24, *cplane; uint32_t *vram24, *cplane;
@ -423,7 +427,7 @@ static const VMStateDescription vmstate_tcx = {
static void tcx_reset(DeviceState *d) static void tcx_reset(DeviceState *d)
{ {
TCXState *s = container_of(d, TCXState, busdev.qdev); TCXState *s = TCX(d);
/* Initialize palette */ /* Initialize palette */
memset(s->r, 0, 256); memset(s->r, 0, 256);
@ -523,7 +527,7 @@ static const GraphicHwOps tcx24_ops = {
static int tcx_init1(SysBusDevice *dev) static int tcx_init1(SysBusDevice *dev)
{ {
TCXState *s = FROM_SYSBUS(TCXState, dev); TCXState *s = TCX(dev);
ram_addr_t vram_offset = 0; ram_addr_t vram_offset = 0;
int size; int size;
uint8_t *vram_base; uint8_t *vram_base;
@ -609,7 +613,7 @@ static void tcx_class_init(ObjectClass *klass, void *data)
} }
static const TypeInfo tcx_info = { static const TypeInfo tcx_info = {
.name = "SUNW,tcx", .name = TYPE_TCX,
.parent = TYPE_SYS_BUS_DEVICE, .parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(TCXState), .instance_size = sizeof(TCXState),
.class_init = tcx_class_init, .class_init = tcx_class_init,