All of lore.kernel.org
 help / color / mirror / Atom feed
From: Magnus Damm <magnus.damm@gmail.com>
To: linux-pm@lists.linux-foundation.org
Cc: gregkh@suse.de
Subject: [PATCH 03/05] PM: Runtime PM v13 - add debug printouts
Date: Fri, 07 Aug 2009 16:33:42 +0900	[thread overview]
Message-ID: <20090807073342.22479.85640.sendpatchset@rx1.opensource.se> (raw)
In-Reply-To: <20090807073315.22479.89012.sendpatchset@rx1.opensource.se>

From: Magnus Damm <damm@igel.co.jp>

This patch adds dev_dbg() printouts to the Runtime PM
code. Just add a #define DEBUG at the top of the file
to get suspend and resume printouts. Also add a missing
newline to the pm_runtime_enable() printout while at it.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 Can this patch be rolled into the main Runtime PM patch?

 Changes for v11->v13:
 - solved conflicts introduced by v11->v13 update

 drivers/base/power/runtime.c |   32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

--- 0009/drivers/base/power/runtime.c
+++ work/drivers/base/power/runtime.c	2009-08-07 13:55:20.000000000 +0900
@@ -125,13 +125,19 @@ int __pm_runtime_suspend(struct device *
 	bool notify = false;
 	int retval = 0;
 
+	dev_dbg(dev, "__pm_runtime_suspend() %d!\n", from_wq);
  repeat:
-	if (dev->power.runtime_error)
-		return -EINVAL;
+	if (dev->power.runtime_error) {
+		retval = -EINVAL;
+		goto out;
+	}
 
 	/* Pending resume requests take precedence over us. */
-	if (dev->power.request_pending && dev->power.request == RPM_REQ_RESUME)
-			return -EAGAIN;
+	if (dev->power.request_pending
+	    && dev->power.request == RPM_REQ_RESUME) {
+		retval = -EAGAIN;
+		goto out;
+	}
 
 	/* Other scheduled or pending requests need to be canceled. */
 	pm_runtime_cancel_pending(dev);
@@ -145,13 +151,15 @@ int __pm_runtime_suspend(struct device *
 	else if (!pm_children_suspended(dev))
 		retval = -EBUSY;
 	if (retval)
-		return retval;
+		goto out;
 
 	if (dev->power.runtime_status == RPM_SUSPENDING) {
 		DEFINE_WAIT(wait);
 
-		if (from_wq)
-			return -EINPROGRESS;
+		if (from_wq) {
+			retval = -EINPROGRESS;
+			goto out;
+		}
 
 		/* Wait for the other suspend running in parallel with us. */
 		for (;;) {
@@ -200,7 +208,8 @@ int __pm_runtime_suspend(struct device *
 	if (dev->power.deferred_resume) {
 		dev->power.deferred_resume = false;
 		__pm_runtime_resume(dev, false);
-		return -EAGAIN;
+		retval = -EAGAIN;
+		goto out;
 	}
 
 	if (notify)
@@ -213,6 +222,8 @@ int __pm_runtime_suspend(struct device *
 
 		spin_lock_irq(&dev->power.lock);
 	}
+ out:
+	dev_dbg(dev, "__pm_runtime_suspend() returns %d!\n", retval);
 
 	return retval;
 }
@@ -252,6 +263,7 @@ int __pm_runtime_resume(struct device *d
 	struct device *parent = NULL;
 	int retval = 0;
 
+	dev_dbg(dev, "__pm_runtime_resume() %d!\n", from_wq);
  repeat:
 	if (dev->power.runtime_error) {
 		retval = -EINVAL;
@@ -358,6 +370,8 @@ int __pm_runtime_resume(struct device *d
 		spin_lock_irq(&dev->power.lock);
 	}
 
+	dev_dbg(dev, "__pm_runtime_resume() returns %d!\n", retval);
+
 	return retval;
 }
 
@@ -795,7 +809,7 @@ void pm_runtime_enable(struct device *de
 	if (dev->power.disable_depth > 0)
 		dev->power.disable_depth--;
 	else
-		dev_warn(dev, "Unbalanced %s!", __func__);
+		dev_warn(dev, "Unbalanced %s!\n", __func__);
 
 	spin_unlock_irqrestore(&dev->power.lock, flags);
 }

  parent reply	other threads:[~2009-08-07  7:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-07  7:33 [PATCH 00/05] PM: Runtime PM v13 for Platform Devices 20090807 Magnus Damm
2009-08-07  7:33 ` [PATCH 01/05] PM: Runtime PM v13 - add dev_pm_ops helpers Magnus Damm
2009-08-07  7:33 ` [PATCH 02/05] PM: Runtime PM v13 - let bus-less devices succeed Magnus Damm
2009-08-07  7:33 ` Magnus Damm [this message]
2009-08-08 13:28   ` [PATCH 03/05] PM: Runtime PM v13 - add debug printouts Rafael J. Wysocki
2009-08-07  7:33 ` [PATCH 04/05] PM: Runtime PM v13 - CONFIG_PM_SLEEP=n support Magnus Damm
2009-08-07  7:34 ` [PATCH 05/05] PM: Runtime PM v13 - platform device bus support Magnus Damm
2009-08-07 14:32 ` [PATCH 00/05] PM: Runtime PM v13 for Platform Devices 20090807 Alan Stern
2009-08-07 15:42   ` Magnus Damm
2009-08-07 16:17     ` Alan Stern
2009-08-08 13:47       ` Rafael J. Wysocki
2009-08-10 10:57       ` Magnus Damm

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=20090807073342.22479.85640.sendpatchset@rx1.opensource.se \
    --to=magnus.damm@gmail.com \
    --cc=gregkh@suse.de \
    --cc=linux-pm@lists.linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.