[PATCH 2/2] PM: add dpm_run_callback_void and use it in device_complete

From: shuox . liu
Date: Fri Jun 07 2013 - 04:27:19 EST


From: ShuoX Liu <shuox.liu@xxxxxxxxx>

dpm_run_callback_void could show more debug info around complete stage

Signed-off-by: Zhang Yanmin <yanmin.zhang@xxxxxxxxx>
Signed-off-by: Liu ShuoX <shuox.liu@xxxxxxxxx>
---
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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/