From b68e956abe2ad0a1ecf53868e0bf1a61b418ded8 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Fri, 21 Oct 2016 20:49:37 +0300 Subject: 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 Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- hw/bt/hci-csr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'hw') 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; -- cgit v1.2.3-55-g7522