Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / base / power / runtime.c
index d901a6f..96370ec 100644 (file)
 
 static void runtime_resume(struct device * dev)
 {
-       if (!dev->power.power_state)
+       dev_dbg(dev, "resuming\n");
+       if (!dev->power.power_state.event)
                return;
-       resume_device(dev);
+       if (!resume_device(dev))
+               dev->power.power_state = PMSG_ON;
 }
 
 
@@ -22,9 +24,9 @@ static void runtime_resume(struct device * dev)
  *     dpm_runtime_resume - Power one device back on.
  *     @dev:   Device.
  *
- *     Bring one device back to the on state by first powering it 
+ *     Bring one device back to the on state by first powering it
  *     on, then restoring state. We only operate on devices that aren't
- *     already on. 
+ *     already on.
  *     FIXME: We need to handle devices that are in an unknown state.
  */
 
@@ -34,6 +36,7 @@ void dpm_runtime_resume(struct device * dev)
        runtime_resume(dev);
        up(&dpm_sem);
 }
+EXPORT_SYMBOL(dpm_runtime_resume);
 
 
 /**
@@ -42,25 +45,27 @@ void dpm_runtime_resume(struct device * dev)
  *     @state: State to enter.
  */
 
-int dpm_runtime_suspend(struct device * dev, u32 state)
+int dpm_runtime_suspend(struct device * dev, pm_message_t state)
 {
        int error = 0;
 
        down(&dpm_sem);
-       if (dev->power.power_state == state)
+       if (dev->power.power_state.event == state.event)
                goto Done;
 
-       if (dev->power.power_state)
+       if (dev->power.power_state.event)
                runtime_resume(dev);
 
-       if (!(error = suspend_device(dev,state)))
+       if (!(error = suspend_device(dev, state)))
                dev->power.power_state = state;
  Done:
        up(&dpm_sem);
        return error;
 }
+EXPORT_SYMBOL(dpm_runtime_suspend);
 
 
+#if 0
 /**
  *     dpm_set_power_state - Update power_state field.
  *     @dev:   Device.
@@ -68,12 +73,13 @@ int dpm_runtime_suspend(struct device * dev, u32 state)
  *
  *     This is an update mechanism for drivers to notify the core
  *     what power state a device is in. Device probing code may not
- *     always be able to tell, but we need accurate information to 
+ *     always be able to tell, but we need accurate information to
  *     work reliably.
  */
-void dpm_set_power_state(struct device * dev, u32 state)
+void dpm_set_power_state(struct device * dev, pm_message_t state)
 {
        down(&dpm_sem);
        dev->power.power_state = state;
        up(&dpm_sem);
 }
+#endif  /*  0  */