From: Kazuki Hashimoto <kazukih0205@gmail.com>
To: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Sudeep Holla <sudeep.holla@arm.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Lorenzo Pieralisi <lpieralisi@kernel.org>,
Hector Martin <marcan@marcan.st>, Sven Peter <sven@svenpeter.dev>,
Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
Kazuki Hashimoto <kazukih0205@gmail.com>
Subject: [PATCH] PM: s2idle: Don't allow s2idle when cpuidle isn't supported
Date: Wed, 15 Feb 2023 06:50:03 +0900 [thread overview]
Message-ID: <20230214215003.70683-1-kazukih0205@gmail.com> (raw)
s2idle isn't supported on platforms that don't support cpuidle as of
31a3409065d1 ("cpuidle / sleep: Do sanity checks in cpuidle_enter_freeze()
too"), so update the suspend framework to reflect this in order to avoid
breakages.
Link: https://lore.kernel.org/all/20230204152747.drte4uitljzngdt6@kazuki-mac
Fixes: 31a3409065d1 ("cpuidle / sleep: Do sanity checks in cpuidle_enter_freeze() too")
Signed-off-by: Kazuki Hashimoto <kazukih0205@gmail.com>
---
kernel/power/suspend.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 3f436282547c..27507ae7c9c9 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -556,6 +556,12 @@ static int enter_state(suspend_state_t state)
trace_suspend_resume(TPS("suspend_enter"), state, true);
if (state == PM_SUSPEND_TO_IDLE) {
+ struct cpuidle_device *dev = cpuidle_get_device();
+ struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
+
+ if (cpuidle_not_available(drv, dev))
+ return -EINVAL;
+
#ifdef CONFIG_PM_DEBUG
if (pm_test_level != TEST_NONE && pm_test_level <= TEST_CPUS) {
pr_warn("Unsupported test mode for suspend to idle, please choose none/freezer/devices/platform.\n");
--
2.39.1
next reply other threads:[~2023-02-14 22:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-14 21:50 Kazuki Hashimoto [this message]
2023-02-21 3:44 ` [PATCH] PM: s2idle: Don't allow s2idle when cpuidle isn't supported Hector Martin
2023-02-21 15:40 ` Rafael J. Wysocki
2023-03-15 22:07 ` Kazuki
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=20230214215003.70683-1-kazukih0205@gmail.com \
--to=kazukih0205@gmail.com \
--cc=daniel.lezcano@linaro.org \
--cc=len.brown@intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=marcan@marcan.st \
--cc=pavel@ucw.cz \
--cc=rafael@kernel.org \
--cc=sudeep.holla@arm.com \
--cc=sven@svenpeter.dev \
/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