aboutsummaryrefslogtreecommitdiff
path: root/hw/timer/mc146818rtc.c
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2013-06-15 10:53:44 +0000
committerBlue Swirl <blauwirbel@gmail.com>2013-06-15 10:53:44 +0000
commit371a775dc18ece3ff7d77328d1ee28cb2d473706 (patch)
tree328c5e856f25c5f0176d9361b641e8061e093ae2 /hw/timer/mc146818rtc.c
parent22bfa16ed3d4c9d534dcfe6f2381a654f32296b9 (diff)
parentfef7fbc92496f5f6d2b7395263830bce15ebf410 (diff)
Merge branch 'realize-isa.v2' of git://github.com/afaerber/qemu-cpu
* 'realize-isa.v2' of git://github.com/afaerber/qemu-cpu: qdev: Drop FROM_QBUS() macro isa: QOM'ify ISADevice isa: QOM'ify ISABus i8259: Convert PICCommonState to use QOM realizefn kvm/i8259: QOM'ify some more i8259: QOM'ify some more i8254: Convert PITCommonState to QOM realizefn kvm/i8254: QOM'ify some more i8254: QOM'ify some more isa: Use realizefn for ISADevice cs4231a: QOM'ify some more gus: QOM'ify some more
Diffstat (limited to 'hw/timer/mc146818rtc.c')
-rw-r--r--hw/timer/mc146818rtc.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c
index 481604de35..9c4a7bd074 100644
--- a/hw/timer/mc146818rtc.c
+++ b/hw/timer/mc146818rtc.c
@@ -814,8 +814,9 @@ static void rtc_get_date(Object *obj, Visitor *v, void *opaque,
visit_end_struct(v, errp);
}
-static int rtc_initfn(ISADevice *dev)
+static void rtc_realizefn(DeviceState *dev, Error **errp)
{
+ ISADevice *isadev = ISA_DEVICE(dev);
RTCState *s = MC146818_RTC(dev);
int base = 0x70;
@@ -836,7 +837,7 @@ static int rtc_initfn(ISADevice *dev)
s->base_year = 0;
}
- rtc_set_date_from_host(dev);
+ rtc_set_date_from_host(isadev);
#ifdef TARGET_I386
switch (s->lost_tick_policy) {
@@ -847,7 +848,8 @@ static int rtc_initfn(ISADevice *dev)
case LOST_TICK_DISCARD:
break;
default:
- return -EINVAL;
+ error_setg(errp, "Invalid lost tick policy.");
+ return;
}
#endif
@@ -862,15 +864,13 @@ static int rtc_initfn(ISADevice *dev)
qemu_register_suspend_notifier(&s->suspend_notifier);
memory_region_init_io(&s->io, &cmos_ops, s, "rtc", 2);
- isa_register_ioport(dev, &s->io, base);
+ isa_register_ioport(isadev, &s->io, base);
- qdev_set_legacy_instance_id(&dev->qdev, base, 3);
+ qdev_set_legacy_instance_id(dev, base, 3);
qemu_register_reset(rtc_reset, s);
object_property_add(OBJECT(s), "date", "struct tm",
rtc_get_date, NULL, NULL, s, NULL);
-
- return 0;
}
ISADevice *rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq)
@@ -902,8 +902,8 @@ static Property mc146818rtc_properties[] = {
static void rtc_class_initfn(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
- ic->init = rtc_initfn;
+
+ dc->realize = rtc_realizefn;
dc->no_user = 1;
dc->vmsd = &vmstate_rtc;
dc->props = mc146818rtc_properties;