From: Simon Gaiser <simon@invisiblethingslab.com>
To: "Rafael J . Wysocki" <rafael@kernel.org>, Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
Simon Gaiser <simon@invisiblethingslab.com>
Subject: [PATCH] ACPI: s2idle: Don't ignore error when enabling wakeup IRQ
Date: Mon, 13 Mar 2023 13:53:44 +0100 [thread overview]
Message-ID: <20230313125344.2893-1-simon@invisiblethingslab.com> (raw)
enable_irq_wake() can fail. Previously acpi_s2idle_prepare() silently
ignored it's return code, potentially leaving a system that never wakes
up.
Discovered when trying to go into s2idle under Xen. This leads to a
system that can't be woken, since xen-pirq currently doesn't support
setting wakeup IRQs. Real s2idle support for Xen is another topic, but
now at least the user gets an error and the system doesn't needs an hard
reset.
Signed-off-by: Simon Gaiser <simon@invisiblethingslab.com>
---
Note that I'm unfamiliar with the code so when reviewing please
carefully check if ignoring the error was indeed unintended.
If there are indeed cases where the error should be ignored I would
submit a patch that at least logs the error, although the error message
would be hard to see with broken wakeup.
drivers/acpi/sleep.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 4ca667251272..c69dd3731126 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -714,7 +714,15 @@ int acpi_s2idle_begin(void)
int acpi_s2idle_prepare(void)
{
if (acpi_sci_irq_valid()) {
- enable_irq_wake(acpi_sci_irq);
+ int error;
+
+ error = enable_irq_wake(acpi_sci_irq);
+ if (error) {
+ pr_err("Failed to enable wakeup from IRQ %d: %d\n",
+ acpi_sci_irq,
+ error);
+ return error;
+ }
acpi_ec_set_gpe_wake_mask(ACPI_GPE_ENABLE);
}
--
2.39.2
next reply other threads:[~2023-03-13 12:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-13 12:53 Simon Gaiser [this message]
2023-03-13 13:12 ` Rafael J. Wysocki
2023-03-13 14:56 ` Simon Gaiser
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=20230313125344.2893-1-simon@invisiblethingslab.com \
--to=simon@invisiblethingslab.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
/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
all inboxes | Powered by JetHome®