timer/grlib_gptimer: Convert sysbus init function to realize function
Use DeviceClass rather than SysBusDeviceClass in grlib_gptimer_class_init(). Cc: chouteau@adacore.com Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20181130093852.20739-18-maozhongyi@cmss.chinamobile.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
34a598f675
commit
23251fb82f
@ -347,10 +347,11 @@ static void grlib_gptimer_reset(DeviceState *d)
|
||||
}
|
||||
}
|
||||
|
||||
static int grlib_gptimer_init(SysBusDevice *dev)
|
||||
static void grlib_gptimer_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
GPTimerUnit *unit = GRLIB_GPTIMER(dev);
|
||||
unsigned int i;
|
||||
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
|
||||
|
||||
assert(unit->nr_timers > 0);
|
||||
assert(unit->nr_timers <= GPTIMER_MAX_TIMERS);
|
||||
@ -366,7 +367,7 @@ static int grlib_gptimer_init(SysBusDevice *dev)
|
||||
timer->id = i;
|
||||
|
||||
/* One IRQ line for each timer */
|
||||
sysbus_init_irq(dev, &timer->irq);
|
||||
sysbus_init_irq(sbd, &timer->irq);
|
||||
|
||||
ptimer_set_freq(timer->ptimer, unit->freq_hz);
|
||||
}
|
||||
@ -375,8 +376,7 @@ static int grlib_gptimer_init(SysBusDevice *dev)
|
||||
unit, "gptimer",
|
||||
UNIT_REG_SIZE + GPTIMER_REG_SIZE * unit->nr_timers);
|
||||
|
||||
sysbus_init_mmio(dev, &unit->iomem);
|
||||
return 0;
|
||||
sysbus_init_mmio(sbd, &unit->iomem);
|
||||
}
|
||||
|
||||
static Property grlib_gptimer_properties[] = {
|
||||
@ -389,9 +389,8 @@ static Property grlib_gptimer_properties[] = {
|
||||
static void grlib_gptimer_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
||||
|
||||
k->init = grlib_gptimer_init;
|
||||
dc->realize = grlib_gptimer_realize;
|
||||
dc->reset = grlib_gptimer_reset;
|
||||
dc->props = grlib_gptimer_properties;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user