mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-29 07:04:10 +08:00
6b22c73659
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new sys-off API. Acked-by: Palmer Dabbelt <palmer@dabbelt.com> Reviewed-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
35 lines
529 B
C
35 lines
529 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Copyright (C) 2012 Regents of the University of California
|
|
*/
|
|
|
|
#include <linux/reboot.h>
|
|
#include <linux/pm.h>
|
|
|
|
static void default_power_off(void)
|
|
{
|
|
while (1)
|
|
wait_for_interrupt();
|
|
}
|
|
|
|
void (*pm_power_off)(void) = NULL;
|
|
EXPORT_SYMBOL(pm_power_off);
|
|
|
|
void machine_restart(char *cmd)
|
|
{
|
|
do_kernel_restart(cmd);
|
|
while (1);
|
|
}
|
|
|
|
void machine_halt(void)
|
|
{
|
|
do_kernel_power_off();
|
|
default_power_off();
|
|
}
|
|
|
|
void machine_power_off(void)
|
|
{
|
|
do_kernel_power_off();
|
|
default_power_off();
|
|
}
|