diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2021-10-20 22:10:17 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2021-10-26 16:31:46 +0300 |
commit | d69d1f708093347c085699cc0b547982e48c47b8 (patch) | |
tree | b823fecc38dbb7c110e33c976610efd5352b054b /drivers/acpi | |
parent | a9a8f827f9e81dc8506d3283d166cd6efe822302 (diff) | |
download | linux-d69d1f708093347c085699cc0b547982e48c47b8.tar.xz |
ACPI: PM: sleep: Do not set suspend_ops unnecessarily
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>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/sleep.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 3023224515ab..eaa47753b758 100644 --- a/drivers/acpi/sleep.c +++ b/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(); } |