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 <kra...@redhat.com>
> To: Shahar Havivi <shah...@redhat.com>
> CC: "David S. Ahern" <daah...@cisco.com>,
> Markus Armbruster <arm...@redhat.com>, 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?