diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2016-10-21 16:07:45 +0300 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2017-01-27 18:07:58 +0100 |
commit | 0b812f31925f2ed50eb54d2be6ac9291bf67b890 (patch) | |
tree | 8a51007dff4c1b2d7a6d004a06ac53a6059c0358 /ui/console.c | |
parent | bd1caa3f8e8e63b9ac4cbcbee5a2dee3587fd852 (diff) |
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 'ui/console.c')
-rw-r--r-- | ui/console.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ui/console.c b/ui/console.c index b9575f2ee5..e4bb22fe87 100644 --- a/ui/console.c +++ b/ui/console.c @@ -2191,12 +2191,16 @@ static const TypeInfo qemu_console_info = { .class_size = sizeof(QemuConsoleClass), }; - static void register_types(void) { + static const CharDriver vc_driver = { + .kind = CHARDEV_BACKEND_KIND_VC, + .parse = qemu_chr_parse_vc, + .create = vc_init, + }; + type_register_static(&qemu_console_info); - register_char_driver("vc", CHARDEV_BACKEND_KIND_VC, qemu_chr_parse_vc, - vc_init); + register_char_driver(&vc_driver); } type_init(register_types); |