summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/x86
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2022-08-22 13:18:17 +0200
committerPeter Zijlstra <peterz@infradead.org>2022-09-07 21:53:48 +0200
commit5950e5d574c636a07dd21a872c2f8b41f6d20c55 (patch)
tree77419bad4e34bcffa13046fc8c673b67276ccd7b /drivers/acpi/x86
parent0b9d46fc5ef7a457cc635b30b010081228cb81ac (diff)
downloadlinux-stable-5950e5d574c636a07dd21a872c2f8b41f6d20c55.tar.gz
linux-stable-5950e5d574c636a07dd21a872c2f8b41f6d20c55.tar.bz2
linux-stable-5950e5d574c636a07dd21a872c2f8b41f6d20c55.zip
freezer: Have {,un}lock_system_sleep() save/restore flags
Rafael explained that the reason for having both PF_NOFREEZE and PF_FREEZER_SKIP is that {,un}lock_system_sleep() is callable from kthread context that has previously called set_freezable(). In preparation of merging the flags, have {,un}lock_system_slee() save and restore current->flags. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://lore.kernel.org/r/20220822114648.725003428@infradead.org
Diffstat (limited to 'drivers/acpi/x86')
-rw-r--r--drivers/acpi/x86/s2idle.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
index f9ac12b778e6..1d1d6c80f6a8 100644
--- a/drivers/acpi/x86/s2idle.c
+++ b/drivers/acpi/x86/s2idle.c
@@ -541,12 +541,14 @@ void acpi_s2idle_setup(void)
int acpi_register_lps0_dev(struct acpi_s2idle_dev_ops *arg)
{
+ unsigned int sleep_flags;
+
if (!lps0_device_handle || sleep_no_lps0)
return -ENODEV;
- lock_system_sleep();
+ sleep_flags = lock_system_sleep();
list_add(&arg->list_node, &lps0_s2idle_devops_head);
- unlock_system_sleep();
+ unlock_system_sleep(sleep_flags);
return 0;
}
@@ -554,12 +556,14 @@ EXPORT_SYMBOL_GPL(acpi_register_lps0_dev);
void acpi_unregister_lps0_dev(struct acpi_s2idle_dev_ops *arg)
{
+ unsigned int sleep_flags;
+
if (!lps0_device_handle || sleep_no_lps0)
return;
- lock_system_sleep();
+ sleep_flags = lock_system_sleep();
list_del(&arg->list_node);
- unlock_system_sleep();
+ unlock_system_sleep(sleep_flags);
}
EXPORT_SYMBOL_GPL(acpi_unregister_lps0_dev);