Re: Re: Hotplug events during sleep transition

Patrick Mochel
2005-12-27T21:09:53Z

On Mon, 26 Dec 2005, Dmitry Torokhov wrote:

> On Monday 26 December 2005 16:20, Patrick Mochel wrote:
> > > >  Unbinding and
> > > > rebinding do a whole lot more. A device does an entire round trip through
> > > > the driver core, which does a lot of crap. There are several memory
> > > > allocations, perhaps dozens of sysfs files created, and a handful of locks
> > > > taken adn lists traversed.
> > >
> > > No, you're thinking of unregistering and re-registering a device or
> > > driver.  Unbinding and rebinding is much simpler, although still somewhat
> > > complex.
> >
> > Ah, point taken; I was thinking that all USB devices were still
> > disconnected during a suspend transition..
> >
>
> Device removal could happen at any point, even during suspend transition.
> The kernel should be able to handle this scenario therefore implementation
> that assumes that device tree is frozen in flawed. As far as I understand
> the only thing that does not work at the moment is invoking hotplug handler.

I don't think that the tree should be assumed to be frozen. I just think
that we should try to avoid doing a full add or remove of a device (or
really, any object) while in a suspend or resume transition.

During normal system operation, how does a USB device get removed? Does it
happen via the USB hub thread? Forgive me for asking a question that's
probably been asked countless times, but is this thread running during a
suspend transition?

Would it be possible to simply mark the device as 'removed' and ignore it
until we resumed, and then clean it up (hotplug events and everything)?

Thanks,

Patrick