From 0b812f31925f2ed50eb54d2be6ac9291bf67b890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 21 Oct 2016 16:07:45 +0300 Subject: char: use a const CharDriver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- backends/msmouse.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'backends/msmouse.c') diff --git a/backends/msmouse.c b/backends/msmouse.c index 733ca80..2490b2c 100644 --- a/backends/msmouse.c +++ b/backends/msmouse.c @@ -179,8 +179,11 @@ static CharDriverState *qemu_chr_open_msmouse(const char *id, static void register_types(void) { - register_char_driver("msmouse", CHARDEV_BACKEND_KIND_MSMOUSE, NULL, - qemu_chr_open_msmouse); + static const CharDriver driver = { + .kind = CHARDEV_BACKEND_KIND_MSMOUSE, + .create = qemu_chr_open_msmouse, + }; + register_char_driver(&driver); } type_init(register_types); -- cgit v1.1