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 /backends/msmouse.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 'backends/msmouse.c')
-rw-r--r-- | backends/msmouse.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/backends/msmouse.c b/backends/msmouse.c index 2490b2c073..2c238ba1b3 100644 --- a/backends/msmouse.c +++ b/backends/msmouse.c @@ -148,7 +148,8 @@ static QemuInputHandler msmouse_handler = { .sync = msmouse_input_sync, }; -static CharDriverState *qemu_chr_open_msmouse(const char *id, +static CharDriverState *qemu_chr_open_msmouse(const CharDriver *driver, + const char *id, ChardevBackend *backend, ChardevReturn *ret, bool *be_opened, @@ -158,13 +159,10 @@ static CharDriverState *qemu_chr_open_msmouse(const char *id, MouseState *mouse; CharDriverState *chr; - chr = qemu_chr_alloc(common, errp); + chr = qemu_chr_alloc(driver, common, errp); if (!chr) { return NULL; } - chr->chr_write = msmouse_chr_write; - chr->chr_free = msmouse_chr_free; - chr->chr_accept_input = msmouse_chr_accept_input; *be_opened = false; mouse = g_new0(MouseState, 1); @@ -182,6 +180,9 @@ static void register_types(void) static const CharDriver driver = { .kind = CHARDEV_BACKEND_KIND_MSMOUSE, .create = qemu_chr_open_msmouse, + .chr_write = msmouse_chr_write, + .chr_accept_input = msmouse_chr_accept_input, + .chr_free = msmouse_chr_free, }; register_char_driver(&driver); } |