summaryrefslogtreecommitdiff
path: root/hw/char/ipoctal232.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-10-22 12:52:59 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2016-10-24 15:27:21 +0200
commitfa394ed625731c18f904578903718bf16617fe92 (patch)
tree224ba9825ba286e3fcffc48394a3a4c1afbc9531 /hw/char/ipoctal232.c
parentc39860e6dc90f6ee2e82ee078f978c5d7f3df86a (diff)
downloadqemu-fa394ed625731c18f904578903718bf16617fe92.tar.gz
char: make some qemu_chr_fe skip if no driver
In most cases, front ends do not care about the side effect of CharBackend, so we can simply skip the checks and call the qemu_chr_fe functions even without associated CharDriver. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-20-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/char/ipoctal232.c')
-rw-r--r--hw/char/ipoctal232.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/hw/char/ipoctal232.c b/hw/char/ipoctal232.c
index d504721a99..6f150e09fb 100644
--- a/hw/char/ipoctal232.c
+++ b/hw/char/ipoctal232.c
@@ -288,9 +288,7 @@ static uint16_t io_read(IPackDevice *ip, uint8_t addr)
if (ch->rx_pending == 0) {
ch->sr &= ~SR_RXRDY;
blk->isr &= ~ISR_RXRDY(channel);
- if (ch->dev.chr) {
- qemu_chr_fe_accept_input(&ch->dev);
- }
+ qemu_chr_fe_accept_input(&ch->dev);
} else {
ch->rhr_idx = (ch->rhr_idx + 1) % RX_FIFO_SIZE;
}
@@ -357,13 +355,11 @@ static void io_write(IPackDevice *ip, uint8_t addr, uint16_t val)
case REG_THRa:
case REG_THRb:
if (ch->sr & SR_TXRDY) {
+ uint8_t thr = reg;
DPRINTF("Write THR%c (0x%x)\n", channel + 'a', reg);
- if (ch->dev.chr) {
- uint8_t thr = reg;
- /* XXX this blocks entire thread. Rewrite to use
- * qemu_chr_fe_write and background I/O callbacks */
- qemu_chr_fe_write_all(&ch->dev, &thr, 1);
- }
+ /* XXX this blocks entire thread. Rewrite to use
+ * qemu_chr_fe_write and background I/O callbacks */
+ qemu_chr_fe_write_all(&ch->dev, &thr, 1);
} else {
DPRINTF("Write THR%c (0x%x), Tx disabled\n", channel + 'a', reg);
}