Re: Re: Hotplug events during sleep transition

Alan Stern
2005-12-30T17:46:52Z

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1256 bytes --]

On Thu, 29 Dec 2005, Nigel Cunningham wrote:

> > Often the device-specific resume routine doesn't have the information
> > needed for checking whether the device is still there. Such checks are
> > done by generic bus-oriented routines.
> >
> > Yes, the bus's resume handler can do such a check. Why should it bother,
> > when other parts of the bus code will detect the device removal in the
> > normal course of events? Or alternatively, why shouldn't the bus's resume
> > handler simply invoke those other parts of the bus code when it determines
> > that a device has been removed?
>
> I guess because the resume routine is almost certainly the first piece
> of code that will try to access the hardware (and possibly choke and die
> it it's not there).

Obviously we want the resume routine to be robust enough not to die if the
device was removed while the system was suspended. :-)

As for the rest, however, it simply is not resume()'s job to check whether
the device is still there. That job belongs to another piece of code.

Consider this: What would happen if the system _hadn't_ been suspended
when the device was removed? Why shouldn't the same thing happen if the
system _is_ suspended when the device is removed?

Alan Stern