From: Peter Chen <peter.chen@freescale.com>
To: linux-pm@lists.linux-foundation.org
Cc: hzpeterchen@gmail.com
Subject: [PATCH 1/1] PM / Runtime: Do not send suspend request after the device is shutdown
Date: Wed, 9 Nov 2011 17:42:15 +0800 [thread overview]
Message-ID: <1320831735-28640-1-git-send-email-peter.chen@freescale.com> (raw)
There may be an issue when the user issue "reboot" command, then the
device has shut down its hardware, after that, this runtime-pm featured
device's driver will probably be scheduled to do its suspend routine,
and at its suspend routine, it may access hardware, but the device has
already shutdown physically, then the system hang may be occurred.
I ran out this issue with a auto-suspend supported USB devices, like
3G modem, keyboard. The usb runtime suspend routine may be scheduled
after the usb controller has been shut down, and the usb runtime suspend
routine will try to suspend its roothub(controller), it will access
register, then the system hang occurs as the controller is shutdown.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
---
drivers/base/power/runtime.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index acb3f83..a439227 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -150,6 +150,13 @@ static int rpm_check_suspend_allowed(struct device *dev)
retval = -EAGAIN;
else if (dev->power.runtime_status == RPM_SUSPENDED)
retval = 1;
+ /*
+ * If the device has already been shut down, DO NOT
+ * send suspend request.
+ */
+ else if (list_empty(&dev->kobj.entry)) {
+ retval = -ESHUTDOWN;
+ }
return retval;
}
--
1.7.1
reply other threads:[~2011-11-09 9:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1320831735-28640-1-git-send-email-peter.chen@freescale.com \
--to=peter.chen@freescale.com \
--cc=hzpeterchen@gmail.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).