* [Qemu-devel] [PATCH 0/2 v5] Release usb devices on shutdown and usb_del @ 2010-06-16 12:15 Shahar Havivi 2010-06-16 12:15 ` [Qemu-devel] [PATCH 1/2] Return usb device to host on usb_del command Shahar Havivi ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: Shahar Havivi @ 2010-06-16 12:15 UTC (permalink / raw) To: Gerd Hoffmann, qemu-devel v5: Fix to Gerd Hoffmann comments on v4. Shahar Havivi (2): Return usb device to host on usb_del command Return usb device to host on exit usb-linux.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 1/2] Return usb device to host on usb_del command 2010-06-16 12:15 [Qemu-devel] [PATCH 0/2 v5] Release usb devices on shutdown and usb_del Shahar Havivi @ 2010-06-16 12:15 ` Shahar Havivi 2010-06-16 12:16 ` [Qemu-devel] [PATCH 2/2] Return usb device to host on exit Shahar Havivi ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: Shahar Havivi @ 2010-06-16 12:15 UTC (permalink / raw) To: Gerd Hoffmann, qemu-devel Signed-off-by: Shahar Havivi <shaharh@redhat.com> --- usb-linux.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/usb-linux.c b/usb-linux.c index 88273ff..22a85e3 100644 --- a/usb-linux.c +++ b/usb-linux.c @@ -991,6 +991,7 @@ static int usb_host_close(USBHostDevice *dev) async_complete(dev); dev->closing = 0; usb_device_detach(&dev->dev); + ioctl(dev->fd, USBDEVFS_RESET); close(dev->fd); dev->fd = -1; return 0; -- 1.7.0.4 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 2/2] Return usb device to host on exit 2010-06-16 12:15 [Qemu-devel] [PATCH 0/2 v5] Release usb devices on shutdown and usb_del Shahar Havivi 2010-06-16 12:15 ` [Qemu-devel] [PATCH 1/2] Return usb device to host on usb_del command Shahar Havivi @ 2010-06-16 12:16 ` Shahar Havivi 2010-06-16 13:17 ` [Qemu-devel] Re: [PATCH 0/2 v5] Release usb devices on shutdown and usb_del Gerd Hoffmann 2010-06-30 20:52 ` [Qemu-devel] " Aurelien Jarno 3 siblings, 0 replies; 5+ messages in thread From: Shahar Havivi @ 2010-06-16 12:16 UTC (permalink / raw) To: Gerd Hoffmann, qemu-devel Signed-off-by: Shahar Havivi <shaharh@redhat.com> --- usb-linux.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/usb-linux.c b/usb-linux.c index 22a85e3..c3c38ec 100644 --- a/usb-linux.c +++ b/usb-linux.c @@ -33,6 +33,7 @@ #include "qemu-common.h" #include "qemu-timer.h" #include "monitor.h" +#include "sysemu.h" #include <dirent.h> #include <sys/ioctl.h> @@ -132,6 +133,7 @@ typedef struct USBHostDevice { int configuration; int ninterfaces; int closing; + Notifier exit; struct ctrl_struct ctrl; struct endp_data endp_table[MAX_ENDPOINTS]; @@ -404,6 +406,7 @@ static void usb_host_handle_destroy(USBDevice *dev) usb_host_close(s); QTAILQ_REMOVE(&hostdevs, s, next); + qemu_remove_exit_notifier(&s->exit); } static int usb_linux_update_endp_table(USBHostDevice *s); @@ -997,6 +1000,15 @@ static int usb_host_close(USBHostDevice *dev) return 0; } +static void usb_host_exit_notifier(struct Notifier* n) +{ + USBHostDevice *s = container_of(n, USBHostDevice, exit); + + if (s->fd != -1) { + ioctl(s->fd, USBDEVFS_RESET); + } +} + static int usb_host_initfn(USBDevice *dev) { USBHostDevice *s = DO_UPCAST(USBHostDevice, dev, dev); @@ -1004,6 +1016,8 @@ static int usb_host_initfn(USBDevice *dev) dev->auto_attach = 0; s->fd = -1; QTAILQ_INSERT_TAIL(&hostdevs, s, next); + s->exit.notify = usb_host_exit_notifier; + qemu_add_exit_notifier(&s->exit); usb_host_auto_check(NULL); return 0; } -- 1.7.0.4 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] Re: [PATCH 0/2 v5] Release usb devices on shutdown and usb_del 2010-06-16 12:15 [Qemu-devel] [PATCH 0/2 v5] Release usb devices on shutdown and usb_del Shahar Havivi 2010-06-16 12:15 ` [Qemu-devel] [PATCH 1/2] Return usb device to host on usb_del command Shahar Havivi 2010-06-16 12:16 ` [Qemu-devel] [PATCH 2/2] Return usb device to host on exit Shahar Havivi @ 2010-06-16 13:17 ` Gerd Hoffmann 2010-06-30 20:52 ` [Qemu-devel] " Aurelien Jarno 3 siblings, 0 replies; 5+ messages in thread From: Gerd Hoffmann @ 2010-06-16 13:17 UTC (permalink / raw) To: Shahar Havivi; +Cc: qemu-devel On 06/16/10 14:15, Shahar Havivi wrote: > v5: > Fix to Gerd Hoffmann comments on v4. > > Shahar Havivi (2): > Return usb device to host on usb_del command > Return usb device to host on exit Looks fine to me now. Acked-by: Gerd Hoffmann <kraxel@redhat.com> cheers, Gerd ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2 v5] Release usb devices on shutdown and usb_del 2010-06-16 12:15 [Qemu-devel] [PATCH 0/2 v5] Release usb devices on shutdown and usb_del Shahar Havivi ` (2 preceding siblings ...) 2010-06-16 13:17 ` [Qemu-devel] Re: [PATCH 0/2 v5] Release usb devices on shutdown and usb_del Gerd Hoffmann @ 2010-06-30 20:52 ` Aurelien Jarno 3 siblings, 0 replies; 5+ messages in thread From: Aurelien Jarno @ 2010-06-30 20:52 UTC (permalink / raw) To: Shahar Havivi; +Cc: Gerd Hoffmann, qemu-devel On Wed, Jun 16, 2010 at 03:15:03PM +0300, Shahar Havivi wrote: > v5: > Fix to Gerd Hoffmann comments on v4. > > Shahar Havivi (2): > Return usb device to host on usb_del command > Return usb device to host on exit > > usb-linux.c | 15 +++++++++++++++ > 1 files changed, 15 insertions(+), 0 deletions(-) > > > Thanks, both applied. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-06-30 21:08 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-06-16 12:15 [Qemu-devel] [PATCH 0/2 v5] Release usb devices on shutdown and usb_del Shahar Havivi 2010-06-16 12:15 ` [Qemu-devel] [PATCH 1/2] Return usb device to host on usb_del command Shahar Havivi 2010-06-16 12:16 ` [Qemu-devel] [PATCH 2/2] Return usb device to host on exit Shahar Havivi 2010-06-16 13:17 ` [Qemu-devel] Re: [PATCH 0/2 v5] Release usb devices on shutdown and usb_del Gerd Hoffmann 2010-06-30 20:52 ` [Qemu-devel] " Aurelien Jarno
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).