From e42f1264161085f01fed16986a23592519d9f49e Mon Sep 17 00:00:00 2001
From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Date: Tue, 2 Nov 2021 14:55:44 +0300
Subject: [PATCH] x86: apm_32: Use register_platform_power_off()

Utilize new register_platform_power_off() API that allows to register
multiple power-off handlers and deprecates global pm_power_off callback.

Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
---
 arch/x86/kernel/apm_32.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index 60e330cdbd175..9693adbc280cc 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -197,6 +197,7 @@
 #include <linux/module.h>
 
 #include <linux/poll.h>
+#include <linux/reboot.h>
 #include <linux/types.h>
 #include <linux/stddef.h>
 #include <linux/timer.h>
@@ -1843,7 +1844,7 @@ static int apm(void *unused)
 
 	/* Install our power off handler.. */
 	if (power_off)
-		pm_power_off = apm_power_off;
+		register_platform_power_off(apm_power_off);
 
 	if (num_online_cpus() == 1 || smp) {
 #if defined(CONFIG_APM_DISPLAY_BLANK) && defined(CONFIG_VT)
@@ -2406,7 +2407,7 @@ static void __exit apm_exit(void)
 	misc_deregister(&apm_device);
 	remove_proc_entry("apm", NULL);
 	if (power_off)
-		pm_power_off = NULL;
+		unregister_platform_power_off(apm_power_off);
 	if (kapmd_task) {
 		kthread_stop(kapmd_task);
 		kapmd_task = NULL;
-- 
GitLab