summaryrefslogtreecommitdiff
path: root/kernel/power/wakeup_reason.c
diff options
context:
space:
mode:
authorIliyan Malchev <malchev@google.com>2015-05-20 20:04:52 -0700
committerMichael Bestas <mkbestas@lineageos.org>2019-12-23 23:43:35 +0200
commite1df671a7e173c6cbd87028c793e75400f349895 (patch)
tree04ae67263d30491e48f26686c912deea179caa81 /kernel/power/wakeup_reason.c
parent8ad00b7be2aa63a208b8e72ecabce16ad1610ccb (diff)
BACKPORT: PM: wakeup_reasons: disable wakeup-reason deduction by default
Introduce a config item, CONFIG_DEDUCE_WAKEUP_REASONS, disabled by default. Make CONFIG_PARTUALRESUME select it. (cherry picked from commit 753b5405eedf67357952e3a10cb3fb1392a3972b) Change-Id: I7d831ff0a9dfe0a504824f4bc65ba55c4d92546b Signed-off-by: Iliyan Malchev <malchev@google.com>
Diffstat (limited to 'kernel/power/wakeup_reason.c')
-rw-r--r--kernel/power/wakeup_reason.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/kernel/power/wakeup_reason.c b/kernel/power/wakeup_reason.c
index e8c60538f3f7..538eb7aa8112 100644
--- a/kernel/power/wakeup_reason.c
+++ b/kernel/power/wakeup_reason.c
@@ -110,6 +110,7 @@ add_to_siblings(struct wakeup_irq_node *root, int irq)
return n;
}
+#ifdef CONFIG_DEDUCE_WAKEUP_REASONS
static struct wakeup_irq_node* add_child(struct wakeup_irq_node *root, int irq)
{
if (!root->child) {
@@ -150,6 +151,7 @@ get_base_node(struct wakeup_irq_node *node, unsigned depth)
return node;
}
+#endif /* CONFIG_DEDUCE_WAKEUP_REASONS */
static const struct list_head* get_wakeup_reasons_nosync(void);
@@ -194,6 +196,7 @@ static bool walk_irq_node_tree(struct wakeup_irq_node *root,
return visit(root, cookie);
}
+#ifdef CONFIG_DEDUCE_WAKEUP_REASONS
static bool is_node_handled(struct wakeup_irq_node *n, void *_p)
{
return n->handled;
@@ -203,6 +206,7 @@ static bool base_irq_nodes_done(void)
{
return walk_irq_node_tree(base_irq_nodes, is_node_handled, NULL);
}
+#endif
struct buf_cookie {
char *buf;
@@ -308,8 +312,13 @@ void log_base_wakeup_reason(int irq)
*/
base_irq_nodes = add_to_siblings(base_irq_nodes, irq);
BUG_ON(!base_irq_nodes);
+#ifndef CONFIG_DEDUCE_WAKEUP_REASONS
+ base_irq_nodes->handled = true;
+#endif
}
+#ifdef CONFIG_DEDUCE_WAKEUP_REASONS
+
/* This function is called by generic_handle_irq, which may call itself
* recursively. This happens with interrupts disabled. Using
* log_possible_wakeup_reason, we build a tree of interrupts, tracing the call
@@ -328,7 +337,7 @@ void log_base_wakeup_reason(int irq)
*/
-struct wakeup_irq_node *
+static struct wakeup_irq_node *
log_possible_wakeup_reason_start(int irq, struct irq_desc *desc, unsigned depth)
{
BUG_ON(!irqs_disabled());
@@ -377,7 +386,7 @@ log_possible_wakeup_reason_start(int irq, struct irq_desc *desc, unsigned depth)
return cur_irq_tree;
}
-void log_possible_wakeup_reason_complete(struct wakeup_irq_node *n,
+static void log_possible_wakeup_reason_complete(struct wakeup_irq_node *n,
unsigned depth,
bool handled)
{
@@ -422,6 +431,8 @@ bool log_possible_wakeup_reason(int irq,
return handled;
}
+#endif /* CONFIG_DEDUCE_WAKEUP_REASONS */
+
void log_suspend_abort_reason(const char *fmt, ...)
{
va_list args;
@@ -545,15 +556,19 @@ static int wakeup_reason_pm_event(struct notifier_block *notifier,
clear_wakeup_reasons();
break;
case PM_POST_SUSPEND:
+ /* monotonic time since boot */
+ curr_monotime = ktime_get();
+ /* monotonic time since boot including the time spent in suspend */
+ curr_stime = ktime_get_boottime();
+#ifdef CONFIG_DEDUCE_WAKEUP_REASONS
/* log_wakeups should have been cleared by now. */
if (WARN_ON(logging_wakeup_reasons())) {
stop_logging_wakeup_reasons();
print_wakeup_sources();
}
- /* monotonic time since boot */
- curr_monotime = ktime_get();
- /* monotonic time since boot including the time spent in suspend */
- curr_stime = ktime_get_boottime();
+#else
+ print_wakeup_sources();
+#endif
break;
default:
break;