public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: shuox.liu@intel.com
To: linux-kernel@vger.kernel.org
Cc: linux-pm@vger.kernel.org, pavel@ucw.cz, rjw@sisk.pl,
	len.brown@intel.com, gregkh@linuxfoundation.org,
	yanmin_zhang@linux.intel.com, ShuoX Liu <shuox.liu@intel.com>,
	Zhang Yanmin <yanmin.zhang@intel.com>
Subject: [PATCH 2/2] PM: add dpm_run_callback_void and use it in device_complete
Date: Fri,  7 Jun 2013 16:20:32 +0800	[thread overview]
Message-ID: <1370593232-3602-3-git-send-email-shuox.liu@intel.com> (raw)
In-Reply-To: <1370593232-3602-1-git-send-email-shuox.liu@intel.com>

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

dpm_run_callback_void could show more debug info around complete stage

Signed-off-by: Zhang Yanmin <yanmin.zhang@intel.com>
Signed-off-by: Liu ShuoX <shuox.liu@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


  parent reply	other threads:[~2013-06-07  8:27 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-07  8:20 [PATCH 0/2] Run callback of device_prepare/complete consistently shuox.liu
2013-06-07  8:20 ` [PATCH 1/2] PM: use dpm_run_callback in device_prepare shuox.liu
2013-06-07 17:37   ` Greg KH
2013-06-08  0:43     ` Yanmin Zhang
2013-06-08  1:15       ` Greg KH
2013-06-08  1:21         ` Yanmin Zhang
2013-06-07  8:20 ` shuox.liu [this message]
2013-06-07 17:38   ` [PATCH 2/2] PM: add dpm_run_callback_void and use it in device_complete Greg KH
2013-06-07 10:36 ` [PATCH 0/2] Run callback of device_prepare/complete consistently Rafael J. Wysocki
2013-06-08  0:42   ` Yanmin Zhang
2013-06-08  0:54     ` Rafael J. Wysocki
2013-06-08  1:17       ` Yanmin Zhang
2013-06-08  1:25         ` Rafael J. Wysocki
2013-06-08  1:16     ` Greg KH
2013-06-08  1:30       ` Rafael J. Wysocki
2013-06-08  1:36         ` Yanmin Zhang
2013-06-08  1:52           ` Rafael J. Wysocki
2013-06-08  2:37             ` Yanmin Zhang
2013-06-08 10:54               ` Rafael J. Wysocki
2013-06-09  8:11                 ` ShuoX Liu
2013-06-08  1:30       ` Yanmin Zhang
2013-06-10 11:50   ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1370593232-3602-3-git-send-email-shuox.liu@intel.com \
    --to=shuox.liu@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rjw@sisk.pl \
    --cc=yanmin.zhang@intel.com \
    --cc=yanmin_zhang@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox