mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
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>
This commit is contained in:
parent
a1698bf183
commit
b68e956abe
10 changed files with 381 additions and 260 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue