Re: Patch: linux-2.5.42/kernel/sys.c - warm reboot should not suspend devices

From: Patrick Mochel (mochel@osdl.org)
Date: Tue Oct 15 2002 - 11:35:07 EST


> device_shutdown and device_suspend are for power management.
> It is important to turn the device off as soon as possible if a power
> management routine has told you that the device is not going to be
> used any more.

device_suspend() is for power management. device_shutdown() is for
quiescing devices before a system reboot or power off.

It's true that the same function is called when the device is physically
removed from the system as when the system is shutting down, and that
might be kinda bad. If it gets to the point where it's really difficult to
deal with for drivers, we can create another callback: ->shutdown() for
struct device_driver.

> If you've identified a bunch of devices that need
> reboot_notifier, please list them so we can fix them rather than
> taxing the users with unnecessarily slow reboots or poor battery life
> (due to device not being shut down when they are no longer being used).

No, reboot notifiers are the completely wrong way to go, for one reason
alone: ordering. device_shutdown() does a depth-first walk of the tree to
shut down children devices before ancestors. You cannot guarantee that
with reboot notifiers.

Please don't try and convolute the code because you're worried about a few
microseconds. It's about correctness first; then we can worry about
micro-optimizing the hell out of it.

        -pat

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Oct 15 2002 - 22:00:55 EST