]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] Leave runtime suspended devices off at system resume
authorTodd Poynor <tpoynor@mvista.com>
Fri, 28 May 2004 03:04:44 +0000 (20:04 -0700)
committerGreg Kroah-Hartman <greg@kroah.com>
Fri, 28 May 2004 03:04:44 +0000 (20:04 -0700)
Currently all devices are resumed at system resume time, including any
that were individually powered off ("at runtime") prior to the system
suspend.  In certain cases it can be nice to force back on individually
suspended devices, such as the display, but hopefully this policy can be
left up to userspace power managers; the kernel should probably honor
the settings previously made by userspace/drivers.  This seems
preferable to requiring a power-conscious system to re-suspend devices
after a system resume; furthermore, for certain platforms (such as
XScale PXA27X) there can be disastrous consequences of powering up
devices when the system is in a state incompatible with operation of the
device.

Suggested patch does this:

(1) At system resume, checks power_state to see if the device was
suspended prior to system suspend, and skips powering on the device if
so.

(2) Does not re-suspend an already-suspended device at system suspend
(using a different method than is currently employed, which reorders the
list, see #3).

(3) Preserves the active/off device list order despite the above changes
to suspend/resume behavior, to avoid dependency problems that tend to
occur when the list is reordered.

Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/base/power/resume.c
drivers/base/power/suspend.c

index 637c52ad6ec6dc0ffde415669849680d5d883746..90632b9ea95fa585c9ca7457e444f6ceacf6935e 100644 (file)
@@ -35,7 +35,10 @@ void dpm_resume(void)
                struct list_head * entry = dpm_off.next;
                struct device * dev = to_device(entry);
                list_del_init(entry);
-               resume_device(dev);
+
+               if (!dev->power.power_state)
+                       resume_device(dev);
+
                list_add_tail(entry,&dpm_active);
        }
 }
index 77224ce22240facc9b3cc2c8fb68feedb9537458..4e93793ad2202aa56a9f14b440a77407a32de272 100644 (file)
@@ -39,7 +39,7 @@ int suspend_device(struct device * dev, u32 state)
 {
        int error = 0;
 
-       if (dev->bus && dev->bus->suspend)
+       if (dev->bus && dev->bus->suspend && !dev->power.power_state)
                error = dev->bus->suspend(dev,state);
 
        return error;