From: "Liu, Chuansheng" <chuansheng.liu@intel.com>
To: rjw@rjwysocki.net, gregkh@linuxfoundation.org, pavel@ucw.cz,
len.brown@intel.com
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
chuansheng.liu@intel.com, zhuangzhi.li@intel.com
Subject: [PATCH 1/5] PM: Adding two flags for async suspend_noirq and suspend_late
Date: Mon, 20 Jan 2014 16:44:35 +0800 [thread overview]
Message-ID: <1390207479-26064-2-git-send-email-chuansheng.liu@intel.com> (raw)
In-Reply-To: <1390207479-26064-1-git-send-email-chuansheng.liu@intel.com>
From: "Liu, Chuansheng" <chuansheng.liu@intel.com>
The patch is one helper that adding two new flags for implementing
async threads for suspend_noirq and suspend_late.
Signed-off-by: Liu, Chuansheng <chuansheng.liu@intel.com>
---
drivers/base/power/main.c | 22 ++++++++++++++++++++--
include/linux/pm.h | 2 ++
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 6a33dd8..bf71ddb 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -72,6 +72,8 @@ void device_pm_sleep_init(struct device *dev)
{
dev->power.is_prepared = false;
dev->power.is_suspended = false;
+ dev->power.is_noirq_suspended = false;
+ dev->power.is_late_suspended = false;
init_completion(&dev->power.completion);
complete_all(&dev->power.completion);
dev->power.wakeup = NULL;
@@ -464,6 +466,9 @@ static int device_resume_noirq(struct device *dev, pm_message_t state)
if (dev->power.syscore)
goto Out;
+ if (!dev->power.is_noirq_suspended)
+ goto Out;
+
if (dev->pm_domain) {
info = "noirq power domain ";
callback = pm_noirq_op(&dev->pm_domain->ops, state);
@@ -484,6 +489,7 @@ static int device_resume_noirq(struct device *dev, pm_message_t state)
}
error = dpm_run_callback(callback, dev, state, info);
+ dev->power.is_noirq_suspended = false;
Out:
TRACE_RESUME(error);
@@ -546,6 +552,9 @@ static int device_resume_early(struct device *dev, pm_message_t state)
if (dev->power.syscore)
goto Out;
+ if (!dev->power.is_late_suspended)
+ goto Out;
+
if (dev->pm_domain) {
info = "early power domain ";
callback = pm_late_early_op(&dev->pm_domain->ops, state);
@@ -566,6 +575,7 @@ static int device_resume_early(struct device *dev, pm_message_t state)
}
error = dpm_run_callback(callback, dev, state, info);
+ dev->power.is_late_suspended = false;
Out:
TRACE_RESUME(error);
@@ -902,6 +912,7 @@ static int device_suspend_noirq(struct device *dev, pm_message_t state)
{
pm_callback_t callback = NULL;
char *info = NULL;
+ int error;
if (dev->power.syscore)
return 0;
@@ -925,7 +936,10 @@ static int device_suspend_noirq(struct device *dev, pm_message_t state)
callback = pm_noirq_op(dev->driver->pm, state);
}
- return dpm_run_callback(callback, dev, state, info);
+ error = dpm_run_callback(callback, dev, state, info);
+ if (!error)
+ dev->power.is_noirq_suspended = true;
+ return error;
}
/**
@@ -988,6 +1002,7 @@ static int device_suspend_late(struct device *dev, pm_message_t state)
{
pm_callback_t callback = NULL;
char *info = NULL;
+ int error;
__pm_runtime_disable(dev, false);
@@ -1013,7 +1028,10 @@ static int device_suspend_late(struct device *dev, pm_message_t state)
callback = pm_late_early_op(dev->driver->pm, state);
}
- return dpm_run_callback(callback, dev, state, info);
+ error = dpm_run_callback(callback, dev, state, info);
+ if (!error)
+ dev->power.is_late_suspended = true;
+ return error;
}
/**
diff --git a/include/linux/pm.h b/include/linux/pm.h
index a224c7f..fe90a8b 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -521,6 +521,8 @@ struct dev_pm_info {
unsigned int async_suspend:1;
bool is_prepared:1; /* Owned by the PM core */
bool is_suspended:1; /* Ditto */
+ bool is_noirq_suspended:1;
+ bool is_late_suspended:1;
bool ignore_children:1;
bool early_init:1; /* Owned by the PM core */
spinlock_t lock;
--
1.7.9.5
next prev parent reply other threads:[~2014-01-20 8:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-20 8:44 [PATCH 0/5] Enabling the asynchronous threads for other phases Liu, Chuansheng
2014-01-20 8:44 ` Liu, Chuansheng [this message]
2014-01-20 8:44 ` [PATCH 2/5] PM: Enabling the asynchronous threads for resume_noirq Liu, Chuansheng
2014-01-20 8:44 ` [PATCH 3/5] PM: Enabling the asyncronous threads for resume_early Liu, Chuansheng
2014-01-20 8:44 ` [PATCH 4/5] PM: Enabling the asyncronous threads for suspend_noirq Liu, Chuansheng
2014-01-20 8:44 ` [PATCH 5/5] PM: Enabling the asyncronous threads for suspend_late Liu, Chuansheng
2014-01-21 8:57 ` [PATCH 0/5] Enabling the asynchronous threads for other phases Li, Zhuangzhi
2014-02-05 21:53 ` Rafael J. Wysocki
2014-02-10 8:36 ` Liu, Chuansheng
2014-02-16 23:40 ` Rafael J. Wysocki
2014-02-17 1:44 ` Liu, Chuansheng
2014-02-17 2:10 ` Liu, Chuansheng
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=1390207479-26064-2-git-send-email-chuansheng.liu@intel.com \
--to=chuansheng.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@rjwysocki.net \
--cc=zhuangzhi.li@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;
as well as URLs for NNTP newsgroup(s).