From 88cace9f119b85ac2d40a8b10c24e05ccfa6da07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 9 Dec 2016 00:50:12 +0300 Subject: char: get rid of CharDriver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qemu_chr_new_from_opts() is modified to not need CharDriver backend[] array, but uses instead objectified qmp_query_chardev_backends() and char_get_class(). The alias field is moved outside in a ChardevAlias[], similar to QDevAlias for devices. "kind" and "parse" are moved to ChardevClass ("kind" is to be removed next) Signed-off-by: Marc-André Lureau Reviewed-by: Eric Blake --- backends/baum.c | 6 +----- backends/msmouse.c | 6 +----- backends/testdev.c | 6 +----- 3 files changed, 3 insertions(+), 15 deletions(-) (limited to 'backends') diff --git a/backends/baum.c b/backends/baum.c index 39c9365024..5316c8da0a 100644 --- a/backends/baum.c +++ b/backends/baum.c @@ -656,6 +656,7 @@ static void char_braille_class_init(ObjectClass *oc, void *data) { ChardevClass *cc = CHARDEV_CLASS(oc); + cc->kind = CHARDEV_BACKEND_KIND_BRAILLE; cc->open = baum_chr_open; cc->chr_write = baum_chr_write; cc->chr_accept_input = baum_chr_accept_input; @@ -671,11 +672,6 @@ static const TypeInfo char_braille_type_info = { static void register_types(void) { - static const CharDriver driver = { - .kind = CHARDEV_BACKEND_KIND_BRAILLE, - }; - - register_char_driver(&driver); type_register_static(&char_braille_type_info); } diff --git a/backends/msmouse.c b/backends/msmouse.c index 55c344f0e1..28689b3e29 100644 --- a/backends/msmouse.c +++ b/backends/msmouse.c @@ -169,6 +169,7 @@ static void char_msmouse_class_init(ObjectClass *oc, void *data) { ChardevClass *cc = CHARDEV_CLASS(oc); + cc->kind = CHARDEV_BACKEND_KIND_MSMOUSE; cc->open = msmouse_chr_open; cc->chr_write = msmouse_chr_write; cc->chr_accept_input = msmouse_chr_accept_input; @@ -184,11 +185,6 @@ static const TypeInfo char_msmouse_type_info = { static void register_types(void) { - static const CharDriver driver = { - .kind = CHARDEV_BACKEND_KIND_MSMOUSE, - }; - - register_char_driver(&driver); type_register_static(&char_msmouse_type_info); } diff --git a/backends/testdev.c b/backends/testdev.c index ea15143713..243454aaa3 100644 --- a/backends/testdev.c +++ b/backends/testdev.c @@ -111,6 +111,7 @@ static void char_testdev_class_init(ObjectClass *oc, void *data) { ChardevClass *cc = CHARDEV_CLASS(oc); + cc->kind = CHARDEV_BACKEND_KIND_TESTDEV; cc->chr_write = testdev_chr_write; } @@ -123,11 +124,6 @@ static const TypeInfo char_testdev_type_info = { static void register_types(void) { - static const CharDriver driver = { - .kind = CHARDEV_BACKEND_KIND_TESTDEV, - }; - - register_char_driver(&driver); type_register_static(&char_testdev_type_info); } -- cgit v1.2.3