diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2016-10-21 20:49:37 +0300 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2017-01-27 18:07:58 +0100 |
commit | b68e956abe2ad0a1ecf53868e0bf1a61b418ded8 (patch) | |
tree | 2d25f219ee74ed5671959e92f9018ccd408cd35a /hw/bt/hci-csr.c | |
parent | a1698bf183a2fc05ff980e06c798408d5898bc48 (diff) |
char: move callbacks in CharDriver
This makes the code more declarative, and avoids duplicating the
information on all instances.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/bt/hci-csr.c')
-rw-r--r-- | hw/bt/hci-csr.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/hw/bt/hci-csr.c b/hw/bt/hci-csr.c index fbb3109cc1..9c3fb3c8f9 100644 --- a/hw/bt/hci-csr.c +++ b/hw/bt/hci-csr.c @@ -462,12 +462,16 @@ qemu_irq *csrhci_pins_get(CharDriverState *chr) CharDriverState *uart_hci_init(void) { + static const CharDriver hci_driver = { + .kind = -1, + .chr_write = csrhci_write, + .chr_ioctl = csrhci_ioctl, + }; struct csrhci_s *s = (struct csrhci_s *) g_malloc0(sizeof(struct csrhci_s)); s->chr.opaque = s; - s->chr.chr_write = csrhci_write; - s->chr.chr_ioctl = csrhci_ioctl; + s->chr.driver = &hci_driver; s->hci = qemu_next_hci(); s->hci->opaque = s; |