These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / base / power / main.c
index 3d874ec..1710c26 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/pm.h>
 #include <linux/pm_runtime.h>
 #include <linux/pm-trace.h>
+#include <linux/pm_wakeirq.h>
 #include <linux/interrupt.h>
 #include <linux/sched.h>
 #include <linux/async.h>
@@ -587,6 +588,7 @@ void dpm_resume_noirq(pm_message_t state)
        async_synchronize_full();
        dpm_show_time(starttime, state, "noirq");
        resume_device_irqs();
+       device_wakeup_disarm_wake_irqs();
        cpuidle_resume();
        trace_suspend_resume(TPS("dpm_resume_noirq"), state.event, false);
 }
@@ -920,9 +922,7 @@ static void device_complete(struct device *dev, pm_message_t state)
 
        if (callback) {
                pm_dev_dbg(dev, state, info);
-               trace_device_pm_callback_start(dev, info, state.event);
                callback(dev);
-               trace_device_pm_callback_end(dev, 0);
        }
 
        device_unlock(dev);
@@ -954,7 +954,9 @@ void dpm_complete(pm_message_t state)
                list_move(&dev->power.entry, &list);
                mutex_unlock(&dpm_list_mtx);
 
+               trace_device_pm_callback_start(dev, "", state.event);
                device_complete(dev, state);
+               trace_device_pm_callback_end(dev, 0);
 
                mutex_lock(&dpm_list_mtx);
                put_device(dev);
@@ -1104,6 +1106,7 @@ int dpm_suspend_noirq(pm_message_t state)
 
        trace_suspend_resume(TPS("dpm_suspend_noirq"), state.event, true);
        cpuidle_pause();
+       device_wakeup_arm_wake_irqs();
        suspend_device_irqs();
        mutex_lock(&dpm_list_mtx);
        pm_transition = state;
@@ -1374,7 +1377,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
        if (dev->power.direct_complete) {
                if (pm_runtime_status_suspended(dev)) {
                        pm_runtime_disable(dev);
-                       if (pm_runtime_suspended_if_enabled(dev))
+                       if (pm_runtime_status_suspended(dev))
                                goto Complete;
 
                        pm_runtime_enable(dev);
@@ -1585,11 +1588,8 @@ static int device_prepare(struct device *dev, pm_message_t state)
                callback = dev->driver->pm->prepare;
        }
 
-       if (callback) {
-               trace_device_pm_callback_start(dev, info, state.event);
+       if (callback)
                ret = callback(dev);
-               trace_device_pm_callback_end(dev, ret);
-       }
 
        device_unlock(dev);
 
@@ -1631,7 +1631,9 @@ int dpm_prepare(pm_message_t state)
                get_device(dev);
                mutex_unlock(&dpm_list_mtx);
 
+               trace_device_pm_callback_start(dev, "", state.event);
                error = device_prepare(dev, state);
+               trace_device_pm_callback_end(dev, error);
 
                mutex_lock(&dpm_list_mtx);
                if (error) {