mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-31 05:51:53 -06:00
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>
This commit is contained in:
parent
bd1caa3f8e
commit
0b812f3192
7 changed files with 150 additions and 85 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue