From c39860e6dc90f6ee2e82ee078f978c5d7f3df86a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Sat, 22 Oct 2016 12:52:58 +0300 Subject: char: replace qemu_chr_claim/release with qemu_chr_fe_init/deinit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that all front end use qemu_chr_fe_init(), we can move chardev claiming in init(), and add a function deinit() to release the chardev and cleanup handlers. The qemu_chr_fe_claim_no_fail() for property are gone, since the property will raise an error instead. In other cases, where there is already an error path, an error is raised instead. Finally, other cases are handled by &error_abort in qemu_chr_fe_init(). Signed-off-by: Marc-André Lureau Message-Id: <20161022095318.17775-19-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- hw/usb/ccid-card-passthru.c | 1 + hw/usb/redirect.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'hw/usb') diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c index a8c8684..369a8f1 100644 --- a/hw/usb/ccid-card-passthru.c +++ b/hw/usb/ccid-card-passthru.c @@ -266,6 +266,7 @@ static void ccid_card_vscard_drop_connection(PassthruState *card) { CharDriverState *chr = qemu_chr_fe_get_driver(&card->cs); + qemu_chr_fe_deinit(&card->cs); qemu_chr_delete(chr); card->vscard_in_pos = card->vscard_in_hdr = 0; } diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 0fb2e9a..6f5ad20 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -1430,9 +1430,9 @@ static void usbredir_handle_destroy(USBDevice *udev) USBRedirDevice *dev = USB_REDIRECT(udev); CharDriverState *chr = qemu_chr_fe_get_driver(&dev->cs); + qemu_chr_fe_deinit(&dev->cs); qemu_chr_delete(chr); - dev->cs.chr = NULL; /* Note must be done after qemu_chr_close, as that causes a close event */ qemu_bh_delete(dev->chardev_close_bh); qemu_bh_delete(dev->device_reject_bh); -- cgit v1.1