summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorRuchi Kandoi <kandoiruchi@google.com>2014-10-29 10:36:27 -0700
committerJohn Stultz <john.stultz@linaro.org>2016-02-16 13:53:38 -0800
commit57caa2ad5ce35bedb7ab374a2e5b4d7adf63da2b (patch)
tree960197e19ff7a3e40d0380935da2cec972155dfe /drivers/base
parent1adb5b403433616585cae7fa22a61ede2400319a (diff)
power: Adds functionality to log the last suspend abort reason.
Extends the last_resume_reason to log suspend abort reason. The abort reasons will have "Abort:" appended at the start to distinguish itself from the resume reason. Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com> Change-Id: I3207f1844e3d87c706dfc298fb10e1c648814c5f
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/power/main.c5
-rw-r--r--drivers/base/power/wakeup.c16
-rw-r--r--drivers/base/syscore.c3
3 files changed, 24 insertions, 0 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index df539322d9f5..a54d810f2966 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -33,6 +33,7 @@
#include <linux/cpufreq.h>
#include <linux/cpuidle.h>
#include <linux/timer.h>
+#include <linux/wakeup_reason.h>
#include "../base.h"
#include "power.h"
@@ -1379,6 +1380,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
int error = 0;
struct timer_list timer;
struct dpm_drv_wd_data data;
+ char suspend_abort[MAX_SUSPEND_ABORT_LEN];
DECLARE_DPM_WATCHDOG_ON_STACK(wd);
TRACE_DEVICE(dev);
@@ -1399,6 +1401,9 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
pm_wakeup_event(dev, 0);
if (pm_wakeup_pending()) {
+ pm_get_active_wakeup_sources(suspend_abort,
+ MAX_SUSPEND_ABORT_LEN);
+ log_suspend_abort_reason(suspend_abort);
async_error = -EBUSY;
goto Complete;
}
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
index a1e0b9ab847a..2c3435d55d01 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -804,6 +804,22 @@ void pm_wakeup_event(struct device *dev, unsigned int msec)
}
EXPORT_SYMBOL_GPL(pm_wakeup_event);
+void pm_get_active_wakeup_sources(char *pending_wakeup_source, size_t max)
+{
+ struct wakeup_source *ws;
+ int len = 0;
+ rcu_read_lock();
+ len += snprintf(pending_wakeup_source, max, "Pending Wakeup Sources: ");
+ list_for_each_entry_rcu(ws, &wakeup_sources, entry) {
+ if (ws->active) {
+ len += snprintf(pending_wakeup_source + len, max,
+ "%s ", ws->name);
+ }
+ }
+ rcu_read_unlock();
+}
+EXPORT_SYMBOL_GPL(pm_get_active_wakeup_sources);
+
void pm_print_active_wakeup_sources(void)
{
struct wakeup_source *ws;
diff --git a/drivers/base/syscore.c b/drivers/base/syscore.c
index 8d98a329f6ea..96c34a95cc62 100644
--- a/drivers/base/syscore.c
+++ b/drivers/base/syscore.c
@@ -11,6 +11,7 @@
#include <linux/module.h>
#include <linux/suspend.h>
#include <trace/events/power.h>
+#include <linux/wakeup_reason.h>
static LIST_HEAD(syscore_ops_list);
static DEFINE_MUTEX(syscore_ops_lock);
@@ -75,6 +76,8 @@ int syscore_suspend(void)
return 0;
err_out:
+ log_suspend_abort_reason("System core suspend callback %pF failed",
+ ops->suspend);
pr_err("PM: System core suspend callback %pF failed.\n", ops->suspend);
list_for_each_entry_continue(ops, &syscore_ops_list, node)