diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2016-10-22 12:52:55 +0300 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-10-24 15:27:21 +0200 |
commit | 5345fdb4467816c44f6752b3a1f4e73aa25919f9 (patch) | |
tree | 9930cf4370d2325d113408f7b314cd77aa43f8a3 /hw/char/ipoctal232.c | |
parent | fbf3cc3a67a7131e258764aa1f19d5324e9e9f7a (diff) |
char: use qemu_chr_fe* functions with CharBackend argument
This also switches from qemu_chr_add_handlers() to
qemu_chr_fe_set_handlers(). Note that qemu_chr_fe_set_handlers() now
takes the focus when fe_open (qemu_chr_add_handlers() did take the
focus)
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20161022095318.17775-16-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.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/hw/char/ipoctal232.c b/hw/char/ipoctal232.c index 875fe3b22a..d504721a99 100644 --- a/hw/char/ipoctal232.c +++ b/hw/char/ipoctal232.c @@ -289,7 +289,7 @@ static uint16_t io_read(IPackDevice *ip, uint8_t addr) ch->sr &= ~SR_RXRDY; blk->isr &= ~ISR_RXRDY(channel); if (ch->dev.chr) { - qemu_chr_fe_accept_input(ch->dev.chr); + qemu_chr_fe_accept_input(&ch->dev); } } else { ch->rhr_idx = (ch->rhr_idx + 1) % RX_FIFO_SIZE; @@ -362,7 +362,7 @@ static void io_write(IPackDevice *ip, uint8_t addr, uint16_t val) 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.chr, &thr, 1); + qemu_chr_fe_write_all(&ch->dev, &thr, 1); } } else { DPRINTF("Write THR%c (0x%x), Tx disabled\n", channel + 'a', reg); @@ -546,9 +546,9 @@ static void ipoctal_realize(DeviceState *dev, Error **errp) ch->ipoctal = s; /* Redirect IP-Octal channels to host character devices */ - if (ch->dev.chr) { - qemu_chr_add_handlers(ch->dev.chr, hostdev_can_receive, - hostdev_receive, hostdev_event, ch); + if (qemu_chr_fe_get_driver(&ch->dev)) { + qemu_chr_fe_set_handlers(&ch->dev, hostdev_can_receive, + hostdev_receive, hostdev_event, ch, NULL); DPRINTF("Redirecting channel %u to %s\n", i, ch->dev->label); } else { DPRINTF("Could not redirect channel %u, no chardev set\n", i); |