[PATCH 1/2] PM: use dpm_run_callback in device_prepare

From: shuox . liu
Date: Fri Jun 07 2013 - 04:26:55 EST


From: ShuoX Liu <shuox.liu@xxxxxxxxx>

dpm_run_callback could show more debug info around prepare stage.

Signed-off-by: Zhang Yanmin <yanmin.zhang@xxxxxxxxx>
Signed-off-by: Liu ShuoX <shuox.liu@xxxxxxxxx>
---
drivers/base/power/main.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 5a9b656..cb89323 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -1223,7 +1223,7 @@ int dpm_suspend(pm_message_t state)
*/
static int device_prepare(struct device *dev, pm_message_t state)
{
- int (*callback)(struct device *) = NULL;
+ pm_callback_t callback = NULL;
char *info = NULL;
int error = 0;

@@ -1261,10 +1261,7 @@ static int device_prepare(struct device *dev, pm_message_t state)
callback = dev->driver->pm->prepare;
}

- if (callback) {
- error = callback(dev);
- suspend_report_result(callback, error);
- }
+ error = dpm_run_callback(callback, dev, state, info);

device_unlock(dev);

@@ -1280,6 +1277,7 @@ static int device_prepare(struct device *dev, pm_message_t state)
int dpm_prepare(pm_message_t state)
{
int error = 0;
+ ktime_t starttime = ktime_get();

might_sleep();

@@ -1311,6 +1309,7 @@ int dpm_prepare(pm_message_t state)
put_device(dev);
}
mutex_unlock(&dpm_list_mtx);
+ dpm_show_time(starttime, state, "prepare");
return error;
}

--
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/