aboutsummaryrefslogtreecommitdiff
path: root/hw/char/lm32_juart.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/char/lm32_juart.c')
-rw-r--r--hw/char/lm32_juart.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/hw/char/lm32_juart.c b/hw/char/lm32_juart.c
index cb1ac76731..f8c1e0d076 100644
--- a/hw/char/lm32_juart.c
+++ b/hw/char/lm32_juart.c
@@ -44,7 +44,7 @@ enum {
struct LM32JuartState {
SysBusDevice parent_obj;
- CharDriverState *chr;
+ CharBackend chr;
uint32_t jtx;
uint32_t jrx;
@@ -75,11 +75,9 @@ void lm32_juart_set_jtx(DeviceState *d, uint32_t jtx)
trace_lm32_juart_set_jtx(s->jtx);
s->jtx = jtx;
- if (s->chr) {
- /* XXX this blocks entire thread. Rewrite to use
- * qemu_chr_fe_write and background I/O callbacks */
- qemu_chr_fe_write_all(s->chr, &ch, 1);
- }
+ /* XXX this blocks entire thread. Rewrite to use
+ * qemu_chr_fe_write and background I/O callbacks */
+ qemu_chr_fe_write_all(&s->chr, &ch, 1);
}
void lm32_juart_set_jrx(DeviceState *d, uint32_t jtx)
@@ -120,9 +118,8 @@ static void lm32_juart_realize(DeviceState *dev, Error **errp)
{
LM32JuartState *s = LM32_JUART(dev);
- if (s->chr) {
- qemu_chr_add_handlers(s->chr, juart_can_rx, juart_rx, juart_event, s);
- }
+ qemu_chr_fe_set_handlers(&s->chr, juart_can_rx, juart_rx,
+ juart_event, s, NULL, true);
}
static const VMStateDescription vmstate_lm32_juart = {