* [PATCH] ACPI: PM: sleep: Do not set suspend_ops unnecessarily
@ 2021-10-20 19:10 Rafael J. Wysocki
0 siblings, 0 replies; only message in thread
From: Rafael J. Wysocki @ 2021-10-20 19:10 UTC (permalink / raw)
To: Linux ACPI; +Cc: LKML, Linux PM
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
If none of the S1 - S3 sleep states is supported, it is not necessary
to register suspend_ops, so don't do that then.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/acpi/sleep.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
Index: linux-pm/drivers/acpi/sleep.c
===================================================================
--- linux-pm.orig/drivers/acpi/sleep.c
+++ linux-pm/drivers/acpi/sleep.c
@@ -815,14 +815,18 @@ void __weak acpi_s2idle_setup(void)
static void acpi_sleep_suspend_setup(void)
{
+ bool suspend_ops_needed = false;
int i;
for (i = ACPI_STATE_S1; i < ACPI_STATE_S4; i++)
- if (acpi_sleep_state_supported(i))
+ if (acpi_sleep_state_supported(i)) {
sleep_states[i] = 1;
+ suspend_ops_needed = true;
+ }
- suspend_set_ops(old_suspend_ordering ?
- &acpi_suspend_ops_old : &acpi_suspend_ops);
+ if (suspend_ops_needed)
+ suspend_set_ops(old_suspend_ordering ?
+ &acpi_suspend_ops_old : &acpi_suspend_ops);
acpi_s2idle_setup();
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-10-20 19:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-20 19:10 [PATCH] ACPI: PM: sleep: Do not set suspend_ops unnecessarily Rafael J. Wysocki
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®