aboutsummaryrefslogtreecommitdiff
path: root/backends/baum.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-10-21 20:49:37 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2017-01-27 18:07:58 +0100
commitb68e956abe2ad0a1ecf53868e0bf1a61b418ded8 (patch)
tree2d25f219ee74ed5671959e92f9018ccd408cd35a /backends/baum.c
parenta1698bf183a2fc05ff980e06c798408d5898bc48 (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/baum.c')
-rw-r--r--backends/baum.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/backends/baum.c b/backends/baum.c
index 2e404a11cc..109469e8f7 100644
--- a/backends/baum.c
+++ b/backends/baum.c
@@ -622,7 +622,8 @@ static void baum_free(struct CharDriverState *chr)
g_free(baum);
}
-static CharDriverState *chr_baum_init(const char *id,
+static CharDriverState *chr_baum_init(const CharDriver *driver,
+ const char *id,
ChardevBackend *backend,
ChardevReturn *ret,
bool *be_opened,
@@ -633,7 +634,7 @@ static CharDriverState *chr_baum_init(const char *id,
CharDriverState *chr;
brlapi_handle_t *handle;
- chr = qemu_chr_alloc(common, errp);
+ chr = qemu_chr_alloc(driver, common, errp);
if (!chr) {
return NULL;
}
@@ -641,9 +642,6 @@ static CharDriverState *chr_baum_init(const char *id,
baum->chr = chr;
chr->opaque = baum;
- chr->chr_write = baum_write;
- chr->chr_accept_input = baum_accept_input;
- chr->chr_free = baum_free;
handle = g_malloc0(brlapi_getHandleSize());
baum->brlapi = handle;
@@ -674,6 +672,9 @@ static void register_types(void)
static const CharDriver driver = {
.kind = CHARDEV_BACKEND_KIND_BRAILLE,
.create = chr_baum_init,
+ .chr_write = baum_write,
+ .chr_accept_input = baum_accept_input,
+ .chr_free = baum_free,
};
register_char_driver(&driver);