summary refs log tree commit diff stats
path: root/backends/baum.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-10-21 16:07:45 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2017-01-27 18:07:58 +0100
commit0b812f31925f2ed50eb54d2be6ac9291bf67b890 (patch)
tree8a51007dff4c1b2d7a6d004a06ac53a6059c0358 /backends/baum.c
parentbd1caa3f8e8e63b9ac4cbcbee5a2dee3587fd852 (diff)
downloadfocaccia-qemu-0b812f31925f2ed50eb54d2be6ac9291bf67b890.tar.gz
focaccia-qemu-0b812f31925f2ed50eb54d2be6ac9291bf67b890.zip
char: use a const CharDriver
No need to allocate & copy fields, let's use static const struct instead.

Add an alias field to the CharDriver structure to cover the cases where
we previously registered a driver twice under two names.

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.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/backends/baum.c b/backends/baum.c
index b045ef49c5..2e404a11cc 100644
--- a/backends/baum.c
+++ b/backends/baum.c
@@ -671,8 +671,12 @@ fail_handle:
 
 static void register_types(void)
 {
-    register_char_driver("braille", CHARDEV_BACKEND_KIND_BRAILLE, NULL,
-                         chr_baum_init);
+    static const CharDriver driver = {
+        .kind = CHARDEV_BACKEND_KIND_BRAILLE,
+        .create = chr_baum_init,
+    };
+
+    register_char_driver(&driver);
 }
 
 type_init(register_types);