android_kernel_xiaomi_sm8350/arch/um/kernel
Eric W. Biederman 5e38291d80 [PATCH] Don't attempt to power off if power off is not implemented
The problem.  It is expected that /sbin/halt -p works exactly like
/sbin/halt, when the kernel does not implement power off functionality.

The kernel can do a lot of work in the reboot notifiers and in
device_shutdown before we even get to machine_power_off.  Some of that
shutdown is not safe if you are leaving the power on, and it definitely
gets in the way of using sysrq or pressing ctrl-alt-del.  Since the
shutdown happens in generic code there is no way to fix this in
architecture specific code :(

Some machines are kernel oopsing today because of this.

The simple solution is to turn LINUX_REBOOT_CMD_POWER_OFF into
LINUX_REBOOT_CMD_HALT if power_off functionality is not implemented.

This has the unfortunate side effect of disabling the power off
functionality on architectures that leave pm_power_off to null and still
implement something in machine_power_off.  And it will break the build on
some architectures that don't have a pm_power_off variable at all.

On both counts I say tough.

For architectures like alpha that don't implement the pm_power_off variable
pm_power_off is declared in linux/pm.h and it is a generic part of our
power management code, and all architectures should implement it.

For architectures like parisc that have a default power off method in
machine_power_off if pm_power_off is not implemented or fails.  It is easy
enough to set the pm_power_off variable.  And nothing bad happens there,
the machines just stop powering off.

The current semantics are impossible without a flag at the top level so we
can avoid the problem code if a power off is not implemented.  pm_power_off
is as good a flag as any with the bonus that it works without modification
on at least x86, x86_64, powerpc, and ppc today.

Andrew can you pick this up and put this in the mm tree.  Kernels that
don't compile or don't power off seem saner than kernels that oops or
panic.  Until we get the arch specific patches for the problem
architectures this probably isn't smart to push into the stable kernel.
Unfortunately I don't have the time at the moment to walk through every
architecture and make them work.  And even if I did I couldn't test it :(

From: Hirokazu Takata <takata@linux-m32r.org>

    Add pm_power_off() for build fix of arch/m32r/kernel/process.c.

From: Miklos Szeredi <miklos@szeredi.hu>

    UML build fix

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Hayato Fujiwara <fujiwara@linux-m32r.org>
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-08 20:14:00 -08:00
..
skas [PATCH] uml: move libc-dependent code from trap_user.c 2006-01-08 20:13:39 -08:00
tt [PATCH] uml: move libc-dependent code from trap_user.c 2006-01-08 20:13:39 -08:00
asm-offsets.c kbuild: um fix so it compile with generic asm-offsets.h support 2005-09-09 23:10:54 +02:00
config.c.in
dyn.lds.S [PATCH] i386 / uml: add dwarf sections to static link script 2005-09-10 12:00:17 -07:00
exec_kern.c
exitcode.c [PATCH] uml: Clean up prink calls 2005-07-28 21:46:05 -07:00
gmon_syms.c
gprof_syms.c
init_task.c [PATCH] uml: move libc code out of mem_user.c and tempfile.c 2005-09-17 11:50:00 -07:00
initrd.c
irq_user.c [PATCH] uml: move libc-dependent code from signal_user.c 2006-01-08 20:13:39 -08:00
irq.c [PATCH] useless linux/irq.h includes (arch/um) 2005-09-30 08:42:24 -07:00
ksyms.c [PATCH] uml: separate libc-dependent helper code 2005-11-07 07:53:31 -08:00
Makefile [PATCH] uml: merge trap_user.c and trap_kern.c 2006-01-08 20:13:39 -08:00
mem.c [PATCH] uml: fix hardcoded ZONE_* constants in zone setup 2005-11-07 07:53:32 -08:00
physmem.c [PATCH] uml: big memory fixes 2005-11-07 07:53:31 -08:00
process_kern.c [PATCH] uml: move libc-dependent code from signal_user.c 2006-01-08 20:13:39 -08:00
ptrace.c [PATCH] consolidate sys_ptrace() 2005-11-07 07:53:42 -08:00
reboot.c [PATCH] Don't attempt to power off if power off is not implemented 2006-01-08 20:14:00 -08:00
resource.c
sigio_kern.c
sigio_user.c [PATCH] uml: non-void functions should return something 2006-01-06 08:33:45 -08:00
signal_kern.c [PATCH] uml: move libc-dependent code from signal_user.c 2006-01-08 20:13:39 -08:00
smp.c
syscall_kern.c [PATCH] uml: fork cleanup 2005-06-25 16:24:35 -07:00
syscall.c [PATCH] uml: system call path cleanup 2005-09-05 00:06:23 -07:00
sysrq.c [PATCH] uml: Fix sysrq-r support for skas mode 2005-10-04 13:22:01 -07:00
time_kern.c [PATCH] jiffies_64 cleanup 2005-10-30 17:37:25 -08:00
time.c [PATCH] uml: move libc-dependent code from signal_user.c 2006-01-08 20:13:39 -08:00
tlb.c [PATCH] uml: fix condition in tlb flush 2005-09-22 22:17:36 -07:00
trap_kern.c [PATCH] uml: merge trap_user.c and trap_kern.c 2006-01-08 20:13:39 -08:00
tty_log.c
uaccess.c [PATCH] uml: separate libc-dependent uaccess code 2005-11-07 07:53:31 -08:00
um_arch.c [PATCH] uml: move libc-dependent code from trap_user.c 2006-01-08 20:13:39 -08:00
umid.c [PATCH] uml: umid cleanup 2006-01-06 08:33:47 -08:00
uml.lds.S [PATCH] i386 / uml: add dwarf sections to static link script 2005-09-10 12:00:17 -07:00
user_util.c [PATCH] uml: separate libc-dependent helper code 2005-11-07 07:53:31 -08:00
vmlinux.lds.S