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

Patrick Mochel
2002-10-15T16:26:40Z

> 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