diff options
author | Andreas Färber <afaerber@suse.de> | 2013-07-27 14:52:32 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-07-29 21:07:01 +0200 |
commit | 541ab55ff1bdc558473f0dea40deae568551bb85 (patch) | |
tree | a5a794b8f46e8d669f3e81f8ec5a3e9a0e45900a /hw/timer/grlib_gptimer.c | |
parent | 3ddacf27057678f483bbed78db2f10419acb6501 (diff) |
grlib_gptimer: QOM cast cleanup
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/timer/grlib_gptimer.c')
-rw-r--r-- | hw/timer/grlib_gptimer.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/hw/timer/grlib_gptimer.c b/hw/timer/grlib_gptimer.c index 37ba47d075..7c1055a99c 100644 --- a/hw/timer/grlib_gptimer.c +++ b/hw/timer/grlib_gptimer.c @@ -50,6 +50,10 @@ #define COUNTER_RELOAD_OFFSET 0x04 #define TIMER_BASE 0x10 +#define TYPE_GRLIB_GPTIMER "grlib,gptimer" +#define GRLIB_GPTIMER(obj) \ + OBJECT_CHECK(GPTimerUnit, (obj), TYPE_GRLIB_GPTIMER) + typedef struct GPTimer GPTimer; typedef struct GPTimerUnit GPTimerUnit; @@ -68,7 +72,8 @@ struct GPTimer { }; struct GPTimerUnit { - SysBusDevice busdev; + SysBusDevice parent_obj; + MemoryRegion iomem; uint32_t nr_timers; /* Number of timers available */ @@ -314,7 +319,7 @@ static const MemoryRegionOps grlib_gptimer_ops = { static void grlib_gptimer_reset(DeviceState *d) { - GPTimerUnit *unit = container_of(d, GPTimerUnit, busdev.qdev); + GPTimerUnit *unit = GRLIB_GPTIMER(d); int i = 0; assert(unit != NULL); @@ -343,7 +348,7 @@ static void grlib_gptimer_reset(DeviceState *d) static int grlib_gptimer_init(SysBusDevice *dev) { - GPTimerUnit *unit = FROM_SYSBUS(typeof(*unit), dev); + GPTimerUnit *unit = GRLIB_GPTIMER(dev); unsigned int i; assert(unit->nr_timers > 0); @@ -391,7 +396,7 @@ static void grlib_gptimer_class_init(ObjectClass *klass, void *data) } static const TypeInfo grlib_gptimer_info = { - .name = "grlib,gptimer", + .name = TYPE_GRLIB_GPTIMER, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(GPTimerUnit), .class_init = grlib_gptimer_class_init, |