Skip to content
Snippets Groups Projects
Commit a56fae1a authored by Dmitry Osipenko's avatar Dmitry Osipenko
Browse files

reboot: Remove pm_power_off


All users of pm_power_off() have been converted to new sys-off API.
Remove deprecated pm_power_off().

Signed-off-by: default avatarDmitry Osipenko <dmitry.osipenko@collabora.com>
parent 086a86fb
No related branches found
No related tags found
No related merge requests found
...@@ -17,11 +17,6 @@ ...@@ -17,11 +17,6 @@
#include <linux/hrtimer.h> #include <linux/hrtimer.h>
#include <linux/completion.h> #include <linux/completion.h>
/*
* Callbacks for platform drivers to implement.
*/
extern void (*pm_power_off)(void);
struct device; /* we have a circular dep with device.h */ struct device; /* we have a circular dep with device.h */
#ifdef CONFIG_VT_CONSOLE_SLEEP #ifdef CONFIG_VT_CONSOLE_SLEEP
extern void pm_vt_switch_required(struct device *dev, bool required); extern void pm_vt_switch_required(struct device *dev, bool required);
......
...@@ -293,19 +293,6 @@ EXPORT_SYMBOL_GPL(kernel_halt); ...@@ -293,19 +293,6 @@ EXPORT_SYMBOL_GPL(kernel_halt);
*/ */
static BLOCKING_NOTIFIER_HEAD(power_off_handler_list); static BLOCKING_NOTIFIER_HEAD(power_off_handler_list);
/*
* Temporary stub that prevents linkage failure while we're in process
* of removing all uses of legacy pm_power_off() around the kernel.
*/
void __weak (*pm_power_off)(void);
static void dummy_pm_power_off(void)
{
/* temporary stub until pm_power_off() is gone, see more below */
}
static struct notifier_block *pm_power_off_nb;
/** /**
* register_power_off_handler - Register function to be called to power off * register_power_off_handler - Register function to be called to power off
* the system * the system
...@@ -350,12 +337,9 @@ static int register_power_off_handler(struct notifier_block *nb) ...@@ -350,12 +337,9 @@ static int register_power_off_handler(struct notifier_block *nb)
int ret; int ret;
ret = blocking_notifier_chain_register_unique_prio(&power_off_handler_list, nb); ret = blocking_notifier_chain_register_unique_prio(&power_off_handler_list, nb);
if (ret && ret != -EBUSY) if (ret != -EBUSY)
return ret; return ret;
if (!ret)
goto set_pm_power_off;
/* /*
* Handler must have unique priority. Otherwise call order is * Handler must have unique priority. Otherwise call order is
* determined by registration order, which is unreliable. * determined by registration order, which is unreliable.
...@@ -365,33 +349,11 @@ static int register_power_off_handler(struct notifier_block *nb) ...@@ -365,33 +349,11 @@ static int register_power_off_handler(struct notifier_block *nb)
*/ */
pr_err("failed to register power-off handler using unique priority\n"); pr_err("failed to register power-off handler using unique priority\n");
ret = blocking_notifier_chain_register(&power_off_handler_list, nb); return blocking_notifier_chain_register(&power_off_handler_list, nb);
if (ret)
return ret;
/*
* Some drivers check whether pm_power_off was already installed.
* Install dummy callback using new API to preserve old behaviour
* for those drivers during period of transition to the new API.
*/
set_pm_power_off:
if (!pm_power_off) {
pm_power_off = dummy_pm_power_off;
pm_power_off_nb = nb;
}
return 0;
} }
static int unregister_power_off_handler(struct notifier_block *nb) static int unregister_power_off_handler(struct notifier_block *nb)
{ {
if (nb == pm_power_off_nb) {
if (pm_power_off == dummy_pm_power_off)
pm_power_off = NULL;
pm_power_off_nb = NULL;
}
return blocking_notifier_chain_unregister(&power_off_handler_list, nb); return blocking_notifier_chain_unregister(&power_off_handler_list, nb);
} }
...@@ -858,10 +820,6 @@ EXPORT_SYMBOL_GPL(unregister_platform_power_off); ...@@ -858,10 +820,6 @@ EXPORT_SYMBOL_GPL(unregister_platform_power_off);
*/ */
void do_kernel_power_off(void) void do_kernel_power_off(void)
{ {
/* legacy pm_power_off() is unchained and has highest priority */
if (pm_power_off && pm_power_off != dummy_pm_power_off)
return pm_power_off();
blocking_notifier_call_chain(&power_off_handler_list, POWEROFF_NORMAL, blocking_notifier_call_chain(&power_off_handler_list, POWEROFF_NORMAL,
NULL); NULL);
} }
...@@ -891,8 +849,7 @@ EXPORT_SYMBOL_GPL(kernel_power_off); ...@@ -891,8 +849,7 @@ EXPORT_SYMBOL_GPL(kernel_power_off);
bool kernel_can_power_off(void) bool kernel_can_power_off(void)
{ {
if (!pm_power_off && if (blocking_notifier_call_chain_is_empty(&power_off_handler_list))
blocking_notifier_call_chain_is_empty(&power_off_handler_list))
return false; return false;
return true; return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment