mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 18:23:57 -06:00
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>
This commit is contained in:
parent
c39860e6dc
commit
fa394ed625
22 changed files with 156 additions and 190 deletions
|
@ -87,9 +87,7 @@ static uint64_t pl011_read(void *opaque, hwaddr offset,
|
|||
trace_pl011_read_fifo(s->read_count);
|
||||
s->rsr = c >> 8;
|
||||
pl011_update(s);
|
||||
if (s->chr.chr) {
|
||||
qemu_chr_fe_accept_input(&s->chr);
|
||||
}
|
||||
qemu_chr_fe_accept_input(&s->chr);
|
||||
r = c;
|
||||
break;
|
||||
case 1: /* UARTRSR */
|
||||
|
@ -168,11 +166,9 @@ static void pl011_write(void *opaque, hwaddr offset,
|
|||
case 0: /* UARTDR */
|
||||
/* ??? Check if transmitter is enabled. */
|
||||
ch = value;
|
||||
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->int_level |= PL011_INT_TX;
|
||||
pl011_update(s);
|
||||
break;
|
||||
|
@ -332,10 +328,8 @@ static void pl011_realize(DeviceState *dev, Error **errp)
|
|||
{
|
||||
PL011State *s = PL011(dev);
|
||||
|
||||
if (s->chr.chr) {
|
||||
qemu_chr_fe_set_handlers(&s->chr, pl011_can_receive, pl011_receive,
|
||||
pl011_event, s, NULL);
|
||||
}
|
||||
qemu_chr_fe_set_handlers(&s->chr, pl011_can_receive, pl011_receive,
|
||||
pl011_event, s, NULL);
|
||||
}
|
||||
|
||||
static void pl011_class_init(ObjectClass *oc, void *data)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue