diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2017-01-27 00:49:13 +0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2017-06-02 11:33:53 +0400 |
commit | 1ce2610c106d925387669b3133fc18ea986f0476 (patch) | |
tree | bd08c41941ea2235cabde4c02739f6ca52ff07d7 /hw/usb | |
parent | a9b1ca38c2b1f062f22d4847e3b4c848d0fb84c3 (diff) | |
download | qemu-1ce2610c106d925387669b3133fc18ea986f0476.zip qemu-1ce2610c106d925387669b3133fc18ea986f0476.tar.gz qemu-1ce2610c106d925387669b3133fc18ea986f0476.tar.bz2 |
char: make chr_fe_deinit() optionaly delete backend
This simplifies removing a backend for a frontend user (no need to
retrieve the associated driver and separate delete call etc).
NB: many frontends have questionable handling of ending a chardev. They
should probably delete the backend to prevent broken reusage.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'hw/usb')
-rw-r--r-- | hw/usb/ccid-card-passthru.c | 5 | ||||
-rw-r--r-- | hw/usb/redirect.c | 4 |
2 files changed, 2 insertions, 7 deletions
diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c index fed3683..ac1725e 100644 --- a/hw/usb/ccid-card-passthru.c +++ b/hw/usb/ccid-card-passthru.c @@ -264,10 +264,7 @@ static void ccid_card_vscard_handle_message(PassthruState *card, static void ccid_card_vscard_drop_connection(PassthruState *card) { - Chardev *chr = qemu_chr_fe_get_driver(&card->cs); - - qemu_chr_fe_deinit(&card->cs); - object_unparent(OBJECT(chr)); + qemu_chr_fe_deinit(&card->cs, true); card->vscard_in_pos = card->vscard_in_hdr = 0; } diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index d2b3a84..aa22d69 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -1419,10 +1419,8 @@ static void usbredir_cleanup_device_queues(USBRedirDevice *dev) static void usbredir_unrealize(USBDevice *udev, Error **errp) { USBRedirDevice *dev = USB_REDIRECT(udev); - Chardev *chr = qemu_chr_fe_get_driver(&dev->cs); - qemu_chr_fe_deinit(&dev->cs); - object_unparent(OBJECT(chr)); + qemu_chr_fe_deinit(&dev->cs, true); /* Note must be done after qemu_chr_close, as that causes a close event */ qemu_bh_delete(dev->chardev_close_bh); |