summaryrefslogtreecommitdiff
path: root/drivers/firmware/efi
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2022-07-15 10:12:22 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2022-07-15 10:12:22 -0700
commit2a347a06ebb1b186a5cb919c9f5ab6e040554be7 (patch)
tree56e9a537a803f7d6c1b4bc447effb54c60d7f281 /drivers/firmware/efi
parent339f74e38f53c83b5715abd28f7002b66731d917 (diff)
parent5ad26161a371e4aa2d2553286f0cac580987a493 (diff)
Merge tag 'platform-drivers-x86-v5.19-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
Pull x86 platform driver fixes from Hans de Goede: "Highlights: - Fix brightness key events getting reported twice on some Dells. Regression caused by recent Panasonic hotkey fixes - Fix poweroff no longer working on some devices regression caused by recent poweroff handler rework - Mark new (in 5.19) Intel IFS driver as broken, because of some issues surrounding the userspace (sysfs) API which need to be cleared up - Some hardware-id / quirk additions" * tag 'platform-drivers-x86-v5.19-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: ACPI: video: Fix acpi_video_handles_brightness_key_presses() platform/x86: intel_atomisp2_led: Also turn off the always-on camera LED on the Asus T100TAF platform/x86/intel/ifs: Mark as BROKEN platform/x86: asus-wmi: Add key mappings efi: Fix efi_power_off() not being run before acpi_power_off() when necessary platform/x86: x86-android-tablets: Fix Lenovo Yoga Tablet 2 830/1050 poweroff again platform/x86: gigabyte-wmi: add support for B660I AORUS PRO DDR4 platform/x86/amd/pmc: Add new platform support platform/x86/amd/pmc: Add new acpi id for PMC controller
Diffstat (limited to 'drivers/firmware/efi')
-rw-r--r--drivers/firmware/efi/reboot.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/firmware/efi/reboot.c b/drivers/firmware/efi/reboot.c
index 73089a24f04b..ceae84c19d22 100644
--- a/drivers/firmware/efi/reboot.c
+++ b/drivers/firmware/efi/reboot.c
@@ -6,7 +6,7 @@
#include <linux/efi.h>
#include <linux/reboot.h>
-static void (*orig_pm_power_off)(void);
+static struct sys_off_handler *efi_sys_off_handler;
int efi_reboot_quirk_mode = -1;
@@ -51,15 +51,11 @@ bool __weak efi_poweroff_required(void)
return false;
}
-static void efi_power_off(void)
+static int efi_power_off(struct sys_off_data *data)
{
efi.reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL);
- /*
- * The above call should not return, if it does fall back to
- * the original power off method (typically ACPI poweroff).
- */
- if (orig_pm_power_off)
- orig_pm_power_off();
+
+ return NOTIFY_DONE;
}
static int __init efi_shutdown_init(void)
@@ -68,8 +64,13 @@ static int __init efi_shutdown_init(void)
return -ENODEV;
if (efi_poweroff_required()) {
- orig_pm_power_off = pm_power_off;
- pm_power_off = efi_power_off;
+ /* SYS_OFF_PRIO_FIRMWARE + 1 so that it runs before acpi_power_off */
+ efi_sys_off_handler =
+ register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
+ SYS_OFF_PRIO_FIRMWARE + 1,
+ efi_power_off, NULL);
+ if (IS_ERR(efi_sys_off_handler))
+ return PTR_ERR(efi_sys_off_handler);
}
return 0;