@@ -981,7 +981,7 @@ recalc:
* on their first cpu.
*/
-static void apm_power_off(void)
+static void apm_power_off(struct power_off_handler_block *this)
{
/* Some bioses don't like being called from CPU != 0 */
if (apm_info.realmode_power_off) {
@@ -992,6 +992,11 @@ static void apm_power_off(void)
}
}
+static struct power_off_handler_block apm_power_off_hb = {
+ .handler = apm_power_off,
+ .priority = POWER_OFF_PRIORITY_HIGH,
+};
+
#ifdef CONFIG_APM_DO_ENABLE
/**
@@ -1847,8 +1852,11 @@ static int apm(void *unused)
}
/* Install our power off handler.. */
- if (power_off)
- pm_power_off = apm_power_off;
+ if (power_off) {
+ error = register_power_off_handler(&apm_power_off_hb);
+ if (error)
+ pr_warn("apm: Failed to register power-off handler\n");
+ }
if (num_online_cpus() == 1 || smp) {
#if defined(CONFIG_APM_DISPLAY_BLANK) && defined(CONFIG_VT)
@@ -2408,9 +2416,8 @@ static void __exit apm_exit(void)
apm_error("disengage power management", error);
}
misc_deregister(&apm_device);
+ unregister_power_off_handler(&apm_power_off_hb);
remove_proc_entry("apm", NULL);
- if (power_off)
- pm_power_off = NULL;
if (kapmd_task) {
kthread_stop(kapmd_task);
kapmd_task = NULL;