From 5e0188e27182010495ec5a4ad0228bbbdc5cf514 Mon Sep 17 00:00:00 2001 From: Sultan Alsawaf Date: Tue, 3 May 2022 23:32:26 -0700 Subject: [PATCH] PM / wakeup: Avoid excessive s2idle wake attempts in pm_system_wakeup() Calling s2idle_wake() once after pm_abort_suspend is incremented is all that's needed to wake up from s2idle. Avoid multiple unnecessary attempts to wake from s2idle by only doing the wakeup when pm_abort_suspend hits 1. The s2idle machinery already provides the synchronization needed to make this safe. Signed-off-by: Sultan Alsawaf Change-Id: I789857351353737f7199a8df5c5ba210050352e6 --- drivers/base/power/wakeup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c index 9fd5166a52ad..bca76e68e659 100755 --- a/drivers/base/power/wakeup.c +++ b/drivers/base/power/wakeup.c @@ -965,8 +965,8 @@ bool pm_wakeup_pending(void) void pm_system_wakeup(void) { - atomic_inc(&pm_abort_suspend); - s2idle_wake(); + if (atomic_inc_return_relaxed(&pm_abort_suspend) == 1) + s2idle_wake(); } EXPORT_SYMBOL_GPL(pm_system_wakeup);