diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2016-10-22 12:52:51 +0300 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-10-24 15:27:20 +0200 |
commit | becdfa00cfa2995e859ccefa4b7d72a72eb96581 (patch) | |
tree | 8973236c181dcde0dbcd9fd36d122fc7a4bac6d7 /hw/char/ipoctal232.c | |
parent | ecb672d14f092f481000ac9cd9d7dc0500692eba (diff) |
char: replace PROP_CHR with CharBackend
Store the property in a CharBackend instead of CharDriverState*. This
also replace systematically chr by chr.chr to access the
CharDriverState*. The following patches will replace it with calls to
qemu_chr_fe CharBackend functions.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20161022095318.17775-12-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 | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/hw/char/ipoctal232.c b/hw/char/ipoctal232.c index 2859fdd7fb..0c9dea322e 100644 --- a/hw/char/ipoctal232.c +++ b/hw/char/ipoctal232.c @@ -93,7 +93,7 @@ typedef struct SCC2698Block SCC2698Block; struct SCC2698Channel { IPOctalState *ipoctal; - CharDriverState *dev; + CharBackend dev; bool rx_enabled; uint8_t mr[2]; uint8_t mr_idx; @@ -288,8 +288,8 @@ 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) { - qemu_chr_accept_input(ch->dev); + if (ch->dev.chr) { + qemu_chr_accept_input(ch->dev.chr); } } else { ch->rhr_idx = (ch->rhr_idx + 1) % RX_FIFO_SIZE; @@ -358,11 +358,11 @@ static void io_write(IPackDevice *ip, uint8_t addr, uint16_t val) case REG_THRb: if (ch->sr & SR_TXRDY) { DPRINTF("Write THR%c (0x%x)\n", channel + 'a', reg); - if (ch->dev) { + 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); + qemu_chr_fe_write_all(ch->dev.chr, &thr, 1); } } else { DPRINTF("Write THR%c (0x%x), Tx disabled\n", channel + 'a', reg); @@ -546,8 +546,8 @@ static void ipoctal_realize(DeviceState *dev, Error **errp) ch->ipoctal = s; /* Redirect IP-Octal channels to host character devices */ - if (ch->dev) { - qemu_chr_add_handlers(ch->dev, hostdev_can_receive, + if (ch->dev.chr) { + qemu_chr_add_handlers(ch->dev.chr, hostdev_can_receive, hostdev_receive, hostdev_event, ch); DPRINTF("Redirecting channel %u to %s\n", i, ch->dev->label); } else { |