On Wed, 26 Mar 2008, Oliver Neukum wrote: > Am Mittwoch, 26. März 2008 15:10:01 schrieb Alan Stern: > > > > IMO you must always keep the ordering invariant. If a parent returns an error > > > > the PM core must not wake its children. > > > > Don't think of it that way. The PM core doesn't wake anything. It > > merely notifies drivers that the system sleep is ending, so that the > > drivers can wake their devices. It's up to the driver to detect > > whether the parent failed to resume, in which case the driver should > > take appropriate action. > > How do you propose that every driver should check the power state > of its parent? Without locking the parent? It depends entirely on the driver and subsystem; generalizations are not possible. When appropriate, they can copy the scheme used by USB. Or they can make up their own scheme. > > The situation is no different from what happens when the user tries to > > access a mounted USB disk drive after the USB cable has been unplugged. > > The drivers take care of everything. > > That completely throws away the reason to have a PM core. Nonsense. > We've made > a guarantee to drivers that they wil not be woken unless their parents are > awake. No we haven't. The guarantee is only that the PM core will call the parent's resume method before calling the child's method. There is no guarantee about whether the method succeeds or the parent is awake. Remember, the whole purpose of this is to let drivers know when the system is going to sleep or waking up. Proper handling of devices is up to the drivers, not up to the core. > In fact the semantics of the callbacks are defined in a way that > adding devices to a parent can be enabled. You cannot add children to a > dead parent. Depends what you mean. In some cases it is possible -- i.e., you can do it and the kernel won't crash, although the new children probably won't be usable. In any case it doesn't matter; the PM core doesn't care whether children are added to a dead parent, only drivers care. > It's the very reason for this rewrite. No it isn't. See Rafael's changelog ocmments; the rewrite is being done for completely different reasons. Alan Stern _______________________________________________ linux-pm mailing list linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/linux-pm