From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=42237 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHCIO-0003wP-8e for qemu-devel@nongnu.org; Wed, 26 May 2010 04:49:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OHCIL-0005TT-Vv for qemu-devel@nongnu.org; Wed, 26 May 2010 04:48:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24544) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OHCIL-0005Se-OJ for qemu-devel@nongnu.org; Wed, 26 May 2010 04:48:57 -0400 Date: Wed, 26 May 2010 11:48:11 +0300 From: Shahar Havivi Message-ID: <20100526084810.GB26055@redhat.com> References: <20100521175520.GA25276@redhat.com> <4BFB914A.3050903@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4BFB914A.3050903@redhat.com> Subject: [Qemu-devel] Re: [PATCH] Release usb devices on shutdown and usb_del command List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: Markus Armbruster , "David S. Ahern" , qemu-devel@nongnu.org On Tue, May 25, 2010 at 10:58:50AM +0200, Gerd Hoffmann wrote: > Date: Tue, 25 May 2010 10:58:50 +0200 > From: Gerd Hoffmann > To: Shahar Havivi > CC: "David S. Ahern" , > Markus Armbruster , qemu-devel@nongnu.org > Subject: Re: [PATCH] Release usb devices on shutdown and usb_del command > > On 05/21/10 19:55, Shahar Havivi wrote: > >Remove usb_host_device_release and using usb_host_close to handle usb_del command. > >Gerd, What do you think about the usb_cleanup()? > > We need a mechanism to handle this for sure. I don't like that > usb-specific approach very much though. > > I think we should either do that at qdev level, then at exit walk > the whole device tree and call cleanup functions (if present). So > every device has the chance to do cleanups when needed. > > Or we could have a exit notifier, which can be used for device (and > also other) cleanup work. > > I tend to think that a exit notifier will be better. We probably > have only a few devices which actually have to do some cleanup work > (usb passthrough, maybe pci passthrough too), so building qdev > infrastructure for that feels a bit like overkill. And exit > notifiers are more generic, i.e. it will also work for non-device > stuff. > > cheers, > Gerd > We can add at exit to the first device that added in usb-linux.c via usb_host_device_open() or usb_host_initfn() and the exit will iterate all usb devices in linux only, How is that solution?