aboutsummaryrefslogtreecommitdiff
path: root/hw/char/serial.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2019-10-22 01:02:50 +0200
committerMarc-André Lureau <marcandre.lureau@redhat.com>2020-01-07 16:50:48 +0400
commitc9808d602813bce4fada7bf9ecc463aa779b73f7 (patch)
treeaf4b95f690cbcd97139756bcf6e4146a8d7d24da /hw/char/serial.c
parent96651db423a0a25466629d35c775531f5145a66a (diff)
downloadqemu-c9808d602813bce4fada7bf9ecc463aa779b73f7.zip
qemu-c9808d602813bce4fada7bf9ecc463aa779b73f7.tar.gz
qemu-c9808d602813bce4fada7bf9ecc463aa779b73f7.tar.bz2
serial: realize the serial device
Instead of calling serial_realize_core(), use the QDev realize callback. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Diffstat (limited to 'hw/char/serial.c')
-rw-r--r--hw/char/serial.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/char/serial.c b/hw/char/serial.c
index a4f0566..8328cc6 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -934,8 +934,10 @@ static int serial_be_change(void *opaque)
return 0;
}
-void serial_realize_core(SerialState *s, Error **errp)
+static void serial_realize(DeviceState *dev, Error **errp)
{
+ SerialState *s = SERIAL(dev);
+
s->modem_status_poll = timer_new_ns(QEMU_CLOCK_VIRTUAL, (QEMUTimerCB *) serial_update_msl, s);
s->fifo_timeout_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, (QEMUTimerCB *) fifo_timeout_int, s);
@@ -990,7 +992,6 @@ SerialState *serial_init(int base, qemu_irq irq, int baudbase,
s->irq = irq;
qdev_prop_set_uint32(dev, "baudbase", baudbase);
qdev_prop_set_chr(dev, "chardev", chr);
- serial_realize_core(s, &error_fatal);
qdev_set_legacy_instance_id(dev, base, 2);
qdev_init_nofail(dev);
@@ -1012,6 +1013,7 @@ static void serial_class_init(ObjectClass *klass, void* data)
/* internal device for serialio/serialmm, not user-creatable */
dc->user_creatable = false;
+ dc->realize = serial_realize;
dc->vmsd = &vmstate_serial;
dc->props = serial_properties;
}
@@ -1075,8 +1077,6 @@ SerialState *serial_mm_init(MemoryRegion *address_space,
s->irq = irq;
qdev_prop_set_uint32(dev, "baudbase", baudbase);
qdev_prop_set_chr(dev, "chardev", chr);
-
- serial_realize_core(s, &error_fatal);
qdev_set_legacy_instance_id(dev, base, 2);
qdev_init_nofail(dev);