summaryrefslogtreecommitdiff
path: root/hw/char/imx_serial.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/char/imx_serial.c')
-rw-r--r--hw/char/imx_serial.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
index d9a0a25d44..8dbb7b26e6 100644
--- a/hw/char/imx_serial.c
+++ b/hw/char/imx_serial.c
@@ -121,9 +121,7 @@ static uint64_t imx_serial_read(void *opaque, hwaddr offset,
s->usr2 &= ~USR2_RDR;
s->uts1 |= UTS1_RXEMPTY;
imx_update(s);
- if (s->chr.chr) {
- qemu_chr_fe_accept_input(&s->chr);
- }
+ qemu_chr_fe_accept_input(&s->chr);
}
return c;
@@ -182,11 +180,9 @@ static void imx_serial_write(void *opaque, hwaddr offset,
case 0x10: /* UTXD */
ch = value;
if (s->ucr2 & UCR2_TXEN) {
- if (s->chr.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);
s->usr1 &= ~USR1_TRDY;
imx_update(s);
s->usr1 |= USR1_TRDY;
@@ -215,9 +211,7 @@ static void imx_serial_write(void *opaque, hwaddr offset,
}
if (value & UCR2_RXEN) {
if (!(s->ucr2 & UCR2_RXEN)) {
- if (s->chr.chr) {
- qemu_chr_fe_accept_input(&s->chr);
- }
+ qemu_chr_fe_accept_input(&s->chr);
}
}
s->ucr2 = value & 0xffff;
@@ -319,12 +313,10 @@ static void imx_serial_realize(DeviceState *dev, Error **errp)
{
IMXSerialState *s = IMX_SERIAL(dev);
- if (s->chr.chr) {
- qemu_chr_fe_set_handlers(&s->chr, imx_can_receive, imx_receive,
- imx_event, s, NULL);
- } else {
- DPRINTF("No char dev for uart\n");
- }
+ DPRINTF("char dev for uart: %p\n", qemu_chr_fe_get_driver(&s->chr));
+
+ qemu_chr_fe_set_handlers(&s->chr, imx_can_receive, imx_receive,
+ imx_event, s, NULL);
}
static void imx_serial_init(Object *obj)