aboutsummaryrefslogtreecommitdiff
path: root/hw/char/digic-uart.c
diff options
context:
space:
mode:
authorxiaoqiang zhao <zxq_yx_007@163.com>2016-06-06 16:59:31 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-06-06 16:59:31 +0100
commit746c3b3eba0d091d2e2d84b63ce4ca3186e212a7 (patch)
tree7d8414208f4ccded39d7b7cb7393810fcdde3ff9 /hw/char/digic-uart.c
parent4be12ea09acc32f7e1b9d11e9f34969c7ae603ee (diff)
hw/char: QOM'ify digic-uart model
* drop qemu_char_get_next_serial and use chardev prop * change affected board code to use the new way Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com> Message-id: 1465028065-5855-4-git-send-email-zxq_yx_007@163.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/char/digic-uart.c')
-rw-r--r--hw/char/digic-uart.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/hw/char/digic-uart.c b/hw/char/digic-uart.c
index 0e44878405..c7604e6766 100644
--- a/hw/char/digic-uart.c
+++ b/hw/char/digic-uart.c
@@ -145,8 +145,6 @@ static void digic_uart_realize(DeviceState *dev, Error **errp)
{
DigicUartState *s = DIGIC_UART(dev);
- /* FIXME use a qdev chardev prop instead of qemu_char_get_next_serial() */
- s->chr = qemu_char_get_next_serial();
if (s->chr) {
qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s);
}
@@ -172,6 +170,11 @@ static const VMStateDescription vmstate_digic_uart = {
}
};
+static Property digic_uart_properties[] = {
+ DEFINE_PROP_CHR("chardev", DigicUartState, chr),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void digic_uart_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
@@ -179,8 +182,7 @@ static void digic_uart_class_init(ObjectClass *klass, void *data)
dc->realize = digic_uart_realize;
dc->reset = digic_uart_reset;
dc->vmsd = &vmstate_digic_uart;
- /* Reason: realize() method uses qemu_char_get_next_serial() */
- dc->cannot_instantiate_with_device_add_yet = true;
+ dc->props = digic_uart_properties;
}
static const TypeInfo digic_uart_info = {