From: ShuoX Liu <shuox....@intel.com>

dpm_run_callback_void could show more debug info around complete stage

Signed-off-by: Zhang Yanmin <yanmin.zh...@intel.com>
Signed-off-by: Liu ShuoX <shuox....@intel.com>
---
 drivers/base/power/main.c |   27 ++++++++++++++++++++++-----
 1 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index cb89323..7021491 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -33,6 +33,7 @@
 #include "power.h"
 
 typedef int (*pm_callback_t)(struct device *);
+typedef void (*pm_callback_void_t)(struct device *);
 
 /*
  * The entries in the dpm_list list are in a depth first order, simply
@@ -384,6 +385,23 @@ static int dpm_run_callback(pm_callback_t cb, struct 
device *dev,
        return error;
 }
 
+static void dpm_run_callback_void(pm_callback_void_t cb, struct device *dev,
+                           pm_message_t state, char *info)
+{
+       ktime_t calltime;
+       int error;
+
+       if (!cb)
+               return;
+
+       calltime = initcall_debug_start(dev);
+
+       pm_dev_dbg(dev, state, info);
+       cb(dev);
+
+       initcall_debug_report(dev, calltime, error);
+}
+
 /*------------------------- Resume routines -------------------------*/
 
 /**
@@ -722,7 +740,7 @@ void dpm_resume(pm_message_t state)
  */
 static void device_complete(struct device *dev, pm_message_t state)
 {
-       void (*callback)(struct device *) = NULL;
+       pm_callback_void_t callback = NULL;
        char *info = NULL;
 
        if (dev->power.syscore)
@@ -749,10 +767,7 @@ static void device_complete(struct device *dev, 
pm_message_t state)
                callback = dev->driver->pm->complete;
        }
 
-       if (callback) {
-               pm_dev_dbg(dev, state, info);
-               callback(dev);
-       }
+       dpm_run_callback_void(callback, dev, state, info);
 
        device_unlock(dev);
 
@@ -769,6 +784,7 @@ static void device_complete(struct device *dev, 
pm_message_t state)
 void dpm_complete(pm_message_t state)
 {
        struct list_head list;
+       ktime_t starttime = ktime_get();
 
        might_sleep();
 
@@ -789,6 +805,7 @@ void dpm_complete(pm_message_t state)
        }
        list_splice(&list, &dpm_list);
        mutex_unlock(&dpm_list_mtx);
+       dpm_show_time(starttime, state, "complete");
 }
 
 /**
-- 
1.7.1

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

Reply via email to