You can subscribe to this list here.
| 1999 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(15) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2000 |
Jan
(6) |
Feb
(1) |
Mar
(39) |
Apr
(13) |
May
(24) |
Jun
(11) |
Jul
(23) |
Aug
(85) |
Sep
(12) |
Oct
(103) |
Nov
(79) |
Dec
(112) |
| 2001 |
Jan
(52) |
Feb
(82) |
Mar
(84) |
Apr
(65) |
May
(105) |
Jun
(188) |
Jul
(174) |
Aug
(182) |
Sep
(103) |
Oct
(137) |
Nov
(143) |
Dec
(98) |
| 2002 |
Jan
(258) |
Feb
(236) |
Mar
(386) |
Apr
(307) |
May
(238) |
Jun
(170) |
Jul
(252) |
Aug
(230) |
Sep
(278) |
Oct
(394) |
Nov
(336) |
Dec
(194) |
| 2003 |
Jan
(290) |
Feb
(182) |
Mar
(175) |
Apr
(220) |
May
(209) |
Jun
(286) |
Jul
(279) |
Aug
(164) |
Sep
(208) |
Oct
(324) |
Nov
(204) |
Dec
(380) |
| 2004 |
Jan
(344) |
Feb
(332) |
Mar
(395) |
Apr
(357) |
May
(349) |
Jun
(352) |
Jul
(279) |
Aug
(269) |
Sep
(374) |
Oct
(442) |
Nov
(428) |
Dec
(253) |
| 2005 |
Jan
(225) |
Feb
(219) |
Mar
(245) |
Apr
(249) |
May
(203) |
Jun
(157) |
Jul
(171) |
Aug
(194) |
Sep
(200) |
Oct
(232) |
Nov
(190) |
Dec
(195) |
| 2006 |
Jan
(158) |
Feb
(190) |
Mar
(235) |
Apr
(161) |
May
(134) |
Jun
(169) |
Jul
(117) |
Aug
(161) |
Sep
(170) |
Oct
(297) |
Nov
(230) |
Dec
(205) |
| 2007 |
Jan
(197) |
Feb
(132) |
Mar
(151) |
Apr
(97) |
May
(109) |
Jun
(99) |
Jul
(57) |
Aug
(110) |
Sep
(56) |
Oct
(119) |
Nov
(39) |
Dec
(45) |
| 2008 |
Jan
(101) |
Feb
(116) |
Mar
(141) |
Apr
(98) |
May
(133) |
Jun
(61) |
Jul
(43) |
Aug
(76) |
Sep
(20) |
Oct
(32) |
Nov
(22) |
Dec
(41) |
| 2009 |
Jan
(35) |
Feb
(15) |
Mar
(18) |
Apr
(13) |
May
(13) |
Jun
(26) |
Jul
(12) |
Aug
(32) |
Sep
(21) |
Oct
(41) |
Nov
(35) |
Dec
(12) |
| 2010 |
Jan
(3) |
Feb
(35) |
Mar
(28) |
Apr
(20) |
May
(5) |
Jun
(14) |
Jul
(6) |
Aug
(8) |
Sep
(20) |
Oct
(20) |
Nov
(10) |
Dec
(12) |
| 2011 |
Jan
(14) |
Feb
(10) |
Mar
(14) |
Apr
(14) |
May
(13) |
Jun
(43) |
Jul
(13) |
Aug
(50) |
Sep
(30) |
Oct
(23) |
Nov
(15) |
Dec
(49) |
| 2012 |
Jan
(15) |
Feb
(28) |
Mar
(7) |
Apr
|
May
(12) |
Jun
(13) |
Jul
(28) |
Aug
(11) |
Sep
(19) |
Oct
(27) |
Nov
(5) |
Dec
(25) |
| 2013 |
Jan
(18) |
Feb
(19) |
Mar
(56) |
Apr
(26) |
May
(38) |
Jun
(24) |
Jul
(42) |
Aug
(24) |
Sep
(4) |
Oct
(3) |
Nov
(18) |
Dec
(4) |
| 2014 |
Jan
(10) |
Feb
(9) |
Mar
(3) |
Apr
|
May
(12) |
Jun
(34) |
Jul
(8) |
Aug
(18) |
Sep
(3) |
Oct
(27) |
Nov
(2) |
Dec
(1) |
| 2015 |
Jan
|
Feb
(10) |
Mar
(49) |
Apr
(2) |
May
(4) |
Jun
(7) |
Jul
(1) |
Aug
(17) |
Sep
(7) |
Oct
(35) |
Nov
(40) |
Dec
(4) |
| 2016 |
Jan
(9) |
Feb
|
Mar
(6) |
Apr
|
May
(10) |
Jun
(2) |
Jul
|
Aug
|
Sep
(5) |
Oct
|
Nov
|
Dec
(1) |
| 2017 |
Jan
(2) |
Feb
(4) |
Mar
(1) |
Apr
(4) |
May
(31) |
Jun
(9) |
Jul
(1) |
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
(2) |
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
(4) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Guenter R. <li...@ro...> - 2014-11-06 16:45:48
|
pm_power_off is defined for all architectures. Move it to common code.
Have all architectures call do_kernel_power_off instead of pm_power_off.
Some architectures point pm_power_off to machine_power_off. For those,
call do_kernel_power_off from machine_power_off instead.
Acked-by: David Vrabel <dav...@ci...>
Acked-by: Geert Uytterhoeven <ge...@li...>
Acked-by: Hirokazu Takata <ta...@li...>
Acked-by: James Hogan <jam...@im...>
Acked-by: Jesper Nilsson <jes...@ax...>
Acked-by: Max Filippov <jcm...@gm...>
Acked-by: Rafael J. Wysocki <rj...@rj...>
Acked-by: Richard Weinberger <ri...@no...>
Acked-by: Xuetao Guan <gx...@mp...>
Acked-by: Ralf Baechle <ra...@li...>
Signed-off-by: Guenter Roeck <li...@ro...>
---
v5:
- Rebase to v3.18-rc3
- Update powerpc code to reflect merged power-off handler changes
v4:
- No change
v3:
- Replace poweroff in all newly introduced variables and in text
with power_off or power-off as appropriate
v2:
- do_kernel_poweroff -> do_kernel_power_off
- have_kernel_poweroff -> have_kernel_power_off
arch/alpha/kernel/process.c | 9 +++------
arch/arc/kernel/reset.c | 5 +----
arch/arm/kernel/process.c | 5 +----
arch/arm64/kernel/process.c | 5 +----
arch/avr32/kernel/process.c | 6 +-----
arch/blackfin/kernel/process.c | 3 ---
arch/blackfin/kernel/reboot.c | 2 ++
arch/c6x/kernel/process.c | 9 +--------
arch/cris/kernel/process.c | 4 +---
arch/frv/kernel/process.c | 5 ++---
arch/hexagon/kernel/reset.c | 5 ++---
arch/ia64/kernel/process.c | 5 +----
arch/m32r/kernel/process.c | 8 ++++----
arch/m68k/kernel/process.c | 6 +-----
arch/metag/kernel/process.c | 6 +-----
arch/microblaze/kernel/process.c | 3 ---
arch/microblaze/kernel/reset.c | 1 +
arch/mips/kernel/reset.c | 6 +-----
arch/mn10300/kernel/process.c | 8 ++------
arch/openrisc/kernel/process.c | 8 +++++---
arch/parisc/kernel/process.c | 8 ++++----
arch/powerpc/kernel/setup-common.c | 6 +-----
arch/powerpc/xmon/xmon.c | 3 +--
arch/s390/kernel/setup.c | 8 ++------
arch/score/kernel/process.c | 8 ++++----
arch/sh/kernel/reboot.c | 6 +-----
arch/sparc/kernel/process_32.c | 10 ++--------
arch/sparc/kernel/reboot.c | 8 ++------
arch/tile/kernel/reboot.c | 7 +++----
arch/um/kernel/reboot.c | 2 --
arch/unicore32/kernel/process.c | 9 +--------
arch/x86/kernel/reboot.c | 11 +++--------
arch/x86/xen/enlighten.c | 3 +--
arch/xtensa/kernel/process.c | 4 ----
drivers/parisc/power.c | 3 +--
kernel/power/power_off_handler.c | 9 +++++++++
kernel/reboot.c | 4 ++--
37 files changed, 68 insertions(+), 150 deletions(-)
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index 1941a07..81c43f8 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -24,6 +24,7 @@
#include <linux/vt.h>
#include <linux/mman.h>
#include <linux/elfcore.h>
+#include <linux/pm.h>
#include <linux/reboot.h>
#include <linux/tty.h>
#include <linux/console.h>
@@ -40,12 +41,6 @@
#include "proto.h"
#include "pci_impl.h"
-/*
- * Power off function, if any
- */
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL(pm_power_off);
-
#ifdef CONFIG_ALPHA_WTINT
/*
* Sleep the CPU.
@@ -184,6 +179,8 @@ machine_halt(void)
void
machine_power_off(void)
{
+ do_kernel_power_off();
+
common_shutdown(LINUX_REBOOT_CMD_POWER_OFF, NULL);
}
diff --git a/arch/arc/kernel/reset.c b/arch/arc/kernel/reset.c
index 2768fa1..0758d9d 100644
--- a/arch/arc/kernel/reset.c
+++ b/arch/arc/kernel/reset.c
@@ -26,9 +26,6 @@ void machine_restart(char *__unused)
void machine_power_off(void)
{
- /* FIXME :: power off ??? */
+ do_kernel_power_off();
machine_halt();
}
-
-void (*pm_power_off) (void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index fe972a2..aa3f656 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -117,8 +117,6 @@ void soft_restart(unsigned long addr)
/*
* Function pointers to optional machine specific functions
*/
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
@@ -205,8 +203,7 @@ void machine_power_off(void)
local_irq_disable();
smp_send_stop();
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
}
/*
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index fde9923..6f623a0 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -68,8 +68,6 @@ void soft_restart(unsigned long addr)
/*
* Function pointers to optional machine specific functions
*/
-void (*pm_power_off)(void);
-EXPORT_SYMBOL_GPL(pm_power_off);
void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
@@ -129,8 +127,7 @@ void machine_power_off(void)
{
local_irq_disable();
smp_send_stop();
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
}
/*
diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c
index 42a53e74..529c1f6 100644
--- a/arch/avr32/kernel/process.c
+++ b/arch/avr32/kernel/process.c
@@ -23,9 +23,6 @@
#include <mach/pm.h>
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
/*
* This file handles the architecture-dependent parts of process handling..
*/
@@ -48,8 +45,7 @@ void machine_halt(void)
void machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
}
void machine_restart(char *cmd)
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
index 4aa5545..812dd83 100644
--- a/arch/blackfin/kernel/process.c
+++ b/arch/blackfin/kernel/process.c
@@ -39,9 +39,6 @@ int nr_l1stack_tasks;
void *l1_stack_base;
unsigned long l1_stack_len;
-void (*pm_power_off)(void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
-
/*
* The idle loop on BFIN
*/
diff --git a/arch/blackfin/kernel/reboot.c b/arch/blackfin/kernel/reboot.c
index c4f50a3..387d610 100644
--- a/arch/blackfin/kernel/reboot.c
+++ b/arch/blackfin/kernel/reboot.c
@@ -7,6 +7,7 @@
*/
#include <linux/interrupt.h>
+#include <linux/pm.h>
#include <asm/bfin-global.h>
#include <asm/reboot.h>
#include <asm/bfrom.h>
@@ -106,6 +107,7 @@ void machine_halt(void)
__attribute__((weak))
void native_machine_power_off(void)
{
+ do_kernel_power_off();
idle_with_irq_disabled();
}
diff --git a/arch/c6x/kernel/process.c b/arch/c6x/kernel/process.c
index 57d2ea8..edf7e5a 100644
--- a/arch/c6x/kernel/process.c
+++ b/arch/c6x/kernel/process.c
@@ -27,12 +27,6 @@ void (*c6x_halt)(void);
extern asmlinkage void ret_from_fork(void);
extern asmlinkage void ret_from_kernel_thread(void);
-/*
- * power off function, if any
- */
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
void arch_cpu_idle(void)
{
unsigned long tmp;
@@ -73,8 +67,7 @@ void machine_halt(void)
void machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
halt_loop();
}
diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
index b78498e..9ebd76b 100644
--- a/arch/cris/kernel/process.c
+++ b/arch/cris/kernel/process.c
@@ -31,9 +31,6 @@
extern void default_idle(void);
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
void arch_cpu_idle(void)
{
default_idle();
@@ -60,6 +57,7 @@ void machine_halt(void)
void machine_power_off(void)
{
+ do_kernel_power_off();
}
/*
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
index 5d40aeb77..502dabb 100644
--- a/arch/frv/kernel/process.c
+++ b/arch/frv/kernel/process.c
@@ -42,9 +42,6 @@ asmlinkage void ret_from_kernel_thread(void);
#include <asm/pgalloc.h>
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
static void core_sleep_idle(void)
{
#ifdef LED_DEBUG_SLEEP
@@ -107,6 +104,8 @@ void machine_power_off(void)
gdbstub_exit(0);
#endif
+ do_kernel_power_off();
+
for (;;);
}
diff --git a/arch/hexagon/kernel/reset.c b/arch/hexagon/kernel/reset.c
index 76483c1..6f607b6 100644
--- a/arch/hexagon/kernel/reset.c
+++ b/arch/hexagon/kernel/reset.c
@@ -16,11 +16,13 @@
* 02110-1301, USA.
*/
+#include <linux/pm.h>
#include <linux/smp.h>
#include <asm/hexagon_vm.h>
void machine_power_off(void)
{
+ do_kernel_power_off();
smp_send_stop();
__vmstop();
}
@@ -32,6 +34,3 @@ void machine_halt(void)
void machine_restart(char *cmd)
{
}
-
-void (*pm_power_off)(void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index b515149..88121a2 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -57,8 +57,6 @@ void (*ia64_mark_idle)(int);
unsigned long boot_option_idle_override = IDLE_NO_OVERRIDE;
EXPORT_SYMBOL(boot_option_idle_override);
-void (*pm_power_off) (void);
-EXPORT_SYMBOL(pm_power_off);
void
ia64_do_show_stack (struct unw_frame_info *info, void *arg)
@@ -675,8 +673,7 @@ machine_halt (void)
void
machine_power_off (void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
machine_halt();
}
diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c
index e69221d..65a037e 100644
--- a/arch/m32r/kernel/process.c
+++ b/arch/m32r/kernel/process.c
@@ -23,6 +23,7 @@
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/module.h>
+#include <linux/pm.h>
#include <linux/ptrace.h>
#include <linux/unistd.h>
#include <linux/hardirq.h>
@@ -44,9 +45,6 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
return tsk->thread.lr;
}
-void (*pm_power_off)(void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
-
void machine_restart(char *__unused)
{
#if defined(CONFIG_PLAT_MAPPI3)
@@ -67,7 +65,9 @@ void machine_halt(void)
void machine_power_off(void)
{
- /* M32R_FIXME */
+ do_kernel_power_off();
+ for (;;)
+ ;
}
void show_regs(struct pt_regs * regs)
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index afe3d6e..bbc0a63 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -78,14 +78,10 @@ void machine_halt(void)
void machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
for (;;);
}
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL(pm_power_off);
-
void show_regs(struct pt_regs * regs)
{
printk("\n");
diff --git a/arch/metag/kernel/process.c b/arch/metag/kernel/process.c
index 483dff9..8d95773 100644
--- a/arch/metag/kernel/process.c
+++ b/arch/metag/kernel/process.c
@@ -67,9 +67,6 @@ void arch_cpu_idle_dead(void)
}
#endif
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
void (*soc_restart)(char *cmd);
void (*soc_halt)(void);
@@ -90,8 +87,7 @@ void machine_halt(void)
void machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
smp_send_stop();
hard_processor_halt(HALT_OK);
}
diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c
index b2dd371..0ebca36 100644
--- a/arch/microblaze/kernel/process.c
+++ b/arch/microblaze/kernel/process.c
@@ -44,9 +44,6 @@ void show_regs(struct pt_regs *regs)
regs->msr, regs->ear, regs->esr, regs->fsr);
}
-void (*pm_power_off)(void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
-
void flush_thread(void)
{
}
diff --git a/arch/microblaze/kernel/reset.c b/arch/microblaze/kernel/reset.c
index fbe58c6..2c6b32c 100644
--- a/arch/microblaze/kernel/reset.c
+++ b/arch/microblaze/kernel/reset.c
@@ -103,6 +103,7 @@ void machine_halt(void)
void machine_power_off(void)
{
pr_notice("Machine power off...\n");
+ do_kernel_power_off();
while (1)
;
}
diff --git a/arch/mips/kernel/reset.c b/arch/mips/kernel/reset.c
index 07fc524..09e74d2 100644
--- a/arch/mips/kernel/reset.c
+++ b/arch/mips/kernel/reset.c
@@ -21,9 +21,6 @@
*/
void (*_machine_restart)(char *command);
void (*_machine_halt)(void);
-void (*pm_power_off)(void);
-
-EXPORT_SYMBOL(pm_power_off);
void machine_restart(char *command)
{
@@ -39,6 +36,5 @@ void machine_halt(void)
void machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
}
diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c
index 3707da5..c78b2eb 100644
--- a/arch/mn10300/kernel/process.c
+++ b/arch/mn10300/kernel/process.c
@@ -20,6 +20,7 @@
#include <linux/user.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
+#include <linux/pm.h>
#include <linux/reboot.h>
#include <linux/percpu.h>
#include <linux/err.h>
@@ -45,12 +46,6 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
}
/*
- * power off function, if any
- */
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
-/*
* On SMP it's slightly faster (but much more power-consuming!)
* to poll the ->work.need_resched flag instead of waiting for the
* cross-CPU IPI to arrive. Use this option with caution.
@@ -93,6 +88,7 @@ void machine_power_off(void)
#ifdef CONFIG_KERNEL_DEBUGGER
gdbstub_exit(0);
#endif
+ do_kernel_power_off();
}
void show_regs(struct pt_regs *regs)
diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c
index 386af25..494afd2 100644
--- a/arch/openrisc/kernel/process.c
+++ b/arch/openrisc/kernel/process.c
@@ -25,6 +25,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mm.h>
+#include <linux/pm.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/ptrace.h>
@@ -51,7 +52,7 @@
*/
struct thread_info *current_thread_info_set[NR_CPUS] = { &init_thread_info, };
-void machine_restart(void)
+void machine_restart(char *cmd)
{
printk(KERN_INFO "*** MACHINE RESTART ***\n");
__asm__("l.nop 1");
@@ -72,11 +73,12 @@ void machine_halt(void)
void machine_power_off(void)
{
printk(KERN_INFO "*** MACHINE POWER OFF ***\n");
+
+ do_kernel_power_off();
+
__asm__("l.nop 1");
}
-void (*pm_power_off) (void) = machine_power_off;
-
/*
* When a process does an "exec", machine state like FPU and debug
* registers need to be reset. This is a hook function for that.
diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
index 0bbbf0d..3f5d14a 100644
--- a/arch/parisc/kernel/process.c
+++ b/arch/parisc/kernel/process.c
@@ -41,6 +41,7 @@
#include <linux/fs.h>
#include <linux/module.h>
#include <linux/personality.h>
+#include <linux/pm.h>
#include <linux/ptrace.h>
#include <linux/sched.h>
#include <linux/slab.h>
@@ -133,7 +134,9 @@ void machine_power_off(void)
pdc_soft_power_button(0);
pdc_chassis_send_status(PDC_CHASSIS_DIRECT_SHUTDOWN);
-
+
+ do_kernel_power_off();
+
/* It seems we have no way to power the system off via
* software. The user has to press the button himself. */
@@ -141,9 +144,6 @@ void machine_power_off(void)
"Please power this system off now.");
}
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL(pm_power_off);
-
/*
* Free current thread data structures etc..
*/
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 44c8d03..a2efce7 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -139,8 +139,7 @@ void machine_restart(char *cmd)
void machine_power_off(void)
{
machine_shutdown();
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
#ifdef CONFIG_SMP
smp_send_stop();
#endif
@@ -151,9 +150,6 @@ void machine_power_off(void)
/* Used by the G5 thermal driver */
EXPORT_SYMBOL_GPL(machine_power_off);
-void (*pm_power_off)(void);
-EXPORT_SYMBOL_GPL(pm_power_off);
-
void machine_halt(void)
{
machine_shutdown();
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 506d256..8780178 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -981,8 +981,7 @@ static void bootcmds(void)
else if (cmd == 'h')
ppc_md.halt();
else if (cmd == 'p')
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
}
static int cpu_cmd(void)
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index e80d9ff..267e025 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -263,13 +263,9 @@ void machine_power_off(void)
*/
console_unblank();
_machine_power_off();
-}
-/*
- * Dummy power off function.
- */
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL_GPL(pm_power_off);
+ do_kernel_power_off();
+}
static int __init early_parse_mem(char *p)
{
diff --git a/arch/score/kernel/process.c b/arch/score/kernel/process.c
index a1519ad3..b76ea67 100644
--- a/arch/score/kernel/process.c
+++ b/arch/score/kernel/process.c
@@ -29,9 +29,6 @@
#include <linux/pm.h>
#include <linux/rcupdate.h>
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
/* If or when software machine-restart is implemented, add code here. */
void machine_restart(char *command) {}
@@ -39,7 +36,10 @@ void machine_restart(char *command) {}
void machine_halt(void) {}
/* If or when software machine-power-off is implemented, add code here. */
-void machine_power_off(void) {}
+void machine_power_off(void)
+{
+ do_kernel_power_off();
+}
void ret_from_fork(void);
void ret_from_kernel_thread(void);
diff --git a/arch/sh/kernel/reboot.c b/arch/sh/kernel/reboot.c
index 04afe5b..065de12 100644
--- a/arch/sh/kernel/reboot.c
+++ b/arch/sh/kernel/reboot.c
@@ -11,9 +11,6 @@
#include <asm/tlbflush.h>
#include <asm/traps.h>
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
#ifdef CONFIG_SUPERH32
static void watchdog_trigger_immediate(void)
{
@@ -51,8 +48,7 @@ static void native_machine_shutdown(void)
static void native_machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
}
static void native_machine_halt(void)
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
index 50e7b62..cb8148a 100644
--- a/arch/sparc/kernel/process_32.c
+++ b/arch/sparc/kernel/process_32.c
@@ -48,14 +48,6 @@
*/
void (*sparc_idle)(void);
-/*
- * Power-off handler instantiation for pm.h compliance
- * This is done via auxio, but could be used as a fallback
- * handler when auxio is not present-- unused for now...
- */
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL(pm_power_off);
-
/*
* sysctl - toggle power-off restriction for serial console
* systems in machine_power_off()
@@ -112,6 +104,8 @@ void machine_power_off(void)
sbus_writeb(power_register, auxio_power_register);
}
+ do_kernel_power_off();
+
machine_halt();
}
diff --git a/arch/sparc/kernel/reboot.c b/arch/sparc/kernel/reboot.c
index eba7d91..3c0bb03 100644
--- a/arch/sparc/kernel/reboot.c
+++ b/arch/sparc/kernel/reboot.c
@@ -16,17 +16,13 @@
*/
int scons_pwroff = 1;
-/* This isn't actually used, it exists merely to satisfy the
- * reference in kernel/sys.c
- */
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL(pm_power_off);
-
void machine_power_off(void)
{
if (strcmp(of_console_device->type, "serial") || scons_pwroff)
prom_halt_power_off();
+ do_kernel_power_off();
+
prom_halt();
}
diff --git a/arch/tile/kernel/reboot.c b/arch/tile/kernel/reboot.c
index 6c5d2c0..8ff4a7f 100644
--- a/arch/tile/kernel/reboot.c
+++ b/arch/tile/kernel/reboot.c
@@ -36,6 +36,9 @@ void machine_power_off(void)
{
arch_local_irq_disable_all();
smp_send_stop();
+
+ do_kernel_power_off();
+
hv_power_off();
}
@@ -45,7 +48,3 @@ void machine_restart(char *cmd)
smp_send_stop();
hv_restart((HV_VirtAddr) "vmlinux", (HV_VirtAddr) cmd);
}
-
-/* No interesting distinction to be made here. */
-void (*pm_power_off)(void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c
index ced8903..a82ef28 100644
--- a/arch/um/kernel/reboot.c
+++ b/arch/um/kernel/reboot.c
@@ -11,8 +11,6 @@
#include <os.h>
#include <skas.h>
-void (*pm_power_off)(void);
-
static void kill_off_processes(void)
{
if (proc_mm)
diff --git a/arch/unicore32/kernel/process.c b/arch/unicore32/kernel/process.c
index b008e99..9490dd5 100644
--- a/arch/unicore32/kernel/process.c
+++ b/arch/unicore32/kernel/process.c
@@ -56,16 +56,9 @@ void machine_halt(void)
gpio_set_value(GPO_SOFT_OFF, 0);
}
-/*
- * Function pointers to optional machine specific functions
- */
-void (*pm_power_off)(void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
-
void machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
machine_halt();
}
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 17962e6..5c09e28 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -30,12 +30,6 @@
#include <asm/x86_init.h>
#include <asm/efi.h>
-/*
- * Power off function, if any
- */
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
static const struct desc_ptr no_idt = {};
/*
@@ -647,11 +641,12 @@ static void native_machine_halt(void)
static void native_machine_power_off(void)
{
- if (pm_power_off) {
+ if (have_kernel_power_off()) {
if (!reboot_force)
machine_shutdown();
- pm_power_off();
+ do_kernel_power_off();
}
+
/* A fallback in case there is no PM info available */
tboot_shutdown(TB_SHUTDOWN_HALT);
}
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index fac5e4f..bc08998 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1320,8 +1320,7 @@ static void xen_machine_halt(void)
static void xen_machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
xen_reboot(SHUTDOWN_poweroff);
}
diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
index 1c85323..c487296 100644
--- a/arch/xtensa/kernel/process.c
+++ b/arch/xtensa/kernel/process.c
@@ -49,10 +49,6 @@ extern void ret_from_kernel_thread(void);
struct task_struct *current_set[NR_CPUS] = {&init_task, };
-void (*pm_power_off)(void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
-
-
#if XTENSA_HAVE_COPROCESSORS
void coprocessor_release_all(struct thread_info *ti)
diff --git a/drivers/parisc/power.c b/drivers/parisc/power.c
index ef31b77..f10cf92 100644
--- a/drivers/parisc/power.c
+++ b/drivers/parisc/power.c
@@ -95,8 +95,7 @@ static void process_shutdown(void)
/* send kill signal */
if (kill_cad_pid(SIGINT, 1)) {
/* just in case killing init process failed */
- if (pm_power_off)
- pm_power_off();
+ kernel_power_off();
}
}
}
diff --git a/kernel/power/power_off_handler.c b/kernel/power/power_off_handler.c
index e576534..e283ea1 100644
--- a/kernel/power/power_off_handler.c
+++ b/kernel/power/power_off_handler.c
@@ -23,6 +23,12 @@
#include <linux/types.h>
/*
+ * If set, calling this function will power off the system immediately.
+ */
+void (*pm_power_off)(void);
+EXPORT_SYMBOL(pm_power_off);
+
+/*
* List of handlers for kernel code which wants to be called
* to power off the system.
*/
@@ -272,6 +278,9 @@ void do_kernel_power_off(void)
* that risk.
*/
+ if (pm_power_off)
+ pm_power_off();
+
p = rcu_dereference_raw(power_off_handler_list);
while (p) {
next_p = rcu_dereference_raw(p->next);
diff --git a/kernel/reboot.c b/kernel/reboot.c
index 5925f5a..d87d921 100644
--- a/kernel/reboot.c
+++ b/kernel/reboot.c
@@ -306,9 +306,9 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
return ret;
/* Instead of trying to make the power_off code look like
- * halt when pm_power_off is not set do it the easy way.
+ * halt when no power-off handler exists do it the easy way.
*/
- if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)
+ if (cmd == LINUX_REBOOT_CMD_POWER_OFF && !have_kernel_power_off())
cmd = LINUX_REBOOT_CMD_HALT;
mutex_lock(&reboot_mutex);
--
1.9.1
|
|
From: Guenter R. <li...@ro...> - 2014-10-27 15:58:07
|
pm_power_off is defined for all architectures. Move it to common code.
Have all architectures call do_kernel_power_off instead of pm_power_off.
Some architectures point pm_power_off to machine_power_off. For those,
call do_kernel_power_off from machine_power_off instead.
Acked-by: David Vrabel <dav...@ci...>
Acked-by: Geert Uytterhoeven <ge...@li...>
Acked-by: Hirokazu Takata <ta...@li...>
Acked-by: James Hogan <jam...@im...>
Acked-by: Jesper Nilsson <jes...@ax...>
Acked-by: Max Filippov <jcm...@gm...>
Acked-by: Rafael J. Wysocki <rj...@rj...>
Acked-by: Richard Weinberger <ri...@no...>
Acked-by: Xuetao Guan <gx...@mp...>
Acked-by: Ralf Baechle <ra...@li...>
Signed-off-by: Guenter Roeck <li...@ro...>
---
v3:
- Replace poweroff in all newly introduced variables and in text
with power_off or power-off as appropriate
v2:
- do_kernel_poweroff -> do_kernel_power_off
- have_kernel_poweroff -> have_kernel_power_off
arch/alpha/kernel/process.c | 9 +++------
arch/arc/kernel/reset.c | 5 +----
arch/arm/kernel/process.c | 5 +----
arch/arm64/kernel/process.c | 5 +----
arch/avr32/kernel/process.c | 6 +-----
arch/blackfin/kernel/process.c | 3 ---
arch/blackfin/kernel/reboot.c | 2 ++
arch/c6x/kernel/process.c | 9 +--------
arch/cris/kernel/process.c | 4 +---
arch/frv/kernel/process.c | 5 ++---
arch/hexagon/kernel/reset.c | 5 ++---
arch/ia64/kernel/process.c | 5 +----
arch/m32r/kernel/process.c | 8 ++++----
arch/m68k/kernel/process.c | 6 +-----
arch/metag/kernel/process.c | 6 +-----
arch/microblaze/kernel/process.c | 3 ---
arch/microblaze/kernel/reset.c | 1 +
arch/mips/kernel/reset.c | 6 +-----
arch/mn10300/kernel/process.c | 8 ++------
arch/openrisc/kernel/process.c | 8 +++++---
arch/parisc/kernel/process.c | 8 ++++----
arch/powerpc/kernel/setup-common.c | 6 +++---
arch/s390/kernel/setup.c | 8 ++------
arch/score/kernel/process.c | 8 ++++----
arch/sh/kernel/reboot.c | 6 +-----
arch/sparc/kernel/process_32.c | 10 ++--------
arch/sparc/kernel/reboot.c | 8 ++------
arch/tile/kernel/reboot.c | 7 +++----
arch/um/kernel/reboot.c | 2 --
arch/unicore32/kernel/process.c | 9 +--------
arch/x86/kernel/reboot.c | 11 +++--------
arch/x86/xen/enlighten.c | 3 +--
arch/xtensa/kernel/process.c | 4 ----
drivers/parisc/power.c | 3 +--
kernel/power/power_off_handler.c | 8 ++++++++
kernel/reboot.c | 4 ++--
36 files changed, 68 insertions(+), 146 deletions(-)
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index 1941a07..81c43f8 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -24,6 +24,7 @@
#include <linux/vt.h>
#include <linux/mman.h>
#include <linux/elfcore.h>
+#include <linux/pm.h>
#include <linux/reboot.h>
#include <linux/tty.h>
#include <linux/console.h>
@@ -40,12 +41,6 @@
#include "proto.h"
#include "pci_impl.h"
-/*
- * Power off function, if any
- */
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL(pm_power_off);
-
#ifdef CONFIG_ALPHA_WTINT
/*
* Sleep the CPU.
@@ -184,6 +179,8 @@ machine_halt(void)
void
machine_power_off(void)
{
+ do_kernel_power_off();
+
common_shutdown(LINUX_REBOOT_CMD_POWER_OFF, NULL);
}
diff --git a/arch/arc/kernel/reset.c b/arch/arc/kernel/reset.c
index 2768fa1..0758d9d 100644
--- a/arch/arc/kernel/reset.c
+++ b/arch/arc/kernel/reset.c
@@ -26,9 +26,6 @@ void machine_restart(char *__unused)
void machine_power_off(void)
{
- /* FIXME :: power off ??? */
+ do_kernel_power_off();
machine_halt();
}
-
-void (*pm_power_off) (void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index fe972a2..aa3f656 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -117,8 +117,6 @@ void soft_restart(unsigned long addr)
/*
* Function pointers to optional machine specific functions
*/
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
@@ -205,8 +203,7 @@ void machine_power_off(void)
local_irq_disable();
smp_send_stop();
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
}
/*
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index fde9923..6f623a0 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -68,8 +68,6 @@ void soft_restart(unsigned long addr)
/*
* Function pointers to optional machine specific functions
*/
-void (*pm_power_off)(void);
-EXPORT_SYMBOL_GPL(pm_power_off);
void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
@@ -129,8 +127,7 @@ void machine_power_off(void)
{
local_irq_disable();
smp_send_stop();
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
}
/*
diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c
index 42a53e74..529c1f6 100644
--- a/arch/avr32/kernel/process.c
+++ b/arch/avr32/kernel/process.c
@@ -23,9 +23,6 @@
#include <mach/pm.h>
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
/*
* This file handles the architecture-dependent parts of process handling..
*/
@@ -48,8 +45,7 @@ void machine_halt(void)
void machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
}
void machine_restart(char *cmd)
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
index 4aa5545..812dd83 100644
--- a/arch/blackfin/kernel/process.c
+++ b/arch/blackfin/kernel/process.c
@@ -39,9 +39,6 @@ int nr_l1stack_tasks;
void *l1_stack_base;
unsigned long l1_stack_len;
-void (*pm_power_off)(void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
-
/*
* The idle loop on BFIN
*/
diff --git a/arch/blackfin/kernel/reboot.c b/arch/blackfin/kernel/reboot.c
index c4f50a3..387d610 100644
--- a/arch/blackfin/kernel/reboot.c
+++ b/arch/blackfin/kernel/reboot.c
@@ -7,6 +7,7 @@
*/
#include <linux/interrupt.h>
+#include <linux/pm.h>
#include <asm/bfin-global.h>
#include <asm/reboot.h>
#include <asm/bfrom.h>
@@ -106,6 +107,7 @@ void machine_halt(void)
__attribute__((weak))
void native_machine_power_off(void)
{
+ do_kernel_power_off();
idle_with_irq_disabled();
}
diff --git a/arch/c6x/kernel/process.c b/arch/c6x/kernel/process.c
index 57d2ea8..edf7e5a 100644
--- a/arch/c6x/kernel/process.c
+++ b/arch/c6x/kernel/process.c
@@ -27,12 +27,6 @@ void (*c6x_halt)(void);
extern asmlinkage void ret_from_fork(void);
extern asmlinkage void ret_from_kernel_thread(void);
-/*
- * power off function, if any
- */
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
void arch_cpu_idle(void)
{
unsigned long tmp;
@@ -73,8 +67,7 @@ void machine_halt(void)
void machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
halt_loop();
}
diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
index b78498e..9ebd76b 100644
--- a/arch/cris/kernel/process.c
+++ b/arch/cris/kernel/process.c
@@ -31,9 +31,6 @@
extern void default_idle(void);
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
void arch_cpu_idle(void)
{
default_idle();
@@ -60,6 +57,7 @@ void machine_halt(void)
void machine_power_off(void)
{
+ do_kernel_power_off();
}
/*
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
index 5d40aeb77..502dabb 100644
--- a/arch/frv/kernel/process.c
+++ b/arch/frv/kernel/process.c
@@ -42,9 +42,6 @@ asmlinkage void ret_from_kernel_thread(void);
#include <asm/pgalloc.h>
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
static void core_sleep_idle(void)
{
#ifdef LED_DEBUG_SLEEP
@@ -107,6 +104,8 @@ void machine_power_off(void)
gdbstub_exit(0);
#endif
+ do_kernel_power_off();
+
for (;;);
}
diff --git a/arch/hexagon/kernel/reset.c b/arch/hexagon/kernel/reset.c
index 76483c1..6f607b6 100644
--- a/arch/hexagon/kernel/reset.c
+++ b/arch/hexagon/kernel/reset.c
@@ -16,11 +16,13 @@
* 02110-1301, USA.
*/
+#include <linux/pm.h>
#include <linux/smp.h>
#include <asm/hexagon_vm.h>
void machine_power_off(void)
{
+ do_kernel_power_off();
smp_send_stop();
__vmstop();
}
@@ -32,6 +34,3 @@ void machine_halt(void)
void machine_restart(char *cmd)
{
}
-
-void (*pm_power_off)(void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index b515149..88121a2 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -57,8 +57,6 @@ void (*ia64_mark_idle)(int);
unsigned long boot_option_idle_override = IDLE_NO_OVERRIDE;
EXPORT_SYMBOL(boot_option_idle_override);
-void (*pm_power_off) (void);
-EXPORT_SYMBOL(pm_power_off);
void
ia64_do_show_stack (struct unw_frame_info *info, void *arg)
@@ -675,8 +673,7 @@ machine_halt (void)
void
machine_power_off (void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
machine_halt();
}
diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c
index e69221d..65a037e 100644
--- a/arch/m32r/kernel/process.c
+++ b/arch/m32r/kernel/process.c
@@ -23,6 +23,7 @@
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/module.h>
+#include <linux/pm.h>
#include <linux/ptrace.h>
#include <linux/unistd.h>
#include <linux/hardirq.h>
@@ -44,9 +45,6 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
return tsk->thread.lr;
}
-void (*pm_power_off)(void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
-
void machine_restart(char *__unused)
{
#if defined(CONFIG_PLAT_MAPPI3)
@@ -67,7 +65,9 @@ void machine_halt(void)
void machine_power_off(void)
{
- /* M32R_FIXME */
+ do_kernel_power_off();
+ for (;;)
+ ;
}
void show_regs(struct pt_regs * regs)
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index afe3d6e..bbc0a63 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -78,14 +78,10 @@ void machine_halt(void)
void machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
for (;;);
}
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL(pm_power_off);
-
void show_regs(struct pt_regs * regs)
{
printk("\n");
diff --git a/arch/metag/kernel/process.c b/arch/metag/kernel/process.c
index 483dff9..8d95773 100644
--- a/arch/metag/kernel/process.c
+++ b/arch/metag/kernel/process.c
@@ -67,9 +67,6 @@ void arch_cpu_idle_dead(void)
}
#endif
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
void (*soc_restart)(char *cmd);
void (*soc_halt)(void);
@@ -90,8 +87,7 @@ void machine_halt(void)
void machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
smp_send_stop();
hard_processor_halt(HALT_OK);
}
diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c
index b2dd371..0ebca36 100644
--- a/arch/microblaze/kernel/process.c
+++ b/arch/microblaze/kernel/process.c
@@ -44,9 +44,6 @@ void show_regs(struct pt_regs *regs)
regs->msr, regs->ear, regs->esr, regs->fsr);
}
-void (*pm_power_off)(void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
-
void flush_thread(void)
{
}
diff --git a/arch/microblaze/kernel/reset.c b/arch/microblaze/kernel/reset.c
index fbe58c6..2c6b32c 100644
--- a/arch/microblaze/kernel/reset.c
+++ b/arch/microblaze/kernel/reset.c
@@ -103,6 +103,7 @@ void machine_halt(void)
void machine_power_off(void)
{
pr_notice("Machine power off...\n");
+ do_kernel_power_off();
while (1)
;
}
diff --git a/arch/mips/kernel/reset.c b/arch/mips/kernel/reset.c
index 07fc524..09e74d2 100644
--- a/arch/mips/kernel/reset.c
+++ b/arch/mips/kernel/reset.c
@@ -21,9 +21,6 @@
*/
void (*_machine_restart)(char *command);
void (*_machine_halt)(void);
-void (*pm_power_off)(void);
-
-EXPORT_SYMBOL(pm_power_off);
void machine_restart(char *command)
{
@@ -39,6 +36,5 @@ void machine_halt(void)
void machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
}
diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c
index 3707da5..c78b2eb 100644
--- a/arch/mn10300/kernel/process.c
+++ b/arch/mn10300/kernel/process.c
@@ -20,6 +20,7 @@
#include <linux/user.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
+#include <linux/pm.h>
#include <linux/reboot.h>
#include <linux/percpu.h>
#include <linux/err.h>
@@ -45,12 +46,6 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
}
/*
- * power off function, if any
- */
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
-/*
* On SMP it's slightly faster (but much more power-consuming!)
* to poll the ->work.need_resched flag instead of waiting for the
* cross-CPU IPI to arrive. Use this option with caution.
@@ -93,6 +88,7 @@ void machine_power_off(void)
#ifdef CONFIG_KERNEL_DEBUGGER
gdbstub_exit(0);
#endif
+ do_kernel_power_off();
}
void show_regs(struct pt_regs *regs)
diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c
index 386af25..494afd2 100644
--- a/arch/openrisc/kernel/process.c
+++ b/arch/openrisc/kernel/process.c
@@ -25,6 +25,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mm.h>
+#include <linux/pm.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/ptrace.h>
@@ -51,7 +52,7 @@
*/
struct thread_info *current_thread_info_set[NR_CPUS] = { &init_thread_info, };
-void machine_restart(void)
+void machine_restart(char *cmd)
{
printk(KERN_INFO "*** MACHINE RESTART ***\n");
__asm__("l.nop 1");
@@ -72,11 +73,12 @@ void machine_halt(void)
void machine_power_off(void)
{
printk(KERN_INFO "*** MACHINE POWER OFF ***\n");
+
+ do_kernel_power_off();
+
__asm__("l.nop 1");
}
-void (*pm_power_off) (void) = machine_power_off;
-
/*
* When a process does an "exec", machine state like FPU and debug
* registers need to be reset. This is a hook function for that.
diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
index 0bbbf0d..3f5d14a 100644
--- a/arch/parisc/kernel/process.c
+++ b/arch/parisc/kernel/process.c
@@ -41,6 +41,7 @@
#include <linux/fs.h>
#include <linux/module.h>
#include <linux/personality.h>
+#include <linux/pm.h>
#include <linux/ptrace.h>
#include <linux/sched.h>
#include <linux/slab.h>
@@ -133,7 +134,9 @@ void machine_power_off(void)
pdc_soft_power_button(0);
pdc_chassis_send_status(PDC_CHASSIS_DIRECT_SHUTDOWN);
-
+
+ do_kernel_power_off();
+
/* It seems we have no way to power the system off via
* software. The user has to press the button himself. */
@@ -141,9 +144,6 @@ void machine_power_off(void)
"Please power this system off now.");
}
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL(pm_power_off);
-
/*
* Free current thread data structures etc..
*/
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 1362cd6..5b7a851 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -141,6 +141,9 @@ void machine_power_off(void)
machine_shutdown();
if (ppc_md.power_off)
ppc_md.power_off();
+
+ do_kernel_power_off();
+
#ifdef CONFIG_SMP
smp_send_stop();
#endif
@@ -151,9 +154,6 @@ void machine_power_off(void)
/* Used by the G5 thermal driver */
EXPORT_SYMBOL_GPL(machine_power_off);
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL_GPL(pm_power_off);
-
void machine_halt(void)
{
machine_shutdown();
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index e80d9ff..267e025 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -263,13 +263,9 @@ void machine_power_off(void)
*/
console_unblank();
_machine_power_off();
-}
-/*
- * Dummy power off function.
- */
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL_GPL(pm_power_off);
+ do_kernel_power_off();
+}
static int __init early_parse_mem(char *p)
{
diff --git a/arch/score/kernel/process.c b/arch/score/kernel/process.c
index a1519ad3..b76ea67 100644
--- a/arch/score/kernel/process.c
+++ b/arch/score/kernel/process.c
@@ -29,9 +29,6 @@
#include <linux/pm.h>
#include <linux/rcupdate.h>
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
/* If or when software machine-restart is implemented, add code here. */
void machine_restart(char *command) {}
@@ -39,7 +36,10 @@ void machine_restart(char *command) {}
void machine_halt(void) {}
/* If or when software machine-power-off is implemented, add code here. */
-void machine_power_off(void) {}
+void machine_power_off(void)
+{
+ do_kernel_power_off();
+}
void ret_from_fork(void);
void ret_from_kernel_thread(void);
diff --git a/arch/sh/kernel/reboot.c b/arch/sh/kernel/reboot.c
index 04afe5b..065de12 100644
--- a/arch/sh/kernel/reboot.c
+++ b/arch/sh/kernel/reboot.c
@@ -11,9 +11,6 @@
#include <asm/tlbflush.h>
#include <asm/traps.h>
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
#ifdef CONFIG_SUPERH32
static void watchdog_trigger_immediate(void)
{
@@ -51,8 +48,7 @@ static void native_machine_shutdown(void)
static void native_machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
}
static void native_machine_halt(void)
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
index 50e7b62..cb8148a 100644
--- a/arch/sparc/kernel/process_32.c
+++ b/arch/sparc/kernel/process_32.c
@@ -48,14 +48,6 @@
*/
void (*sparc_idle)(void);
-/*
- * Power-off handler instantiation for pm.h compliance
- * This is done via auxio, but could be used as a fallback
- * handler when auxio is not present-- unused for now...
- */
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL(pm_power_off);
-
/*
* sysctl - toggle power-off restriction for serial console
* systems in machine_power_off()
@@ -112,6 +104,8 @@ void machine_power_off(void)
sbus_writeb(power_register, auxio_power_register);
}
+ do_kernel_power_off();
+
machine_halt();
}
diff --git a/arch/sparc/kernel/reboot.c b/arch/sparc/kernel/reboot.c
index eba7d91..3c0bb03 100644
--- a/arch/sparc/kernel/reboot.c
+++ b/arch/sparc/kernel/reboot.c
@@ -16,17 +16,13 @@
*/
int scons_pwroff = 1;
-/* This isn't actually used, it exists merely to satisfy the
- * reference in kernel/sys.c
- */
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL(pm_power_off);
-
void machine_power_off(void)
{
if (strcmp(of_console_device->type, "serial") || scons_pwroff)
prom_halt_power_off();
+ do_kernel_power_off();
+
prom_halt();
}
diff --git a/arch/tile/kernel/reboot.c b/arch/tile/kernel/reboot.c
index 6c5d2c0..8ff4a7f 100644
--- a/arch/tile/kernel/reboot.c
+++ b/arch/tile/kernel/reboot.c
@@ -36,6 +36,9 @@ void machine_power_off(void)
{
arch_local_irq_disable_all();
smp_send_stop();
+
+ do_kernel_power_off();
+
hv_power_off();
}
@@ -45,7 +48,3 @@ void machine_restart(char *cmd)
smp_send_stop();
hv_restart((HV_VirtAddr) "vmlinux", (HV_VirtAddr) cmd);
}
-
-/* No interesting distinction to be made here. */
-void (*pm_power_off)(void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c
index ced8903..a82ef28 100644
--- a/arch/um/kernel/reboot.c
+++ b/arch/um/kernel/reboot.c
@@ -11,8 +11,6 @@
#include <os.h>
#include <skas.h>
-void (*pm_power_off)(void);
-
static void kill_off_processes(void)
{
if (proc_mm)
diff --git a/arch/unicore32/kernel/process.c b/arch/unicore32/kernel/process.c
index b008e99..9490dd5 100644
--- a/arch/unicore32/kernel/process.c
+++ b/arch/unicore32/kernel/process.c
@@ -56,16 +56,9 @@ void machine_halt(void)
gpio_set_value(GPO_SOFT_OFF, 0);
}
-/*
- * Function pointers to optional machine specific functions
- */
-void (*pm_power_off)(void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
-
void machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
machine_halt();
}
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 17962e6..5c09e28 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -30,12 +30,6 @@
#include <asm/x86_init.h>
#include <asm/efi.h>
-/*
- * Power off function, if any
- */
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
static const struct desc_ptr no_idt = {};
/*
@@ -647,11 +641,12 @@ static void native_machine_halt(void)
static void native_machine_power_off(void)
{
- if (pm_power_off) {
+ if (have_kernel_power_off()) {
if (!reboot_force)
machine_shutdown();
- pm_power_off();
+ do_kernel_power_off();
}
+
/* A fallback in case there is no PM info available */
tboot_shutdown(TB_SHUTDOWN_HALT);
}
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index fac5e4f..bc08998 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1320,8 +1320,7 @@ static void xen_machine_halt(void)
static void xen_machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
xen_reboot(SHUTDOWN_poweroff);
}
diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
index 1c85323..c487296 100644
--- a/arch/xtensa/kernel/process.c
+++ b/arch/xtensa/kernel/process.c
@@ -49,10 +49,6 @@ extern void ret_from_kernel_thread(void);
struct task_struct *current_set[NR_CPUS] = {&init_task, };
-void (*pm_power_off)(void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
-
-
#if XTENSA_HAVE_COPROCESSORS
void coprocessor_release_all(struct thread_info *ti)
diff --git a/drivers/parisc/power.c b/drivers/parisc/power.c
index ef31b77..f10cf92 100644
--- a/drivers/parisc/power.c
+++ b/drivers/parisc/power.c
@@ -95,8 +95,7 @@ static void process_shutdown(void)
/* send kill signal */
if (kill_cad_pid(SIGINT, 1)) {
/* just in case killing init process failed */
- if (pm_power_off)
- pm_power_off();
+ kernel_power_off();
}
}
}
diff --git a/kernel/power/power_off_handler.c b/kernel/power/power_off_handler.c
index f838e63..97b7163 100644
--- a/kernel/power/power_off_handler.c
+++ b/kernel/power/power_off_handler.c
@@ -22,6 +22,12 @@
#include <linux/types.h>
/*
+ * If set, calling this function will power off the system immediately.
+ */
+void (*pm_power_off)(void);
+EXPORT_SYMBOL(pm_power_off);
+
+/*
* Notifier list for kernel code which wants to be called
* to power off the system.
*/
@@ -253,6 +259,8 @@ void do_kernel_power_off(void)
* removed while the call chain is traversed, but we'll have to carry
* that risk.
*/
+ if (pm_power_off)
+ pm_power_off();
raw_notifier_call_chain(&power_off_handler_list, 0, NULL);
}
diff --git a/kernel/reboot.c b/kernel/reboot.c
index 5925f5a..d87d921 100644
--- a/kernel/reboot.c
+++ b/kernel/reboot.c
@@ -306,9 +306,9 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
return ret;
/* Instead of trying to make the power_off code look like
- * halt when pm_power_off is not set do it the easy way.
+ * halt when no power-off handler exists do it the easy way.
*/
- if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)
+ if (cmd == LINUX_REBOOT_CMD_POWER_OFF && !have_kernel_power_off())
cmd = LINUX_REBOOT_CMD_HALT;
mutex_lock(&reboot_mutex);
--
1.9.1
|
|
From: Chen G. <gan...@gm...> - 2014-10-24 22:46:31
|
Hello Maintainers: Please help check this patch, when you have time. Thanks. On 10/4/14 21:11, Chen Gang wrote: > syscall() is implemented in libc.so/a (e.g. for glibc, in "syscall.o"), > so for normal ".o" files, it is undefined, neither can be found within > kernel wide, so will break modpost. > > Since ".o" files is OK, can simply export 'syscall' symbol, let modpost > know about that, then can fix this issue. > > The related error (with allmodconfig under um): > > MODPOST 1205 modules > ERROR: "syscall" [fs/hostfs/hostfs.ko] undefined! > > Signed-off-by: Chen Gang <gan...@gm...> > --- > arch/um/kernel/ksyms.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/um/kernel/ksyms.c b/arch/um/kernel/ksyms.c > index 543c047..e7780f3 100644 > --- a/arch/um/kernel/ksyms.c > +++ b/arch/um/kernel/ksyms.c > @@ -42,3 +42,6 @@ EXPORT_SYMBOL(os_makedev); > EXPORT_SYMBOL(add_sigio_fd); > EXPORT_SYMBOL(ignore_sigio_fd); > EXPORT_SYMBOL(sigio_broken); > + > +extern long int syscall (long int __sysno, ...); > +EXPORT_SYMBOL(syscall); > -- Chen Gang Open, share, and attitude like air, water, and life which God blessed |
|
From: Guenter R. <li...@ro...> - 2014-10-24 15:55:27
|
On Fri, Oct 24, 2014 at 10:47:03AM +0100, James Hogan wrote: > Hi Guenter, > > On 21/10/14 05:12, Guenter Roeck wrote: > > pm_power_off is defined for all architectures. Move it to common code. > > > > Have all architectures call do_kernel_power_off instead of pm_power_off. > > Some architectures point pm_power_off to machine_power_off. For those, > > call do_kernel_power_off from machine_power_off instead. > > > > Acked-by: David Vrabel <dav...@ci...> > > Acked-by: Geert Uytterhoeven <ge...@li...> > > Acked-by: Hirokazu Takata <ta...@li...> > > Acked-by: Jesper Nilsson <jes...@ax...> > > Acked-by: Max Filippov <jcm...@gm...> > > Acked-by: Rafael J. Wysocki <rj...@rj...> > > Acked-by: Richard Weinberger <ri...@no...> > > Acked-by: Xuetao Guan <gx...@mp...> > > For metag: > Acked-by: James Hogan <jam...@im...> > Thanks! Guenter |
|
From: Eduardo G. <edu...@gm...> - 2014-10-24 11:45:45
|
Please allow me to insert this addendum to my previous question. Sorry if I'm being noisy. >From https://www.kernel.org/doc/Documentation/networking/bonding.txt 8.3. Painfully Slow Or No Failed Link Detection By Miimon --------------------------------------------------------- By default, bonding enables the use_carrier option, which instructs bonding to trust the driver to maintain carrier state. As discussed in the options section, above, some drivers do not support the netif_carrier_on/_off link state tracking system. With use_carrier enabled, bonding will always see these links as up, regardless of their actual state. Additionally, other drivers do support netif_carrier, but do not maintain it in real time, e.g., only polling the link state at some fixed interval. In this case, miimon will detect failures, but only after some long period of time has expired. If it appears that miimon is very slow in detecting link failures, try specifying use_carrier=0 to see if that improves the failure detection time. If it does, then it may be that the driver checks the carrier state at a fixed interval, but does not cache the MII register values (so the use_carrier=0 method of querying the registers directly works). If use_carrier=0 does not improve the failover, then the driver may cache the registers, or the problem may be elsewhere. Also, remember that miimon only checks for the device's carrier state. It has no way to determine the state of devices on or beyond other ports of a switch, or if a switch is refusing to pass traffic while still maintaining carrier on. OK, I thought I should make clear I'm specifying use_carrier=0, same behavior as before. -- Eduardo Grosclaude Universidad Nacional del Comahue Neuquen, Argentina |
|
From: Lennox Wu <len...@gm...> - 2014-10-24 10:03:33
|
Acked-by: Lennox Wu <len...@gm...>
2014-10-21 12:12 GMT+08:00 Guenter Roeck <li...@ro...>:
> pm_power_off is defined for all architectures. Move it to common code.
>
> Have all architectures call do_kernel_power_off instead of pm_power_off.
> Some architectures point pm_power_off to machine_power_off. For those,
> call do_kernel_power_off from machine_power_off instead.
>
> Acked-by: David Vrabel <dav...@ci...>
> Acked-by: Geert Uytterhoeven <ge...@li...>
> Acked-by: Hirokazu Takata <ta...@li...>
> Acked-by: Jesper Nilsson <jes...@ax...>
> Acked-by: Max Filippov <jcm...@gm...>
> Acked-by: Rafael J. Wysocki <rj...@rj...>
> Acked-by: Richard Weinberger <ri...@no...>
> Acked-by: Xuetao Guan <gx...@mp...>
> Signed-off-by: Guenter Roeck <li...@ro...>
> ---
> v2:
> - do_kernel_poweroff -> do_kernel_power_off
> - have_kernel_poweroff -> have_kernel_power_off
>
> arch/alpha/kernel/process.c | 9 +++------
> arch/arc/kernel/reset.c | 5 +----
> arch/arm/kernel/process.c | 5 +----
> arch/arm64/kernel/process.c | 5 +----
> arch/avr32/kernel/process.c | 6 +-----
> arch/blackfin/kernel/process.c | 3 ---
> arch/blackfin/kernel/reboot.c | 2 ++
> arch/c6x/kernel/process.c | 9 +--------
> arch/cris/kernel/process.c | 4 +---
> arch/frv/kernel/process.c | 5 ++---
> arch/hexagon/kernel/reset.c | 5 ++---
> arch/ia64/kernel/process.c | 5 +----
> arch/m32r/kernel/process.c | 8 ++++----
> arch/m68k/kernel/process.c | 6 +-----
> arch/metag/kernel/process.c | 6 +-----
> arch/microblaze/kernel/process.c | 3 ---
> arch/microblaze/kernel/reset.c | 1 +
> arch/mips/kernel/reset.c | 6 +-----
> arch/mn10300/kernel/process.c | 8 ++------
> arch/openrisc/kernel/process.c | 8 +++++---
> arch/parisc/kernel/process.c | 8 ++++----
> arch/powerpc/kernel/setup-common.c | 6 +++---
> arch/s390/kernel/setup.c | 8 ++------
> arch/score/kernel/process.c | 8 ++++----
> arch/sh/kernel/reboot.c | 6 +-----
> arch/sparc/kernel/process_32.c | 10 ++--------
> arch/sparc/kernel/reboot.c | 8 ++------
> arch/tile/kernel/reboot.c | 7 +++----
> arch/um/kernel/reboot.c | 2 --
> arch/unicore32/kernel/process.c | 9 +--------
> arch/x86/kernel/reboot.c | 11 +++--------
> arch/x86/xen/enlighten.c | 3 +--
> arch/xtensa/kernel/process.c | 4 ----
> drivers/parisc/power.c | 3 +--
> kernel/power/poweroff_handler.c | 8 ++++++++
> kernel/reboot.c | 4 ++--
> 36 files changed, 68 insertions(+), 146 deletions(-)
>
> diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
> index 1941a07..81c43f8 100644
> --- a/arch/alpha/kernel/process.c
> +++ b/arch/alpha/kernel/process.c
> @@ -24,6 +24,7 @@
> #include <linux/vt.h>
> #include <linux/mman.h>
> #include <linux/elfcore.h>
> +#include <linux/pm.h>
> #include <linux/reboot.h>
> #include <linux/tty.h>
> #include <linux/console.h>
> @@ -40,12 +41,6 @@
> #include "proto.h"
> #include "pci_impl.h"
>
> -/*
> - * Power off function, if any
> - */
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL(pm_power_off);
> -
> #ifdef CONFIG_ALPHA_WTINT
> /*
> * Sleep the CPU.
> @@ -184,6 +179,8 @@ machine_halt(void)
> void
> machine_power_off(void)
> {
> + do_kernel_power_off();
> +
> common_shutdown(LINUX_REBOOT_CMD_POWER_OFF, NULL);
> }
>
> diff --git a/arch/arc/kernel/reset.c b/arch/arc/kernel/reset.c
> index 2768fa1..0758d9d 100644
> --- a/arch/arc/kernel/reset.c
> +++ b/arch/arc/kernel/reset.c
> @@ -26,9 +26,6 @@ void machine_restart(char *__unused)
>
> void machine_power_off(void)
> {
> - /* FIXME :: power off ??? */
> + do_kernel_power_off();
> machine_halt();
> }
> -
> -void (*pm_power_off) (void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
> index fe972a2..aa3f656 100644
> --- a/arch/arm/kernel/process.c
> +++ b/arch/arm/kernel/process.c
> @@ -117,8 +117,6 @@ void soft_restart(unsigned long addr)
> /*
> * Function pointers to optional machine specific functions
> */
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
>
> void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
>
> @@ -205,8 +203,7 @@ void machine_power_off(void)
> local_irq_disable();
> smp_send_stop();
>
> - if (pm_power_off)
> - pm_power_off();
> + do_kernel_power_off();
> }
>
> /*
> diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
> index c3065db..46a483a 100644
> --- a/arch/arm64/kernel/process.c
> +++ b/arch/arm64/kernel/process.c
> @@ -68,8 +68,6 @@ void soft_restart(unsigned long addr)
> /*
> * Function pointers to optional machine specific functions
> */
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL_GPL(pm_power_off);
>
> void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
>
> @@ -129,8 +127,7 @@ void machine_power_off(void)
> {
> local_irq_disable();
> smp_send_stop();
> - if (pm_power_off)
> - pm_power_off();
> + do_kernel_power_off();
> }
>
> /*
> diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c
> index 42a53e74..529c1f6 100644
> --- a/arch/avr32/kernel/process.c
> +++ b/arch/avr32/kernel/process.c
> @@ -23,9 +23,6 @@
>
> #include <mach/pm.h>
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
> /*
> * This file handles the architecture-dependent parts of process handling..
> */
> @@ -48,8 +45,7 @@ void machine_halt(void)
>
> void machine_power_off(void)
> {
> - if (pm_power_off)
> - pm_power_off();
> + do_kernel_power_off();
> }
>
> void machine_restart(char *cmd)
> diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
> index 4aa5545..812dd83 100644
> --- a/arch/blackfin/kernel/process.c
> +++ b/arch/blackfin/kernel/process.c
> @@ -39,9 +39,6 @@ int nr_l1stack_tasks;
> void *l1_stack_base;
> unsigned long l1_stack_len;
>
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> -
> /*
> * The idle loop on BFIN
> */
> diff --git a/arch/blackfin/kernel/reboot.c b/arch/blackfin/kernel/reboot.c
> index c4f50a3..387d610 100644
> --- a/arch/blackfin/kernel/reboot.c
> +++ b/arch/blackfin/kernel/reboot.c
> @@ -7,6 +7,7 @@
> */
>
> #include <linux/interrupt.h>
> +#include <linux/pm.h>
> #include <asm/bfin-global.h>
> #include <asm/reboot.h>
> #include <asm/bfrom.h>
> @@ -106,6 +107,7 @@ void machine_halt(void)
> __attribute__((weak))
> void native_machine_power_off(void)
> {
> + do_kernel_power_off();
> idle_with_irq_disabled();
> }
>
> diff --git a/arch/c6x/kernel/process.c b/arch/c6x/kernel/process.c
> index 57d2ea8..edf7e5a 100644
> --- a/arch/c6x/kernel/process.c
> +++ b/arch/c6x/kernel/process.c
> @@ -27,12 +27,6 @@ void (*c6x_halt)(void);
> extern asmlinkage void ret_from_fork(void);
> extern asmlinkage void ret_from_kernel_thread(void);
>
> -/*
> - * power off function, if any
> - */
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
> void arch_cpu_idle(void)
> {
> unsigned long tmp;
> @@ -73,8 +67,7 @@ void machine_halt(void)
>
> void machine_power_off(void)
> {
> - if (pm_power_off)
> - pm_power_off();
> + do_kernel_power_off();
> halt_loop();
> }
>
> diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
> index b78498e..9ebd76b 100644
> --- a/arch/cris/kernel/process.c
> +++ b/arch/cris/kernel/process.c
> @@ -31,9 +31,6 @@
>
> extern void default_idle(void);
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
> void arch_cpu_idle(void)
> {
> default_idle();
> @@ -60,6 +57,7 @@ void machine_halt(void)
>
> void machine_power_off(void)
> {
> + do_kernel_power_off();
> }
>
> /*
> diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
> index 5d40aeb77..502dabb 100644
> --- a/arch/frv/kernel/process.c
> +++ b/arch/frv/kernel/process.c
> @@ -42,9 +42,6 @@ asmlinkage void ret_from_kernel_thread(void);
>
> #include <asm/pgalloc.h>
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
> static void core_sleep_idle(void)
> {
> #ifdef LED_DEBUG_SLEEP
> @@ -107,6 +104,8 @@ void machine_power_off(void)
> gdbstub_exit(0);
> #endif
>
> + do_kernel_power_off();
> +
> for (;;);
> }
>
> diff --git a/arch/hexagon/kernel/reset.c b/arch/hexagon/kernel/reset.c
> index 76483c1..6f607b6 100644
> --- a/arch/hexagon/kernel/reset.c
> +++ b/arch/hexagon/kernel/reset.c
> @@ -16,11 +16,13 @@
> * 02110-1301, USA.
> */
>
> +#include <linux/pm.h>
> #include <linux/smp.h>
> #include <asm/hexagon_vm.h>
>
> void machine_power_off(void)
> {
> + do_kernel_power_off();
> smp_send_stop();
> __vmstop();
> }
> @@ -32,6 +34,3 @@ void machine_halt(void)
> void machine_restart(char *cmd)
> {
> }
> -
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
> index b515149..88121a2 100644
> --- a/arch/ia64/kernel/process.c
> +++ b/arch/ia64/kernel/process.c
> @@ -57,8 +57,6 @@ void (*ia64_mark_idle)(int);
>
> unsigned long boot_option_idle_override = IDLE_NO_OVERRIDE;
> EXPORT_SYMBOL(boot_option_idle_override);
> -void (*pm_power_off) (void);
> -EXPORT_SYMBOL(pm_power_off);
>
> void
> ia64_do_show_stack (struct unw_frame_info *info, void *arg)
> @@ -675,8 +673,7 @@ machine_halt (void)
> void
> machine_power_off (void)
> {
> - if (pm_power_off)
> - pm_power_off();
> + do_kernel_power_off();
> machine_halt();
> }
>
> diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c
> index e69221d..65a037e 100644
> --- a/arch/m32r/kernel/process.c
> +++ b/arch/m32r/kernel/process.c
> @@ -23,6 +23,7 @@
> #include <linux/fs.h>
> #include <linux/slab.h>
> #include <linux/module.h>
> +#include <linux/pm.h>
> #include <linux/ptrace.h>
> #include <linux/unistd.h>
> #include <linux/hardirq.h>
> @@ -44,9 +45,6 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
> return tsk->thread.lr;
> }
>
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> -
> void machine_restart(char *__unused)
> {
> #if defined(CONFIG_PLAT_MAPPI3)
> @@ -67,7 +65,9 @@ void machine_halt(void)
>
> void machine_power_off(void)
> {
> - /* M32R_FIXME */
> + do_kernel_power_off();
> + for (;;)
> + ;
> }
>
> void show_regs(struct pt_regs * regs)
> diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
> index afe3d6e..bbc0a63 100644
> --- a/arch/m68k/kernel/process.c
> +++ b/arch/m68k/kernel/process.c
> @@ -78,14 +78,10 @@ void machine_halt(void)
>
> void machine_power_off(void)
> {
> - if (pm_power_off)
> - pm_power_off();
> + do_kernel_power_off();
> for (;;);
> }
>
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL(pm_power_off);
> -
> void show_regs(struct pt_regs * regs)
> {
> printk("\n");
> diff --git a/arch/metag/kernel/process.c b/arch/metag/kernel/process.c
> index 483dff9..8d95773 100644
> --- a/arch/metag/kernel/process.c
> +++ b/arch/metag/kernel/process.c
> @@ -67,9 +67,6 @@ void arch_cpu_idle_dead(void)
> }
> #endif
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
> void (*soc_restart)(char *cmd);
> void (*soc_halt)(void);
>
> @@ -90,8 +87,7 @@ void machine_halt(void)
>
> void machine_power_off(void)
> {
> - if (pm_power_off)
> - pm_power_off();
> + do_kernel_power_off();
> smp_send_stop();
> hard_processor_halt(HALT_OK);
> }
> diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c
> index b2dd371..0ebca36 100644
> --- a/arch/microblaze/kernel/process.c
> +++ b/arch/microblaze/kernel/process.c
> @@ -44,9 +44,6 @@ void show_regs(struct pt_regs *regs)
> regs->msr, regs->ear, regs->esr, regs->fsr);
> }
>
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> -
> void flush_thread(void)
> {
> }
> diff --git a/arch/microblaze/kernel/reset.c b/arch/microblaze/kernel/reset.c
> index fbe58c6..2c6b32c 100644
> --- a/arch/microblaze/kernel/reset.c
> +++ b/arch/microblaze/kernel/reset.c
> @@ -103,6 +103,7 @@ void machine_halt(void)
> void machine_power_off(void)
> {
> pr_notice("Machine power off...\n");
> + do_kernel_power_off();
> while (1)
> ;
> }
> diff --git a/arch/mips/kernel/reset.c b/arch/mips/kernel/reset.c
> index 07fc524..09e74d2 100644
> --- a/arch/mips/kernel/reset.c
> +++ b/arch/mips/kernel/reset.c
> @@ -21,9 +21,6 @@
> */
> void (*_machine_restart)(char *command);
> void (*_machine_halt)(void);
> -void (*pm_power_off)(void);
> -
> -EXPORT_SYMBOL(pm_power_off);
>
> void machine_restart(char *command)
> {
> @@ -39,6 +36,5 @@ void machine_halt(void)
>
> void machine_power_off(void)
> {
> - if (pm_power_off)
> - pm_power_off();
> + do_kernel_power_off();
> }
> diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c
> index 3707da5..c78b2eb 100644
> --- a/arch/mn10300/kernel/process.c
> +++ b/arch/mn10300/kernel/process.c
> @@ -20,6 +20,7 @@
> #include <linux/user.h>
> #include <linux/interrupt.h>
> #include <linux/delay.h>
> +#include <linux/pm.h>
> #include <linux/reboot.h>
> #include <linux/percpu.h>
> #include <linux/err.h>
> @@ -45,12 +46,6 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
> }
>
> /*
> - * power off function, if any
> - */
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
> -/*
> * On SMP it's slightly faster (but much more power-consuming!)
> * to poll the ->work.need_resched flag instead of waiting for the
> * cross-CPU IPI to arrive. Use this option with caution.
> @@ -93,6 +88,7 @@ void machine_power_off(void)
> #ifdef CONFIG_KERNEL_DEBUGGER
> gdbstub_exit(0);
> #endif
> + do_kernel_power_off();
> }
>
> void show_regs(struct pt_regs *regs)
> diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c
> index 386af25..494afd2 100644
> --- a/arch/openrisc/kernel/process.c
> +++ b/arch/openrisc/kernel/process.c
> @@ -25,6 +25,7 @@
> #include <linux/kernel.h>
> #include <linux/module.h>
> #include <linux/mm.h>
> +#include <linux/pm.h>
> #include <linux/stddef.h>
> #include <linux/unistd.h>
> #include <linux/ptrace.h>
> @@ -51,7 +52,7 @@
> */
> struct thread_info *current_thread_info_set[NR_CPUS] = { &init_thread_info, };
>
> -void machine_restart(void)
> +void machine_restart(char *cmd)
> {
> printk(KERN_INFO "*** MACHINE RESTART ***\n");
> __asm__("l.nop 1");
> @@ -72,11 +73,12 @@ void machine_halt(void)
> void machine_power_off(void)
> {
> printk(KERN_INFO "*** MACHINE POWER OFF ***\n");
> +
> + do_kernel_power_off();
> +
> __asm__("l.nop 1");
> }
>
> -void (*pm_power_off) (void) = machine_power_off;
> -
> /*
> * When a process does an "exec", machine state like FPU and debug
> * registers need to be reset. This is a hook function for that.
> diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
> index 0bbbf0d..3f5d14a 100644
> --- a/arch/parisc/kernel/process.c
> +++ b/arch/parisc/kernel/process.c
> @@ -41,6 +41,7 @@
> #include <linux/fs.h>
> #include <linux/module.h>
> #include <linux/personality.h>
> +#include <linux/pm.h>
> #include <linux/ptrace.h>
> #include <linux/sched.h>
> #include <linux/slab.h>
> @@ -133,7 +134,9 @@ void machine_power_off(void)
> pdc_soft_power_button(0);
>
> pdc_chassis_send_status(PDC_CHASSIS_DIRECT_SHUTDOWN);
> -
> +
> + do_kernel_power_off();
> +
> /* It seems we have no way to power the system off via
> * software. The user has to press the button himself. */
>
> @@ -141,9 +144,6 @@ void machine_power_off(void)
> "Please power this system off now.");
> }
>
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL(pm_power_off);
> -
> /*
> * Free current thread data structures etc..
> */
> diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
> index 1362cd6..5b7a851 100644
> --- a/arch/powerpc/kernel/setup-common.c
> +++ b/arch/powerpc/kernel/setup-common.c
> @@ -141,6 +141,9 @@ void machine_power_off(void)
> machine_shutdown();
> if (ppc_md.power_off)
> ppc_md.power_off();
> +
> + do_kernel_power_off();
> +
> #ifdef CONFIG_SMP
> smp_send_stop();
> #endif
> @@ -151,9 +154,6 @@ void machine_power_off(void)
> /* Used by the G5 thermal driver */
> EXPORT_SYMBOL_GPL(machine_power_off);
>
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL_GPL(pm_power_off);
> -
> void machine_halt(void)
> {
> machine_shutdown();
> diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
> index e80d9ff..267e025 100644
> --- a/arch/s390/kernel/setup.c
> +++ b/arch/s390/kernel/setup.c
> @@ -263,13 +263,9 @@ void machine_power_off(void)
> */
> console_unblank();
> _machine_power_off();
> -}
>
> -/*
> - * Dummy power off function.
> - */
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL_GPL(pm_power_off);
> + do_kernel_power_off();
> +}
>
> static int __init early_parse_mem(char *p)
> {
> diff --git a/arch/score/kernel/process.c b/arch/score/kernel/process.c
> index a1519ad3..b76ea67 100644
> --- a/arch/score/kernel/process.c
> +++ b/arch/score/kernel/process.c
> @@ -29,9 +29,6 @@
> #include <linux/pm.h>
> #include <linux/rcupdate.h>
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
> /* If or when software machine-restart is implemented, add code here. */
> void machine_restart(char *command) {}
>
> @@ -39,7 +36,10 @@ void machine_restart(char *command) {}
> void machine_halt(void) {}
>
> /* If or when software machine-power-off is implemented, add code here. */
> -void machine_power_off(void) {}
> +void machine_power_off(void)
> +{
> + do_kernel_power_off();
> +}
>
> void ret_from_fork(void);
> void ret_from_kernel_thread(void);
> diff --git a/arch/sh/kernel/reboot.c b/arch/sh/kernel/reboot.c
> index 04afe5b..065de12 100644
> --- a/arch/sh/kernel/reboot.c
> +++ b/arch/sh/kernel/reboot.c
> @@ -11,9 +11,6 @@
> #include <asm/tlbflush.h>
> #include <asm/traps.h>
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
> #ifdef CONFIG_SUPERH32
> static void watchdog_trigger_immediate(void)
> {
> @@ -51,8 +48,7 @@ static void native_machine_shutdown(void)
>
> static void native_machine_power_off(void)
> {
> - if (pm_power_off)
> - pm_power_off();
> + do_kernel_power_off();
> }
>
> static void native_machine_halt(void)
> diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
> index 50e7b62..cb8148a 100644
> --- a/arch/sparc/kernel/process_32.c
> +++ b/arch/sparc/kernel/process_32.c
> @@ -48,14 +48,6 @@
> */
> void (*sparc_idle)(void);
>
> -/*
> - * Power-off handler instantiation for pm.h compliance
> - * This is done via auxio, but could be used as a fallback
> - * handler when auxio is not present-- unused for now...
> - */
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL(pm_power_off);
> -
> /*
> * sysctl - toggle power-off restriction for serial console
> * systems in machine_power_off()
> @@ -112,6 +104,8 @@ void machine_power_off(void)
> sbus_writeb(power_register, auxio_power_register);
> }
>
> + do_kernel_power_off();
> +
> machine_halt();
> }
>
> diff --git a/arch/sparc/kernel/reboot.c b/arch/sparc/kernel/reboot.c
> index eba7d91..3c0bb03 100644
> --- a/arch/sparc/kernel/reboot.c
> +++ b/arch/sparc/kernel/reboot.c
> @@ -16,17 +16,13 @@
> */
> int scons_pwroff = 1;
>
> -/* This isn't actually used, it exists merely to satisfy the
> - * reference in kernel/sys.c
> - */
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL(pm_power_off);
> -
> void machine_power_off(void)
> {
> if (strcmp(of_console_device->type, "serial") || scons_pwroff)
> prom_halt_power_off();
>
> + do_kernel_power_off();
> +
> prom_halt();
> }
>
> diff --git a/arch/tile/kernel/reboot.c b/arch/tile/kernel/reboot.c
> index 6c5d2c0..8ff4a7f 100644
> --- a/arch/tile/kernel/reboot.c
> +++ b/arch/tile/kernel/reboot.c
> @@ -36,6 +36,9 @@ void machine_power_off(void)
> {
> arch_local_irq_disable_all();
> smp_send_stop();
> +
> + do_kernel_power_off();
> +
> hv_power_off();
> }
>
> @@ -45,7 +48,3 @@ void machine_restart(char *cmd)
> smp_send_stop();
> hv_restart((HV_VirtAddr) "vmlinux", (HV_VirtAddr) cmd);
> }
> -
> -/* No interesting distinction to be made here. */
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c
> index ced8903..a82ef28 100644
> --- a/arch/um/kernel/reboot.c
> +++ b/arch/um/kernel/reboot.c
> @@ -11,8 +11,6 @@
> #include <os.h>
> #include <skas.h>
>
> -void (*pm_power_off)(void);
> -
> static void kill_off_processes(void)
> {
> if (proc_mm)
> diff --git a/arch/unicore32/kernel/process.c b/arch/unicore32/kernel/process.c
> index b008e99..9490dd5 100644
> --- a/arch/unicore32/kernel/process.c
> +++ b/arch/unicore32/kernel/process.c
> @@ -56,16 +56,9 @@ void machine_halt(void)
> gpio_set_value(GPO_SOFT_OFF, 0);
> }
>
> -/*
> - * Function pointers to optional machine specific functions
> - */
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> -
> void machine_power_off(void)
> {
> - if (pm_power_off)
> - pm_power_off();
> + do_kernel_power_off();
> machine_halt();
> }
>
> diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
> index 17962e6..5c09e28 100644
> --- a/arch/x86/kernel/reboot.c
> +++ b/arch/x86/kernel/reboot.c
> @@ -30,12 +30,6 @@
> #include <asm/x86_init.h>
> #include <asm/efi.h>
>
> -/*
> - * Power off function, if any
> - */
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
> static const struct desc_ptr no_idt = {};
>
> /*
> @@ -647,11 +641,12 @@ static void native_machine_halt(void)
>
> static void native_machine_power_off(void)
> {
> - if (pm_power_off) {
> + if (have_kernel_power_off()) {
> if (!reboot_force)
> machine_shutdown();
> - pm_power_off();
> + do_kernel_power_off();
> }
> +
> /* A fallback in case there is no PM info available */
> tboot_shutdown(TB_SHUTDOWN_HALT);
> }
> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
> index 1a3f044..c2c1d74 100644
> --- a/arch/x86/xen/enlighten.c
> +++ b/arch/x86/xen/enlighten.c
> @@ -1320,8 +1320,7 @@ static void xen_machine_halt(void)
>
> static void xen_machine_power_off(void)
> {
> - if (pm_power_off)
> - pm_power_off();
> + do_kernel_power_off();
> xen_reboot(SHUTDOWN_poweroff);
> }
>
> diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
> index 1c85323..c487296 100644
> --- a/arch/xtensa/kernel/process.c
> +++ b/arch/xtensa/kernel/process.c
> @@ -49,10 +49,6 @@ extern void ret_from_kernel_thread(void);
>
> struct task_struct *current_set[NR_CPUS] = {&init_task, };
>
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> -
> -
> #if XTENSA_HAVE_COPROCESSORS
>
> void coprocessor_release_all(struct thread_info *ti)
> diff --git a/drivers/parisc/power.c b/drivers/parisc/power.c
> index ef31b77..f10cf92 100644
> --- a/drivers/parisc/power.c
> +++ b/drivers/parisc/power.c
> @@ -95,8 +95,7 @@ static void process_shutdown(void)
> /* send kill signal */
> if (kill_cad_pid(SIGINT, 1)) {
> /* just in case killing init process failed */
> - if (pm_power_off)
> - pm_power_off();
> + kernel_power_off();
> }
> }
> }
> diff --git a/kernel/power/poweroff_handler.c b/kernel/power/poweroff_handler.c
> index aeb4736..37f0b88 100644
> --- a/kernel/power/poweroff_handler.c
> +++ b/kernel/power/poweroff_handler.c
> @@ -22,6 +22,12 @@
> #include <linux/types.h>
>
> /*
> + * If set, calling this function will power off the system immediately.
> + */
> +void (*pm_power_off)(void);
> +EXPORT_SYMBOL(pm_power_off);
> +
> +/*
> * Notifier list for kernel code which wants to be called
> * to power off the system.
> */
> @@ -236,6 +242,8 @@ EXPORT_SYMBOL(devm_register_power_off_handler);
> void do_kernel_power_off(void)
> {
> spin_lock(&power_off_handler_lock);
> + if (pm_power_off)
> + pm_power_off();
> raw_notifier_call_chain(&power_off_handler_list, 0, NULL);
> spin_unlock(&power_off_handler_lock);
> }
> diff --git a/kernel/reboot.c b/kernel/reboot.c
> index 5925f5a..0930851 100644
> --- a/kernel/reboot.c
> +++ b/kernel/reboot.c
> @@ -306,9 +306,9 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
> return ret;
>
> /* Instead of trying to make the power_off code look like
> - * halt when pm_power_off is not set do it the easy way.
> + * halt when no poweroff handler exists do it the easy way.
> */
> - if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)
> + if (cmd == LINUX_REBOOT_CMD_POWER_OFF && !have_kernel_power_off())
> cmd = LINUX_REBOOT_CMD_HALT;
>
> mutex_lock(&reboot_mutex);
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to maj...@vg...
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
|
|
From: Lennox Wu <len...@gm...> - 2014-10-24 10:02:19
|
Acked-by: Lennox Wu <len...@gm...>
2014-10-21 12:12 GMT+08:00 Guenter Roeck <li...@ro...>:
> pm_power_off is defined for all architectures. Move it to common code.
>
> Have all architectures call do_kernel_power_off instead of pm_power_off.
> Some architectures point pm_power_off to machine_power_off. For those,
> call do_kernel_power_off from machine_power_off instead.
>
> Acked-by: David Vrabel <dav...@ci...>
> Acked-by: Geert Uytterhoeven <ge...@li...>
> Acked-by: Hirokazu Takata <ta...@li...>
> Acked-by: Jesper Nilsson <jes...@ax...>
> Acked-by: Max Filippov <jcm...@gm...>
> Acked-by: Rafael J. Wysocki <rj...@rj...>
> Acked-by: Richard Weinberger <ri...@no...>
> Acked-by: Xuetao Guan <gx...@mp...>
> Signed-off-by: Guenter Roeck <li...@ro...>
> ---
> v2:
> - do_kernel_poweroff -> do_kernel_power_off
> - have_kernel_poweroff -> have_kernel_power_off
>
> arch/alpha/kernel/process.c | 9 +++------
> arch/arc/kernel/reset.c | 5 +----
> arch/arm/kernel/process.c | 5 +----
> arch/arm64/kernel/process.c | 5 +----
> arch/avr32/kernel/process.c | 6 +-----
> arch/blackfin/kernel/process.c | 3 ---
> arch/blackfin/kernel/reboot.c | 2 ++
> arch/c6x/kernel/process.c | 9 +--------
> arch/cris/kernel/process.c | 4 +---
> arch/frv/kernel/process.c | 5 ++---
> arch/hexagon/kernel/reset.c | 5 ++---
> arch/ia64/kernel/process.c | 5 +----
> arch/m32r/kernel/process.c | 8 ++++----
> arch/m68k/kernel/process.c | 6 +-----
> arch/metag/kernel/process.c | 6 +-----
> arch/microblaze/kernel/process.c | 3 ---
> arch/microblaze/kernel/reset.c | 1 +
> arch/mips/kernel/reset.c | 6 +-----
> arch/mn10300/kernel/process.c | 8 ++------
> arch/openrisc/kernel/process.c | 8 +++++---
> arch/parisc/kernel/process.c | 8 ++++----
> arch/powerpc/kernel/setup-common.c | 6 +++---
> arch/s390/kernel/setup.c | 8 ++------
> arch/score/kernel/process.c | 8 ++++----
> arch/sh/kernel/reboot.c | 6 +-----
> arch/sparc/kernel/process_32.c | 10 ++--------
> arch/sparc/kernel/reboot.c | 8 ++------
> arch/tile/kernel/reboot.c | 7 +++----
> arch/um/kernel/reboot.c | 2 --
> arch/unicore32/kernel/process.c | 9 +--------
> arch/x86/kernel/reboot.c | 11 +++--------
> arch/x86/xen/enlighten.c | 3 +--
> arch/xtensa/kernel/process.c | 4 ----
> drivers/parisc/power.c | 3 +--
> kernel/power/poweroff_handler.c | 8 ++++++++
> kernel/reboot.c | 4 ++--
> 36 files changed, 68 insertions(+), 146 deletions(-)
>
> diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
> index 1941a07..81c43f8 100644
> --- a/arch/alpha/kernel/process.c
> +++ b/arch/alpha/kernel/process.c
> @@ -24,6 +24,7 @@
> #include <linux/vt.h>
> #include <linux/mman.h>
> #include <linux/elfcore.h>
> +#include <linux/pm.h>
> #include <linux/reboot.h>
> #include <linux/tty.h>
> #include <linux/console.h>
> @@ -40,12 +41,6 @@
> #include "proto.h"
> #include "pci_impl.h"
>
> -/*
> - * Power off function, if any
> - */
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL(pm_power_off);
> -
> #ifdef CONFIG_ALPHA_WTINT
> /*
> * Sleep the CPU.
> @@ -184,6 +179,8 @@ machine_halt(void)
> void
> machine_power_off(void)
> {
> + do_kernel_power_off();
> +
> common_shutdown(LINUX_REBOOT_CMD_POWER_OFF, NULL);
> }
>
> diff --git a/arch/arc/kernel/reset.c b/arch/arc/kernel/reset.c
> index 2768fa1..0758d9d 100644
> --- a/arch/arc/kernel/reset.c
> +++ b/arch/arc/kernel/reset.c
> @@ -26,9 +26,6 @@ void machine_restart(char *__unused)
>
> void machine_power_off(void)
> {
> - /* FIXME :: power off ??? */
> + do_kernel_power_off();
> machine_halt();
> }
> -
> -void (*pm_power_off) (void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
> index fe972a2..aa3f656 100644
> --- a/arch/arm/kernel/process.c
> +++ b/arch/arm/kernel/process.c
> @@ -117,8 +117,6 @@ void soft_restart(unsigned long addr)
> /*
> * Function pointers to optional machine specific functions
> */
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
>
> void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
>
> @@ -205,8 +203,7 @@ void machine_power_off(void)
> local_irq_disable();
> smp_send_stop();
>
> - if (pm_power_off)
> - pm_power_off();
> + do_kernel_power_off();
> }
>
> /*
> diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
> index c3065db..46a483a 100644
> --- a/arch/arm64/kernel/process.c
> +++ b/arch/arm64/kernel/process.c
> @@ -68,8 +68,6 @@ void soft_restart(unsigned long addr)
> /*
> * Function pointers to optional machine specific functions
> */
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL_GPL(pm_power_off);
>
> void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
>
> @@ -129,8 +127,7 @@ void machine_power_off(void)
> {
> local_irq_disable();
> smp_send_stop();
> - if (pm_power_off)
> - pm_power_off();
> + do_kernel_power_off();
> }
>
> /*
> diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c
> index 42a53e74..529c1f6 100644
> --- a/arch/avr32/kernel/process.c
> +++ b/arch/avr32/kernel/process.c
> @@ -23,9 +23,6 @@
>
> #include <mach/pm.h>
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
> /*
> * This file handles the architecture-dependent parts of process
> handling..
> */
> @@ -48,8 +45,7 @@ void machine_halt(void)
>
> void machine_power_off(void)
> {
> - if (pm_power_off)
> - pm_power_off();
> + do_kernel_power_off();
> }
>
> void machine_restart(char *cmd)
> diff --git a/arch/blackfin/kernel/process.c
> b/arch/blackfin/kernel/process.c
> index 4aa5545..812dd83 100644
> --- a/arch/blackfin/kernel/process.c
> +++ b/arch/blackfin/kernel/process.c
> @@ -39,9 +39,6 @@ int nr_l1stack_tasks;
> void *l1_stack_base;
> unsigned long l1_stack_len;
>
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> -
> /*
> * The idle loop on BFIN
> */
> diff --git a/arch/blackfin/kernel/reboot.c b/arch/blackfin/kernel/reboot.c
> index c4f50a3..387d610 100644
> --- a/arch/blackfin/kernel/reboot.c
> +++ b/arch/blackfin/kernel/reboot.c
> @@ -7,6 +7,7 @@
> */
>
> #include <linux/interrupt.h>
> +#include <linux/pm.h>
> #include <asm/bfin-global.h>
> #include <asm/reboot.h>
> #include <asm/bfrom.h>
> @@ -106,6 +107,7 @@ void machine_halt(void)
> __attribute__((weak))
> void native_machine_power_off(void)
> {
> + do_kernel_power_off();
> idle_with_irq_disabled();
> }
>
> diff --git a/arch/c6x/kernel/process.c b/arch/c6x/kernel/process.c
> index 57d2ea8..edf7e5a 100644
> --- a/arch/c6x/kernel/process.c
> +++ b/arch/c6x/kernel/process.c
> @@ -27,12 +27,6 @@ void (*c6x_halt)(void);
> extern asmlinkage void ret_from_fork(void);
> extern asmlinkage void ret_from_kernel_thread(void);
>
> -/*
> - * power off function, if any
> - */
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
> void arch_cpu_idle(void)
> {
> unsigned long tmp;
> @@ -73,8 +67,7 @@ void machine_halt(void)
>
> void machine_power_off(void)
> {
> - if (pm_power_off)
> - pm_power_off();
> + do_kernel_power_off();
> halt_loop();
> }
>
> diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
> index b78498e..9ebd76b 100644
> --- a/arch/cris/kernel/process.c
> +++ b/arch/cris/kernel/process.c
> @@ -31,9 +31,6 @@
>
> extern void default_idle(void);
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
> void arch_cpu_idle(void)
> {
> default_idle();
> @@ -60,6 +57,7 @@ void machine_halt(void)
>
> void machine_power_off(void)
> {
> + do_kernel_power_off();
> }
>
> /*
> diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
> index 5d40aeb77..502dabb 100644
> --- a/arch/frv/kernel/process.c
> +++ b/arch/frv/kernel/process.c
> @@ -42,9 +42,6 @@ asmlinkage void ret_from_kernel_thread(void);
>
> #include <asm/pgalloc.h>
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
> static void core_sleep_idle(void)
> {
> #ifdef LED_DEBUG_SLEEP
> @@ -107,6 +104,8 @@ void machine_power_off(void)
> gdbstub_exit(0);
> #endif
>
> + do_kernel_power_off();
> +
> for (;;);
> }
>
> diff --git a/arch/hexagon/kernel/reset.c b/arch/hexagon/kernel/reset.c
> index 76483c1..6f607b6 100644
> --- a/arch/hexagon/kernel/reset.c
> +++ b/arch/hexagon/kernel/reset.c
> @@ -16,11 +16,13 @@
> * 02110-1301, USA.
> */
>
> +#include <linux/pm.h>
> #include <linux/smp.h>
> #include <asm/hexagon_vm.h>
>
> void machine_power_off(void)
> {
> + do_kernel_power_off();
> smp_send_stop();
> __vmstop();
> }
> @@ -32,6 +34,3 @@ void machine_halt(void)
> void machine_restart(char *cmd)
> {
> }
> -
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
> index b515149..88121a2 100644
> --- a/arch/ia64/kernel/process.c
> +++ b/arch/ia64/kernel/process.c
> @@ -57,8 +57,6 @@ void (*ia64_mark_idle)(int);
>
> unsigned long boot_option_idle_override = IDLE_NO_OVERRIDE;
> EXPORT_SYMBOL(boot_option_idle_override);
> -void (*pm_power_off) (void);
> -EXPORT_SYMBOL(pm_power_off);
>
> void
> ia64_do_show_stack (struct unw_frame_info *info, void *arg)
> @@ -675,8 +673,7 @@ machine_halt (void)
> void
> machine_power_off (void)
> {
> - if (pm_power_off)
> - pm_power_off();
> + do_kernel_power_off();
> machine_halt();
> }
>
> diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c
> index e69221d..65a037e 100644
> --- a/arch/m32r/kernel/process.c
> +++ b/arch/m32r/kernel/process.c
> @@ -23,6 +23,7 @@
> #include <linux/fs.h>
> #include <linux/slab.h>
> #include <linux/module.h>
> +#include <linux/pm.h>
> #include <linux/ptrace.h>
> #include <linux/unistd.h>
> #include <linux/hardirq.h>
> @@ -44,9 +45,6 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
> return tsk->thread.lr;
> }
>
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> -
> void machine_restart(char *__unused)
> {
> #if defined(CONFIG_PLAT_MAPPI3)
> @@ -67,7 +65,9 @@ void machine_halt(void)
>
> void machine_power_off(void)
> {
> - /* M32R_FIXME */
> + do_kernel_power_off();
> + for (;;)
> + ;
> }
>
> void show_regs(struct pt_regs * regs)
> diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
> index afe3d6e..bbc0a63 100644
> --- a/arch/m68k/kernel/process.c
> +++ b/arch/m68k/kernel/process.c
> @@ -78,14 +78,10 @@ void machine_halt(void)
>
> void machine_power_off(void)
> {
> - if (pm_power_off)
> - pm_power_off();
> + do_kernel_power_off();
> for (;;);
> }
>
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL(pm_power_off);
> -
> void show_regs(struct pt_regs * regs)
> {
> printk("\n");
> diff --git a/arch/metag/kernel/process.c b/arch/metag/kernel/process.c
> index 483dff9..8d95773 100644
> --- a/arch/metag/kernel/process.c
> +++ b/arch/metag/kernel/process.c
> @@ -67,9 +67,6 @@ void arch_cpu_idle_dead(void)
> }
> #endif
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
> void (*soc_restart)(char *cmd);
> void (*soc_halt)(void);
>
> @@ -90,8 +87,7 @@ void machine_halt(void)
>
> void machine_power_off(void)
> {
> - if (pm_power_off)
> - pm_power_off();
> + do_kernel_power_off();
> smp_send_stop();
> hard_processor_halt(HALT_OK);
> }
> diff --git a/arch/microblaze/kernel/process.c
> b/arch/microblaze/kernel/process.c
> index b2dd371..0ebca36 100644
> --- a/arch/microblaze/kernel/process.c
> +++ b/arch/microblaze/kernel/process.c
> @@ -44,9 +44,6 @@ void show_regs(struct pt_regs *regs)
> regs->msr, regs->ear, regs->esr,
> regs->fsr);
> }
>
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> -
> void flush_thread(void)
> {
> }
> diff --git a/arch/microblaze/kernel/reset.c
> b/arch/microblaze/kernel/reset.c
> index fbe58c6..2c6b32c 100644
> --- a/arch/microblaze/kernel/reset.c
> +++ b/arch/microblaze/kernel/reset.c
> @@ -103,6 +103,7 @@ void machine_halt(void)
> void machine_power_off(void)
> {
> pr_notice("Machine power off...\n");
> + do_kernel_power_off();
> while (1)
> ;
> }
> diff --git a/arch/mips/kernel/reset.c b/arch/mips/kernel/reset.c
> index 07fc524..09e74d2 100644
> --- a/arch/mips/kernel/reset.c
> +++ b/arch/mips/kernel/reset.c
> @@ -21,9 +21,6 @@
> */
> void (*_machine_restart)(char *command);
> void (*_machine_halt)(void);
> -void (*pm_power_off)(void);
> -
> -EXPORT_SYMBOL(pm_power_off);
>
> void machine_restart(char *command)
> {
> @@ -39,6 +36,5 @@ void machine_halt(void)
>
> void machine_power_off(void)
> {
> - if (pm_power_off)
> - pm_power_off();
> + do_kernel_power_off();
> }
> diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c
> index 3707da5..c78b2eb 100644
> --- a/arch/mn10300/kernel/process.c
> +++ b/arch/mn10300/kernel/process.c
> @@ -20,6 +20,7 @@
> #include <linux/user.h>
> #include <linux/interrupt.h>
> #include <linux/delay.h>
> +#include <linux/pm.h>
> #include <linux/reboot.h>
> #include <linux/percpu.h>
> #include <linux/err.h>
> @@ -45,12 +46,6 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
> }
>
> /*
> - * power off function, if any
> - */
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
> -/*
> * On SMP it's slightly faster (but much more power-consuming!)
> * to poll the ->work.need_resched flag instead of waiting for the
> * cross-CPU IPI to arrive. Use this option with caution.
> @@ -93,6 +88,7 @@ void machine_power_off(void)
> #ifdef CONFIG_KERNEL_DEBUGGER
> gdbstub_exit(0);
> #endif
> + do_kernel_power_off();
> }
>
> void show_regs(struct pt_regs *regs)
> diff --git a/arch/openrisc/kernel/process.c
> b/arch/openrisc/kernel/process.c
> index 386af25..494afd2 100644
> --- a/arch/openrisc/kernel/process.c
> +++ b/arch/openrisc/kernel/process.c
> @@ -25,6 +25,7 @@
> #include <linux/kernel.h>
> #include <linux/module.h>
> #include <linux/mm.h>
> +#include <linux/pm.h>
> #include <linux/stddef.h>
> #include <linux/unistd.h>
> #include <linux/ptrace.h>
> @@ -51,7 +52,7 @@
> */
> struct thread_info *current_thread_info_set[NR_CPUS] = {
> &init_thread_info, };
>
> -void machine_restart(void)
> +void machine_restart(char *cmd)
> {
> printk(KERN_INFO "*** MACHINE RESTART ***\n");
> __asm__("l.nop 1");
> @@ -72,11 +73,12 @@ void machine_halt(void)
> void machine_power_off(void)
> {
> printk(KERN_INFO "*** MACHINE POWER OFF ***\n");
> +
> + do_kernel_power_off();
> +
> __asm__("l.nop 1");
> }
>
> -void (*pm_power_off) (void) = machine_power_off;
> -
> /*
> * When a process does an "exec", machine state like FPU and debug
> * registers need to be reset. This is a hook function for that.
> diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
> index 0bbbf0d..3f5d14a 100644
> --- a/arch/parisc/kernel/process.c
> +++ b/arch/parisc/kernel/process.c
> @@ -41,6 +41,7 @@
> #include <linux/fs.h>
> #include <linux/module.h>
> #include <linux/personality.h>
> +#include <linux/pm.h>
> #include <linux/ptrace.h>
> #include <linux/sched.h>
> #include <linux/slab.h>
> @@ -133,7 +134,9 @@ void machine_power_off(void)
> pdc_soft_power_button(0);
>
> pdc_chassis_send_status(PDC_CHASSIS_DIRECT_SHUTDOWN);
> -
> +
> + do_kernel_power_off();
> +
> /* It seems we have no way to power the system off via
> * software. The user has to press the button himself. */
>
> @@ -141,9 +144,6 @@ void machine_power_off(void)
> "Please power this system off now.");
> }
>
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL(pm_power_off);
> -
> /*
> * Free current thread data structures etc..
> */
> diff --git a/arch/powerpc/kernel/setup-common.c
> b/arch/powerpc/kernel/setup-common.c
> index 1362cd6..5b7a851 100644
> --- a/arch/powerpc/kernel/setup-common.c
> +++ b/arch/powerpc/kernel/setup-common.c
> @@ -141,6 +141,9 @@ void machine_power_off(void)
> machine_shutdown();
> if (ppc_md.power_off)
> ppc_md.power_off();
> +
> + do_kernel_power_off();
> +
> #ifdef CONFIG_SMP
> smp_send_stop();
> #endif
> @@ -151,9 +154,6 @@ void machine_power_off(void)
> /* Used by the G5 thermal driver */
> EXPORT_SYMBOL_GPL(machine_power_off);
>
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL_GPL(pm_power_off);
> -
> void machine_halt(void)
> {
> machine_shutdown();
> diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
> index e80d9ff..267e025 100644
> --- a/arch/s390/kernel/setup.c
> +++ b/arch/s390/kernel/setup.c
> @@ -263,13 +263,9 @@ void machine_power_off(void)
> */
> console_unblank();
> _machine_power_off();
> -}
>
> -/*
> - * Dummy power off function.
> - */
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL_GPL(pm_power_off);
> + do_kernel_power_off();
> +}
>
> static int __init early_parse_mem(char *p)
> {
> diff --git a/arch/score/kernel/process.c b/arch/score/kernel/process.c
> index a1519ad3..b76ea67 100644
> --- a/arch/score/kernel/process.c
> +++ b/arch/score/kernel/process.c
> @@ -29,9 +29,6 @@
> #include <linux/pm.h>
> #include <linux/rcupdate.h>
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
> /* If or when software machine-restart is implemented, add code here. */
> void machine_restart(char *command) {}
>
> @@ -39,7 +36,10 @@ void machine_restart(char *command) {}
> void machine_halt(void) {}
>
> /* If or when software machine-power-off is implemented, add code here. */
> -void machine_power_off(void) {}
> +void machine_power_off(void)
> +{
> + do_kernel_power_off();
> +}
>
> void ret_from_fork(void);
> void ret_from_kernel_thread(void);
> diff --git a/arch/sh/kernel/reboot.c b/arch/sh/kernel/reboot.c
> index 04afe5b..065de12 100644
> --- a/arch/sh/kernel/reboot.c
> +++ b/arch/sh/kernel/reboot.c
> @@ -11,9 +11,6 @@
> #include <asm/tlbflush.h>
> #include <asm/traps.h>
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
> #ifdef CONFIG_SUPERH32
> static void watchdog_trigger_immediate(void)
> {
> @@ -51,8 +48,7 @@ static void native_machine_shutdown(void)
>
> static void native_machine_power_off(void)
> {
> - if (pm_power_off)
> - pm_power_off();
> + do_kernel_power_off();
> }
>
> static void native_machine_halt(void)
> diff --git a/arch/sparc/kernel/process_32.c
> b/arch/sparc/kernel/process_32.c
> index 50e7b62..cb8148a 100644
> --- a/arch/sparc/kernel/process_32.c
> +++ b/arch/sparc/kernel/process_32.c
> @@ -48,14 +48,6 @@
> */
> void (*sparc_idle)(void);
>
> -/*
> - * Power-off handler instantiation for pm.h compliance
> - * This is done via auxio, but could be used as a fallback
> - * handler when auxio is not present-- unused for now...
> - */
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL(pm_power_off);
> -
> /*
> * sysctl - toggle power-off restriction for serial console
> * systems in machine_power_off()
> @@ -112,6 +104,8 @@ void machine_power_off(void)
> sbus_writeb(power_register, auxio_power_register);
> }
>
> + do_kernel_power_off();
> +
> machine_halt();
> }
>
> diff --git a/arch/sparc/kernel/reboot.c b/arch/sparc/kernel/reboot.c
> index eba7d91..3c0bb03 100644
> --- a/arch/sparc/kernel/reboot.c
> +++ b/arch/sparc/kernel/reboot.c
> @@ -16,17 +16,13 @@
> */
> int scons_pwroff = 1;
>
> -/* This isn't actually used, it exists merely to satisfy the
> - * reference in kernel/sys.c
> - */
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL(pm_power_off);
> -
> void machine_power_off(void)
> {
> if (strcmp(of_console_device->type, "serial") || scons_pwroff)
> prom_halt_power_off();
>
> + do_kernel_power_off();
> +
> prom_halt();
> }
>
> diff --git a/arch/tile/kernel/reboot.c b/arch/tile/kernel/reboot.c
> index 6c5d2c0..8ff4a7f 100644
> --- a/arch/tile/kernel/reboot.c
> +++ b/arch/tile/kernel/reboot.c
> @@ -36,6 +36,9 @@ void machine_power_off(void)
> {
> arch_local_irq_disable_all();
> smp_send_stop();
> +
> + do_kernel_power_off();
> +
> hv_power_off();
> }
>
> @@ -45,7 +48,3 @@ void machine_restart(char *cmd)
> smp_send_stop();
> hv_restart((HV_VirtAddr) "vmlinux", (HV_VirtAddr) cmd);
> }
> -
> -/* No interesting distinction to be made here. */
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c
> index ced8903..a82ef28 100644
> --- a/arch/um/kernel/reboot.c
> +++ b/arch/um/kernel/reboot.c
> @@ -11,8 +11,6 @@
> #include <os.h>
> #include <skas.h>
>
> -void (*pm_power_off)(void);
> -
> static void kill_off_processes(void)
> {
> if (proc_mm)
> diff --git a/arch/unicore32/kernel/process.c
> b/arch/unicore32/kernel/process.c
> index b008e99..9490dd5 100644
> --- a/arch/unicore32/kernel/process.c
> +++ b/arch/unicore32/kernel/process.c
> @@ -56,16 +56,9 @@ void machine_halt(void)
> gpio_set_value(GPO_SOFT_OFF, 0);
> }
>
> -/*
> - * Function pointers to optional machine specific functions
> - */
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> -
> void machine_power_off(void)
> {
> - if (pm_power_off)
> - pm_power_off();
> + do_kernel_power_off();
> machine_halt();
> }
>
> diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
> index 17962e6..5c09e28 100644
> --- a/arch/x86/kernel/reboot.c
> +++ b/arch/x86/kernel/reboot.c
> @@ -30,12 +30,6 @@
> #include <asm/x86_init.h>
> #include <asm/efi.h>
>
> -/*
> - * Power off function, if any
> - */
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
> static const struct desc_ptr no_idt = {};
>
> /*
> @@ -647,11 +641,12 @@ static void native_machine_halt(void)
>
> static void native_machine_power_off(void)
> {
> - if (pm_power_off) {
> + if (have_kernel_power_off()) {
> if (!reboot_force)
> machine_shutdown();
> - pm_power_off();
> + do_kernel_power_off();
> }
> +
> /* A fallback in case there is no PM info available */
> tboot_shutdown(TB_SHUTDOWN_HALT);
> }
> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
> index 1a3f044..c2c1d74 100644
> --- a/arch/x86/xen/enlighten.c
> +++ b/arch/x86/xen/enlighten.c
> @@ -1320,8 +1320,7 @@ static void xen_machine_halt(void)
>
> static void xen_machine_power_off(void)
> {
> - if (pm_power_off)
> - pm_power_off();
> + do_kernel_power_off();
> xen_reboot(SHUTDOWN_poweroff);
> }
>
> diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
> index 1c85323..c487296 100644
> --- a/arch/xtensa/kernel/process.c
> +++ b/arch/xtensa/kernel/process.c
> @@ -49,10 +49,6 @@ extern void ret_from_kernel_thread(void);
>
> struct task_struct *current_set[NR_CPUS] = {&init_task, };
>
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> -
> -
> #if XTENSA_HAVE_COPROCESSORS
>
> void coprocessor_release_all(struct thread_info *ti)
> diff --git a/drivers/parisc/power.c b/drivers/parisc/power.c
> index ef31b77..f10cf92 100644
> --- a/drivers/parisc/power.c
> +++ b/drivers/parisc/power.c
> @@ -95,8 +95,7 @@ static void process_shutdown(void)
> /* send kill signal */
> if (kill_cad_pid(SIGINT, 1)) {
> /* just in case killing init process failed */
> - if (pm_power_off)
> - pm_power_off();
> + kernel_power_off();
> }
> }
> }
> diff --git a/kernel/power/poweroff_handler.c
> b/kernel/power/poweroff_handler.c
> index aeb4736..37f0b88 100644
> --- a/kernel/power/poweroff_handler.c
> +++ b/kernel/power/poweroff_handler.c
> @@ -22,6 +22,12 @@
> #include <linux/types.h>
>
> /*
> + * If set, calling this function will power off the system immediately.
> + */
> +void (*pm_power_off)(void);
> +EXPORT_SYMBOL(pm_power_off);
> +
> +/*
> * Notifier list for kernel code which wants to be called
> * to power off the system.
> */
> @@ -236,6 +242,8 @@ EXPORT_SYMBOL(devm_register_power_off_handler);
> void do_kernel_power_off(void)
> {
> spin_lock(&power_off_handler_lock);
> + if (pm_power_off)
> + pm_power_off();
> raw_notifier_call_chain(&power_off_handler_list, 0, NULL);
> spin_unlock(&power_off_handler_lock);
> }
> diff --git a/kernel/reboot.c b/kernel/reboot.c
> index 5925f5a..0930851 100644
> --- a/kernel/reboot.c
> +++ b/kernel/reboot.c
> @@ -306,9 +306,9 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2,
> unsigned int, cmd,
> return ret;
>
> /* Instead of trying to make the power_off code look like
> - * halt when pm_power_off is not set do it the easy way.
> + * halt when no poweroff handler exists do it the easy way.
> */
> - if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)
> + if (cmd == LINUX_REBOOT_CMD_POWER_OFF && !have_kernel_power_off())
> cmd = LINUX_REBOOT_CMD_HALT;
>
> mutex_lock(&reboot_mutex);
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to maj...@vg...
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
|
|
From: James H. <jam...@im...> - 2014-10-24 09:47:13
|
Hi Guenter,
On 21/10/14 05:12, Guenter Roeck wrote:
> pm_power_off is defined for all architectures. Move it to common code.
>
> Have all architectures call do_kernel_power_off instead of pm_power_off.
> Some architectures point pm_power_off to machine_power_off. For those,
> call do_kernel_power_off from machine_power_off instead.
>
> Acked-by: David Vrabel <dav...@ci...>
> Acked-by: Geert Uytterhoeven <ge...@li...>
> Acked-by: Hirokazu Takata <ta...@li...>
> Acked-by: Jesper Nilsson <jes...@ax...>
> Acked-by: Max Filippov <jcm...@gm...>
> Acked-by: Rafael J. Wysocki <rj...@rj...>
> Acked-by: Richard Weinberger <ri...@no...>
> Acked-by: Xuetao Guan <gx...@mp...>
For metag:
Acked-by: James Hogan <jam...@im...>
Thanks
James
> diff --git a/arch/metag/kernel/process.c b/arch/metag/kernel/process.c
> index 483dff9..8d95773 100644
> --- a/arch/metag/kernel/process.c
> +++ b/arch/metag/kernel/process.c
> @@ -67,9 +67,6 @@ void arch_cpu_idle_dead(void)
> }
> #endif
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
> void (*soc_restart)(char *cmd);
> void (*soc_halt)(void);
>
> @@ -90,8 +87,7 @@ void machine_halt(void)
>
> void machine_power_off(void)
> {
> - if (pm_power_off)
> - pm_power_off();
> + do_kernel_power_off();
> smp_send_stop();
> hard_processor_halt(HALT_OK);
> }
|
|
From: Eduardo G. <edu...@gm...> - 2014-10-24 02:28:43
|
Hello people here, I have joined the list only to ask this question, please bear with me. :) I made myself sure to read JD's book but can't find any deeper technical advice regarding this question there. Short version: How do you simulate a network failure in UML? Long version: I'm a CS teacher trying to setup a very simple Netkit lab to show off Ethernet bonding in action. As you certainly know, Netkit is based on UML. I can't seem to figure out how to properly go about failure injection in an active-backup (mode 1) bond interface. More generally, what's the proper way to simulate a link drop in UML (so as to - for instance - cause a bond failover)? My virtual lab is built with three UML nodes, called A, B and S. S has four Ethernet interfaces enslaved into a bridge (to simulate a switch). Node A has two NICs, Node B has only one. B is there only to ping node A. A's eth0 and eth1 are linked by separate collision domains (default for Netkit) to eth0 and eth1 of the virtual switch. B goes to another switch interface. Both A's eth0 and eth1 are bonded into bond0, and eth0 is normally the active one. Ping works. If the link between A and S fails, I should see the backup link take over. I assume I could take down the S's NIC, A's NIC, or the link proper. However, no "ifconfig down" command does the job, nor do I know how to take down the virtual link. As a teacher showing off HA, I'd prefer some sort of external, asynchronic, mysterious event to come into scene by will of Fate, but I'll be glad if I can just go and pull out the fine cable and see the primary and secondary swap roles. Now, bonding can do fault detect using ARP broadcasts or MII signaling. When using MII my bonds do always believe all is OK, no matter what. I have to keep using failure detection by ARP instead of MII because of this. To break the virtual link I resorted to kill -STOP the uml_switch process who implements the link. That triggers the bond failover by absence of ARP responses, but then the bond flaps its active between eth0 vs eth1 eternally as if MII keeps contradicting ARP's information. Other signals behave alike, but STOP/CONT can (sometimes) bring the link back as if the failure has been corrected, which holds a value for my lesson. So, in this synthetic setup, what should I do to simulate a network failure? Can I make MII detection to work? What mistake am I making? Thank you very much in advance! -- Eduardo Grosclaude Universidad Nacional del Comahue Neuquen, Argentina |
|
From: Guenter R. <li...@ro...> - 2014-10-22 15:46:05
|
On Wed, Oct 22, 2014 at 05:31:36PM +0200, Ralf Baechle wrote: > On Mon, Oct 20, 2014 at 09:12:24PM -0700, Guenter Roeck wrote: > > > pm_power_off is defined for all architectures. Move it to common code. > > > > Have all architectures call do_kernel_power_off instead of pm_power_off. > > Some architectures point pm_power_off to machine_power_off. For those, > > call do_kernel_power_off from machine_power_off instead. > > > > Acked-by: David Vrabel <dav...@ci...> > > Acked-by: Geert Uytterhoeven <ge...@li...> > > Acked-by: Hirokazu Takata <ta...@li...> > > Acked-by: Jesper Nilsson <jes...@ax...> > > Acked-by: Max Filippov <jcm...@gm...> > > Acked-by: Rafael J. Wysocki <rj...@rj...> > > Acked-by: Richard Weinberger <ri...@no...> > > Acked-by: Xuetao Guan <gx...@mp...> > > Signed-off-by: Guenter Roeck <li...@ro...> > > Acked-by: Ralf Baechle <ra...@li...> Thanks! Guenter |
|
From: Ralf B. <ra...@li...> - 2014-10-22 15:45:23
|
On Mon, Oct 20, 2014 at 09:12:24PM -0700, Guenter Roeck wrote: > pm_power_off is defined for all architectures. Move it to common code. > > Have all architectures call do_kernel_power_off instead of pm_power_off. > Some architectures point pm_power_off to machine_power_off. For those, > call do_kernel_power_off from machine_power_off instead. > > Acked-by: David Vrabel <dav...@ci...> > Acked-by: Geert Uytterhoeven <ge...@li...> > Acked-by: Hirokazu Takata <ta...@li...> > Acked-by: Jesper Nilsson <jes...@ax...> > Acked-by: Max Filippov <jcm...@gm...> > Acked-by: Rafael J. Wysocki <rj...@rj...> > Acked-by: Richard Weinberger <ri...@no...> > Acked-by: Xuetao Guan <gx...@mp...> > Signed-off-by: Guenter Roeck <li...@ro...> Acked-by: Ralf Baechle <ra...@li...> |
|
From: Guenter R. <li...@ro...> - 2014-10-21 04:15:36
|
pm_power_off is defined for all architectures. Move it to common code.
Have all architectures call do_kernel_power_off instead of pm_power_off.
Some architectures point pm_power_off to machine_power_off. For those,
call do_kernel_power_off from machine_power_off instead.
Acked-by: David Vrabel <dav...@ci...>
Acked-by: Geert Uytterhoeven <ge...@li...>
Acked-by: Hirokazu Takata <ta...@li...>
Acked-by: Jesper Nilsson <jes...@ax...>
Acked-by: Max Filippov <jcm...@gm...>
Acked-by: Rafael J. Wysocki <rj...@rj...>
Acked-by: Richard Weinberger <ri...@no...>
Acked-by: Xuetao Guan <gx...@mp...>
Signed-off-by: Guenter Roeck <li...@ro...>
---
v2:
- do_kernel_poweroff -> do_kernel_power_off
- have_kernel_poweroff -> have_kernel_power_off
arch/alpha/kernel/process.c | 9 +++------
arch/arc/kernel/reset.c | 5 +----
arch/arm/kernel/process.c | 5 +----
arch/arm64/kernel/process.c | 5 +----
arch/avr32/kernel/process.c | 6 +-----
arch/blackfin/kernel/process.c | 3 ---
arch/blackfin/kernel/reboot.c | 2 ++
arch/c6x/kernel/process.c | 9 +--------
arch/cris/kernel/process.c | 4 +---
arch/frv/kernel/process.c | 5 ++---
arch/hexagon/kernel/reset.c | 5 ++---
arch/ia64/kernel/process.c | 5 +----
arch/m32r/kernel/process.c | 8 ++++----
arch/m68k/kernel/process.c | 6 +-----
arch/metag/kernel/process.c | 6 +-----
arch/microblaze/kernel/process.c | 3 ---
arch/microblaze/kernel/reset.c | 1 +
arch/mips/kernel/reset.c | 6 +-----
arch/mn10300/kernel/process.c | 8 ++------
arch/openrisc/kernel/process.c | 8 +++++---
arch/parisc/kernel/process.c | 8 ++++----
arch/powerpc/kernel/setup-common.c | 6 +++---
arch/s390/kernel/setup.c | 8 ++------
arch/score/kernel/process.c | 8 ++++----
arch/sh/kernel/reboot.c | 6 +-----
arch/sparc/kernel/process_32.c | 10 ++--------
arch/sparc/kernel/reboot.c | 8 ++------
arch/tile/kernel/reboot.c | 7 +++----
arch/um/kernel/reboot.c | 2 --
arch/unicore32/kernel/process.c | 9 +--------
arch/x86/kernel/reboot.c | 11 +++--------
arch/x86/xen/enlighten.c | 3 +--
arch/xtensa/kernel/process.c | 4 ----
drivers/parisc/power.c | 3 +--
kernel/power/poweroff_handler.c | 8 ++++++++
kernel/reboot.c | 4 ++--
36 files changed, 68 insertions(+), 146 deletions(-)
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index 1941a07..81c43f8 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -24,6 +24,7 @@
#include <linux/vt.h>
#include <linux/mman.h>
#include <linux/elfcore.h>
+#include <linux/pm.h>
#include <linux/reboot.h>
#include <linux/tty.h>
#include <linux/console.h>
@@ -40,12 +41,6 @@
#include "proto.h"
#include "pci_impl.h"
-/*
- * Power off function, if any
- */
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL(pm_power_off);
-
#ifdef CONFIG_ALPHA_WTINT
/*
* Sleep the CPU.
@@ -184,6 +179,8 @@ machine_halt(void)
void
machine_power_off(void)
{
+ do_kernel_power_off();
+
common_shutdown(LINUX_REBOOT_CMD_POWER_OFF, NULL);
}
diff --git a/arch/arc/kernel/reset.c b/arch/arc/kernel/reset.c
index 2768fa1..0758d9d 100644
--- a/arch/arc/kernel/reset.c
+++ b/arch/arc/kernel/reset.c
@@ -26,9 +26,6 @@ void machine_restart(char *__unused)
void machine_power_off(void)
{
- /* FIXME :: power off ??? */
+ do_kernel_power_off();
machine_halt();
}
-
-void (*pm_power_off) (void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index fe972a2..aa3f656 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -117,8 +117,6 @@ void soft_restart(unsigned long addr)
/*
* Function pointers to optional machine specific functions
*/
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
@@ -205,8 +203,7 @@ void machine_power_off(void)
local_irq_disable();
smp_send_stop();
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
}
/*
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index c3065db..46a483a 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -68,8 +68,6 @@ void soft_restart(unsigned long addr)
/*
* Function pointers to optional machine specific functions
*/
-void (*pm_power_off)(void);
-EXPORT_SYMBOL_GPL(pm_power_off);
void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
@@ -129,8 +127,7 @@ void machine_power_off(void)
{
local_irq_disable();
smp_send_stop();
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
}
/*
diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c
index 42a53e74..529c1f6 100644
--- a/arch/avr32/kernel/process.c
+++ b/arch/avr32/kernel/process.c
@@ -23,9 +23,6 @@
#include <mach/pm.h>
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
/*
* This file handles the architecture-dependent parts of process handling..
*/
@@ -48,8 +45,7 @@ void machine_halt(void)
void machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
}
void machine_restart(char *cmd)
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
index 4aa5545..812dd83 100644
--- a/arch/blackfin/kernel/process.c
+++ b/arch/blackfin/kernel/process.c
@@ -39,9 +39,6 @@ int nr_l1stack_tasks;
void *l1_stack_base;
unsigned long l1_stack_len;
-void (*pm_power_off)(void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
-
/*
* The idle loop on BFIN
*/
diff --git a/arch/blackfin/kernel/reboot.c b/arch/blackfin/kernel/reboot.c
index c4f50a3..387d610 100644
--- a/arch/blackfin/kernel/reboot.c
+++ b/arch/blackfin/kernel/reboot.c
@@ -7,6 +7,7 @@
*/
#include <linux/interrupt.h>
+#include <linux/pm.h>
#include <asm/bfin-global.h>
#include <asm/reboot.h>
#include <asm/bfrom.h>
@@ -106,6 +107,7 @@ void machine_halt(void)
__attribute__((weak))
void native_machine_power_off(void)
{
+ do_kernel_power_off();
idle_with_irq_disabled();
}
diff --git a/arch/c6x/kernel/process.c b/arch/c6x/kernel/process.c
index 57d2ea8..edf7e5a 100644
--- a/arch/c6x/kernel/process.c
+++ b/arch/c6x/kernel/process.c
@@ -27,12 +27,6 @@ void (*c6x_halt)(void);
extern asmlinkage void ret_from_fork(void);
extern asmlinkage void ret_from_kernel_thread(void);
-/*
- * power off function, if any
- */
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
void arch_cpu_idle(void)
{
unsigned long tmp;
@@ -73,8 +67,7 @@ void machine_halt(void)
void machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
halt_loop();
}
diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
index b78498e..9ebd76b 100644
--- a/arch/cris/kernel/process.c
+++ b/arch/cris/kernel/process.c
@@ -31,9 +31,6 @@
extern void default_idle(void);
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
void arch_cpu_idle(void)
{
default_idle();
@@ -60,6 +57,7 @@ void machine_halt(void)
void machine_power_off(void)
{
+ do_kernel_power_off();
}
/*
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
index 5d40aeb77..502dabb 100644
--- a/arch/frv/kernel/process.c
+++ b/arch/frv/kernel/process.c
@@ -42,9 +42,6 @@ asmlinkage void ret_from_kernel_thread(void);
#include <asm/pgalloc.h>
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
static void core_sleep_idle(void)
{
#ifdef LED_DEBUG_SLEEP
@@ -107,6 +104,8 @@ void machine_power_off(void)
gdbstub_exit(0);
#endif
+ do_kernel_power_off();
+
for (;;);
}
diff --git a/arch/hexagon/kernel/reset.c b/arch/hexagon/kernel/reset.c
index 76483c1..6f607b6 100644
--- a/arch/hexagon/kernel/reset.c
+++ b/arch/hexagon/kernel/reset.c
@@ -16,11 +16,13 @@
* 02110-1301, USA.
*/
+#include <linux/pm.h>
#include <linux/smp.h>
#include <asm/hexagon_vm.h>
void machine_power_off(void)
{
+ do_kernel_power_off();
smp_send_stop();
__vmstop();
}
@@ -32,6 +34,3 @@ void machine_halt(void)
void machine_restart(char *cmd)
{
}
-
-void (*pm_power_off)(void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index b515149..88121a2 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -57,8 +57,6 @@ void (*ia64_mark_idle)(int);
unsigned long boot_option_idle_override = IDLE_NO_OVERRIDE;
EXPORT_SYMBOL(boot_option_idle_override);
-void (*pm_power_off) (void);
-EXPORT_SYMBOL(pm_power_off);
void
ia64_do_show_stack (struct unw_frame_info *info, void *arg)
@@ -675,8 +673,7 @@ machine_halt (void)
void
machine_power_off (void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
machine_halt();
}
diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c
index e69221d..65a037e 100644
--- a/arch/m32r/kernel/process.c
+++ b/arch/m32r/kernel/process.c
@@ -23,6 +23,7 @@
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/module.h>
+#include <linux/pm.h>
#include <linux/ptrace.h>
#include <linux/unistd.h>
#include <linux/hardirq.h>
@@ -44,9 +45,6 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
return tsk->thread.lr;
}
-void (*pm_power_off)(void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
-
void machine_restart(char *__unused)
{
#if defined(CONFIG_PLAT_MAPPI3)
@@ -67,7 +65,9 @@ void machine_halt(void)
void machine_power_off(void)
{
- /* M32R_FIXME */
+ do_kernel_power_off();
+ for (;;)
+ ;
}
void show_regs(struct pt_regs * regs)
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index afe3d6e..bbc0a63 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -78,14 +78,10 @@ void machine_halt(void)
void machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
for (;;);
}
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL(pm_power_off);
-
void show_regs(struct pt_regs * regs)
{
printk("\n");
diff --git a/arch/metag/kernel/process.c b/arch/metag/kernel/process.c
index 483dff9..8d95773 100644
--- a/arch/metag/kernel/process.c
+++ b/arch/metag/kernel/process.c
@@ -67,9 +67,6 @@ void arch_cpu_idle_dead(void)
}
#endif
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
void (*soc_restart)(char *cmd);
void (*soc_halt)(void);
@@ -90,8 +87,7 @@ void machine_halt(void)
void machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
smp_send_stop();
hard_processor_halt(HALT_OK);
}
diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c
index b2dd371..0ebca36 100644
--- a/arch/microblaze/kernel/process.c
+++ b/arch/microblaze/kernel/process.c
@@ -44,9 +44,6 @@ void show_regs(struct pt_regs *regs)
regs->msr, regs->ear, regs->esr, regs->fsr);
}
-void (*pm_power_off)(void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
-
void flush_thread(void)
{
}
diff --git a/arch/microblaze/kernel/reset.c b/arch/microblaze/kernel/reset.c
index fbe58c6..2c6b32c 100644
--- a/arch/microblaze/kernel/reset.c
+++ b/arch/microblaze/kernel/reset.c
@@ -103,6 +103,7 @@ void machine_halt(void)
void machine_power_off(void)
{
pr_notice("Machine power off...\n");
+ do_kernel_power_off();
while (1)
;
}
diff --git a/arch/mips/kernel/reset.c b/arch/mips/kernel/reset.c
index 07fc524..09e74d2 100644
--- a/arch/mips/kernel/reset.c
+++ b/arch/mips/kernel/reset.c
@@ -21,9 +21,6 @@
*/
void (*_machine_restart)(char *command);
void (*_machine_halt)(void);
-void (*pm_power_off)(void);
-
-EXPORT_SYMBOL(pm_power_off);
void machine_restart(char *command)
{
@@ -39,6 +36,5 @@ void machine_halt(void)
void machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
}
diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c
index 3707da5..c78b2eb 100644
--- a/arch/mn10300/kernel/process.c
+++ b/arch/mn10300/kernel/process.c
@@ -20,6 +20,7 @@
#include <linux/user.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
+#include <linux/pm.h>
#include <linux/reboot.h>
#include <linux/percpu.h>
#include <linux/err.h>
@@ -45,12 +46,6 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
}
/*
- * power off function, if any
- */
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
-/*
* On SMP it's slightly faster (but much more power-consuming!)
* to poll the ->work.need_resched flag instead of waiting for the
* cross-CPU IPI to arrive. Use this option with caution.
@@ -93,6 +88,7 @@ void machine_power_off(void)
#ifdef CONFIG_KERNEL_DEBUGGER
gdbstub_exit(0);
#endif
+ do_kernel_power_off();
}
void show_regs(struct pt_regs *regs)
diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c
index 386af25..494afd2 100644
--- a/arch/openrisc/kernel/process.c
+++ b/arch/openrisc/kernel/process.c
@@ -25,6 +25,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mm.h>
+#include <linux/pm.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/ptrace.h>
@@ -51,7 +52,7 @@
*/
struct thread_info *current_thread_info_set[NR_CPUS] = { &init_thread_info, };
-void machine_restart(void)
+void machine_restart(char *cmd)
{
printk(KERN_INFO "*** MACHINE RESTART ***\n");
__asm__("l.nop 1");
@@ -72,11 +73,12 @@ void machine_halt(void)
void machine_power_off(void)
{
printk(KERN_INFO "*** MACHINE POWER OFF ***\n");
+
+ do_kernel_power_off();
+
__asm__("l.nop 1");
}
-void (*pm_power_off) (void) = machine_power_off;
-
/*
* When a process does an "exec", machine state like FPU and debug
* registers need to be reset. This is a hook function for that.
diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
index 0bbbf0d..3f5d14a 100644
--- a/arch/parisc/kernel/process.c
+++ b/arch/parisc/kernel/process.c
@@ -41,6 +41,7 @@
#include <linux/fs.h>
#include <linux/module.h>
#include <linux/personality.h>
+#include <linux/pm.h>
#include <linux/ptrace.h>
#include <linux/sched.h>
#include <linux/slab.h>
@@ -133,7 +134,9 @@ void machine_power_off(void)
pdc_soft_power_button(0);
pdc_chassis_send_status(PDC_CHASSIS_DIRECT_SHUTDOWN);
-
+
+ do_kernel_power_off();
+
/* It seems we have no way to power the system off via
* software. The user has to press the button himself. */
@@ -141,9 +144,6 @@ void machine_power_off(void)
"Please power this system off now.");
}
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL(pm_power_off);
-
/*
* Free current thread data structures etc..
*/
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 1362cd6..5b7a851 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -141,6 +141,9 @@ void machine_power_off(void)
machine_shutdown();
if (ppc_md.power_off)
ppc_md.power_off();
+
+ do_kernel_power_off();
+
#ifdef CONFIG_SMP
smp_send_stop();
#endif
@@ -151,9 +154,6 @@ void machine_power_off(void)
/* Used by the G5 thermal driver */
EXPORT_SYMBOL_GPL(machine_power_off);
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL_GPL(pm_power_off);
-
void machine_halt(void)
{
machine_shutdown();
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index e80d9ff..267e025 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -263,13 +263,9 @@ void machine_power_off(void)
*/
console_unblank();
_machine_power_off();
-}
-/*
- * Dummy power off function.
- */
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL_GPL(pm_power_off);
+ do_kernel_power_off();
+}
static int __init early_parse_mem(char *p)
{
diff --git a/arch/score/kernel/process.c b/arch/score/kernel/process.c
index a1519ad3..b76ea67 100644
--- a/arch/score/kernel/process.c
+++ b/arch/score/kernel/process.c
@@ -29,9 +29,6 @@
#include <linux/pm.h>
#include <linux/rcupdate.h>
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
/* If or when software machine-restart is implemented, add code here. */
void machine_restart(char *command) {}
@@ -39,7 +36,10 @@ void machine_restart(char *command) {}
void machine_halt(void) {}
/* If or when software machine-power-off is implemented, add code here. */
-void machine_power_off(void) {}
+void machine_power_off(void)
+{
+ do_kernel_power_off();
+}
void ret_from_fork(void);
void ret_from_kernel_thread(void);
diff --git a/arch/sh/kernel/reboot.c b/arch/sh/kernel/reboot.c
index 04afe5b..065de12 100644
--- a/arch/sh/kernel/reboot.c
+++ b/arch/sh/kernel/reboot.c
@@ -11,9 +11,6 @@
#include <asm/tlbflush.h>
#include <asm/traps.h>
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
#ifdef CONFIG_SUPERH32
static void watchdog_trigger_immediate(void)
{
@@ -51,8 +48,7 @@ static void native_machine_shutdown(void)
static void native_machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
}
static void native_machine_halt(void)
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
index 50e7b62..cb8148a 100644
--- a/arch/sparc/kernel/process_32.c
+++ b/arch/sparc/kernel/process_32.c
@@ -48,14 +48,6 @@
*/
void (*sparc_idle)(void);
-/*
- * Power-off handler instantiation for pm.h compliance
- * This is done via auxio, but could be used as a fallback
- * handler when auxio is not present-- unused for now...
- */
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL(pm_power_off);
-
/*
* sysctl - toggle power-off restriction for serial console
* systems in machine_power_off()
@@ -112,6 +104,8 @@ void machine_power_off(void)
sbus_writeb(power_register, auxio_power_register);
}
+ do_kernel_power_off();
+
machine_halt();
}
diff --git a/arch/sparc/kernel/reboot.c b/arch/sparc/kernel/reboot.c
index eba7d91..3c0bb03 100644
--- a/arch/sparc/kernel/reboot.c
+++ b/arch/sparc/kernel/reboot.c
@@ -16,17 +16,13 @@
*/
int scons_pwroff = 1;
-/* This isn't actually used, it exists merely to satisfy the
- * reference in kernel/sys.c
- */
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL(pm_power_off);
-
void machine_power_off(void)
{
if (strcmp(of_console_device->type, "serial") || scons_pwroff)
prom_halt_power_off();
+ do_kernel_power_off();
+
prom_halt();
}
diff --git a/arch/tile/kernel/reboot.c b/arch/tile/kernel/reboot.c
index 6c5d2c0..8ff4a7f 100644
--- a/arch/tile/kernel/reboot.c
+++ b/arch/tile/kernel/reboot.c
@@ -36,6 +36,9 @@ void machine_power_off(void)
{
arch_local_irq_disable_all();
smp_send_stop();
+
+ do_kernel_power_off();
+
hv_power_off();
}
@@ -45,7 +48,3 @@ void machine_restart(char *cmd)
smp_send_stop();
hv_restart((HV_VirtAddr) "vmlinux", (HV_VirtAddr) cmd);
}
-
-/* No interesting distinction to be made here. */
-void (*pm_power_off)(void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c
index ced8903..a82ef28 100644
--- a/arch/um/kernel/reboot.c
+++ b/arch/um/kernel/reboot.c
@@ -11,8 +11,6 @@
#include <os.h>
#include <skas.h>
-void (*pm_power_off)(void);
-
static void kill_off_processes(void)
{
if (proc_mm)
diff --git a/arch/unicore32/kernel/process.c b/arch/unicore32/kernel/process.c
index b008e99..9490dd5 100644
--- a/arch/unicore32/kernel/process.c
+++ b/arch/unicore32/kernel/process.c
@@ -56,16 +56,9 @@ void machine_halt(void)
gpio_set_value(GPO_SOFT_OFF, 0);
}
-/*
- * Function pointers to optional machine specific functions
- */
-void (*pm_power_off)(void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
-
void machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
machine_halt();
}
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 17962e6..5c09e28 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -30,12 +30,6 @@
#include <asm/x86_init.h>
#include <asm/efi.h>
-/*
- * Power off function, if any
- */
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
static const struct desc_ptr no_idt = {};
/*
@@ -647,11 +641,12 @@ static void native_machine_halt(void)
static void native_machine_power_off(void)
{
- if (pm_power_off) {
+ if (have_kernel_power_off()) {
if (!reboot_force)
machine_shutdown();
- pm_power_off();
+ do_kernel_power_off();
}
+
/* A fallback in case there is no PM info available */
tboot_shutdown(TB_SHUTDOWN_HALT);
}
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 1a3f044..c2c1d74 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1320,8 +1320,7 @@ static void xen_machine_halt(void)
static void xen_machine_power_off(void)
{
- if (pm_power_off)
- pm_power_off();
+ do_kernel_power_off();
xen_reboot(SHUTDOWN_poweroff);
}
diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
index 1c85323..c487296 100644
--- a/arch/xtensa/kernel/process.c
+++ b/arch/xtensa/kernel/process.c
@@ -49,10 +49,6 @@ extern void ret_from_kernel_thread(void);
struct task_struct *current_set[NR_CPUS] = {&init_task, };
-void (*pm_power_off)(void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
-
-
#if XTENSA_HAVE_COPROCESSORS
void coprocessor_release_all(struct thread_info *ti)
diff --git a/drivers/parisc/power.c b/drivers/parisc/power.c
index ef31b77..f10cf92 100644
--- a/drivers/parisc/power.c
+++ b/drivers/parisc/power.c
@@ -95,8 +95,7 @@ static void process_shutdown(void)
/* send kill signal */
if (kill_cad_pid(SIGINT, 1)) {
/* just in case killing init process failed */
- if (pm_power_off)
- pm_power_off();
+ kernel_power_off();
}
}
}
diff --git a/kernel/power/poweroff_handler.c b/kernel/power/poweroff_handler.c
index aeb4736..37f0b88 100644
--- a/kernel/power/poweroff_handler.c
+++ b/kernel/power/poweroff_handler.c
@@ -22,6 +22,12 @@
#include <linux/types.h>
/*
+ * If set, calling this function will power off the system immediately.
+ */
+void (*pm_power_off)(void);
+EXPORT_SYMBOL(pm_power_off);
+
+/*
* Notifier list for kernel code which wants to be called
* to power off the system.
*/
@@ -236,6 +242,8 @@ EXPORT_SYMBOL(devm_register_power_off_handler);
void do_kernel_power_off(void)
{
spin_lock(&power_off_handler_lock);
+ if (pm_power_off)
+ pm_power_off();
raw_notifier_call_chain(&power_off_handler_list, 0, NULL);
spin_unlock(&power_off_handler_lock);
}
diff --git a/kernel/reboot.c b/kernel/reboot.c
index 5925f5a..0930851 100644
--- a/kernel/reboot.c
+++ b/kernel/reboot.c
@@ -306,9 +306,9 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
return ret;
/* Instead of trying to make the power_off code look like
- * halt when pm_power_off is not set do it the easy way.
+ * halt when no poweroff handler exists do it the easy way.
*/
- if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)
+ if (cmd == LINUX_REBOOT_CMD_POWER_OFF && !have_kernel_power_off())
cmd = LINUX_REBOOT_CMD_HALT;
mutex_lock(&reboot_mutex);
--
1.9.1
|
|
From: Manfred S. <man...@gm...> - 2014-10-19 17:32:14
|
On 2014-10-18 17:40, Richard Weinberger wrote: > Am 18.10.2014 um 17:24 schrieb Manfred Schlaegl: >> On 2014-10-18 17:19, Richard Weinberger wrote: >>> Am 18.10.2014 um 17:12 schrieb Manfred Schlaegl: >>>> On 2014-10-18 16:42, Richard Weinberger wrote: >>>>> Am 18.10.2014 um 16:23 schrieb Manfred Schlaegl: >>>>>> The pointer to bp stack-frame is no longer used. Removed it. >>>>> >>>>> Good catch! >>>> Thank you. >>>> >>>>> >>>>>> This also removes a corresponding compiler-warning. >>>>> >>>>> Which warning exactly? >>>> >>>> On "normal" (defconfig) builds the warning does not show up because CONFIG_FRAME_POINTER is set. >>>> I've found the unused bp because CONFIG_FRAME_POINTER was not set in my configuration. >>>> >>>> CC arch/um/kernel/sysrq.o >>>> arch/um/kernel/sysrq.c: In function ‘show_stack’: >>>> arch/um/kernel/sysrq.c:32:29: warning: unused variable ‘bp’ [-Wunused-variable] >>> >>> Looks like my gcc need's an upgrade. :D >>> >>> Thanks, >>> //richard >>> >> >> I'm using gcc version 4.7.2 (Debian 4.7.2-5). -> not THAT new ;-) > > With a cup of coffee applied I managed it to read your mail correctly. > The warning triggers only with CONFIG_FRAME_POINTER=n. Now it makes sense. Misunderstanding solved! Miracle cure caffeine ;-) greetings manfred |
|
From: Richard W. <ri...@no...> - 2014-10-18 15:40:51
|
Am 18.10.2014 um 17:24 schrieb Manfred Schlaegl: > On 2014-10-18 17:19, Richard Weinberger wrote: >> Am 18.10.2014 um 17:12 schrieb Manfred Schlaegl: >>> On 2014-10-18 16:42, Richard Weinberger wrote: >>>> Am 18.10.2014 um 16:23 schrieb Manfred Schlaegl: >>>>> The pointer to bp stack-frame is no longer used. Removed it. >>>> >>>> Good catch! >>> Thank you. >>> >>>> >>>>> This also removes a corresponding compiler-warning. >>>> >>>> Which warning exactly? >>> >>> On "normal" (defconfig) builds the warning does not show up because CONFIG_FRAME_POINTER is set. >>> I've found the unused bp because CONFIG_FRAME_POINTER was not set in my configuration. >>> >>> CC arch/um/kernel/sysrq.o >>> arch/um/kernel/sysrq.c: In function ‘show_stack’: >>> arch/um/kernel/sysrq.c:32:29: warning: unused variable ‘bp’ [-Wunused-variable] >> >> Looks like my gcc need's an upgrade. :D >> >> Thanks, >> //richard >> > > I'm using gcc version 4.7.2 (Debian 4.7.2-5). -> not THAT new ;-) With a cup of coffee applied I managed it to read your mail correctly. The warning triggers only with CONFIG_FRAME_POINTER=n. Now it makes sense. Thanks, //richard |
|
From: Manfred S. <man...@gm...> - 2014-10-18 15:28:52
|
On 2014-10-18 17:19, Richard Weinberger wrote: > Am 18.10.2014 um 17:12 schrieb Manfred Schlaegl: >> On 2014-10-18 16:42, Richard Weinberger wrote: >>> Am 18.10.2014 um 16:23 schrieb Manfred Schlaegl: >>>> The pointer to bp stack-frame is no longer used. Removed it. >>> >>> Good catch! >> Thank you. >> >>> >>>> This also removes a corresponding compiler-warning. >>> >>> Which warning exactly? >> >> On "normal" (defconfig) builds the warning does not show up because CONFIG_FRAME_POINTER is set. >> I've found the unused bp because CONFIG_FRAME_POINTER was not set in my configuration. >> >> CC arch/um/kernel/sysrq.o >> arch/um/kernel/sysrq.c: In function ‘show_stack’: >> arch/um/kernel/sysrq.c:32:29: warning: unused variable ‘bp’ [-Wunused-variable] > > Looks like my gcc need's an upgrade. :D > > Thanks, > //richard > I'm using gcc version 4.7.2 (Debian 4.7.2-5). -> not THAT new ;-) best regards manfred |
|
From: Richard W. <ri...@no...> - 2014-10-18 15:19:39
|
Am 18.10.2014 um 17:12 schrieb Manfred Schlaegl: > On 2014-10-18 16:42, Richard Weinberger wrote: >> Am 18.10.2014 um 16:23 schrieb Manfred Schlaegl: >>> The pointer to bp stack-frame is no longer used. Removed it. >> >> Good catch! > Thank you. > >> >>> This also removes a corresponding compiler-warning. >> >> Which warning exactly? > > On "normal" (defconfig) builds the warning does not show up because CONFIG_FRAME_POINTER is set. > I've found the unused bp because CONFIG_FRAME_POINTER was not set in my configuration. > > CC arch/um/kernel/sysrq.o > arch/um/kernel/sysrq.c: In function ‘show_stack’: > arch/um/kernel/sysrq.c:32:29: warning: unused variable ‘bp’ [-Wunused-variable] Looks like my gcc need's an upgrade. :D Thanks, //richard |
|
From: Manfred S. <man...@gm...> - 2014-10-18 15:16:35
|
On 2014-10-18 16:42, Richard Weinberger wrote: > Am 18.10.2014 um 16:23 schrieb Manfred Schlaegl: >> The pointer to bp stack-frame is no longer used. Removed it. > > Good catch! Thank you. > >> This also removes a corresponding compiler-warning. > > Which warning exactly? On "normal" (defconfig) builds the warning does not show up because CONFIG_FRAME_POINTER is set. I've found the unused bp because CONFIG_FRAME_POINTER was not set in my configuration. CC arch/um/kernel/sysrq.o arch/um/kernel/sysrq.c: In function ‘show_stack’: arch/um/kernel/sysrq.c:32:29: warning: unused variable ‘bp’ [-Wunused-variable] It's reproducible on linus-tree (0429fbc0b) by make mrproper make tinyconfig ARCH=um SUBARCH=i386 make ARCH=um SUBARCH=i386 > > Thanks, > //richard > best regards, manfred |
|
From: Richard W. <ri...@no...> - 2014-10-18 14:42:30
|
Am 18.10.2014 um 16:23 schrieb Manfred Schlaegl: > The pointer to bp stack-frame is no longer used. Removed it. Good catch! > This also removes a corresponding compiler-warning. Which warning exactly? Thanks, //richard |
|
From: Manfred S. <man...@gm...> - 2014-10-18 14:27:19
|
The pointer to bp stack-frame is no longer used. Removed it.
This also removes a corresponding compiler-warning.
Signed-off-by: Manfred Schlaegl <man...@gm...>
---
arch/um/kernel/sysrq.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/arch/um/kernel/sysrq.c b/arch/um/kernel/sysrq.c
index 894c8d3..aa1b56f 100644
--- a/arch/um/kernel/sysrq.c
+++ b/arch/um/kernel/sysrq.c
@@ -29,7 +29,7 @@ static const struct stacktrace_ops stackops = {
void show_stack(struct task_struct *task, unsigned long *stack)
{
- unsigned long *sp = stack, bp = 0;
+ unsigned long *sp = stack;
struct pt_regs *segv_regs = current->thread.segv_regs;
int i;
@@ -39,10 +39,6 @@ void show_stack(struct task_struct *task, unsigned long *stack)
return;
}
-#ifdef CONFIG_FRAME_POINTER
- bp = get_frame_pointer(task, segv_regs);
-#endif
-
if (!stack)
sp = get_stack_pointer(task, segv_regs);
-- 1.7.10.4
|
|
From: Nicolas I. <nic...@m4...> - 2014-10-12 11:03:34
|
When declaring __syscall_stub_start, use the same type in UML userspace
code as in arch/um/include/asm/sections.h.
While at it, also declare batch_syscall_stub as char[].
Signed-off-by: Nicolas Iooss <nic...@m4...>
---
arch/um/os-Linux/skas/mem.c | 6 +++---
arch/um/os-Linux/skas/process.c | 11 +++++------
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c
index 689b18db798f..abb02becca80 100644
--- a/arch/um/os-Linux/skas/mem.c
+++ b/arch/um/os-Linux/skas/mem.c
@@ -19,7 +19,7 @@
#include <sysdep/ptrace.h>
#include <sysdep/stub.h>
-extern unsigned long batch_syscall_stub, __syscall_stub_start;
+extern char batch_syscall_stub[], __syscall_stub_start[];
extern void wait_stub_done(int pid);
@@ -39,8 +39,8 @@ static int __init init_syscall_regs(void)
{
get_safe_registers(syscall_regs, NULL);
syscall_regs[REGS_IP_INDEX] = STUB_CODE +
- ((unsigned long) &batch_syscall_stub -
- (unsigned long) &__syscall_stub_start);
+ ((unsigned long) batch_syscall_stub -
+ (unsigned long) __syscall_stub_start);
return 0;
}
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index 908579f2b0ab..fa934d0c8932 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -193,7 +193,7 @@ static void handle_trap(int pid, struct uml_pt_regs *regs,
handle_syscall(regs);
}
-extern int __syscall_stub_start;
+extern char __syscall_stub_start[];
static int userspace_tramp(void *stack)
{
@@ -218,7 +218,7 @@ static int userspace_tramp(void *stack)
*/
int fd;
unsigned long long offset;
- fd = phys_mapping(to_phys(&__syscall_stub_start), &offset);
+ fd = phys_mapping(to_phys(__syscall_stub_start), &offset);
addr = mmap64((void *) STUB_CODE, UM_KERN_PAGE_SIZE,
PROT_EXEC, MAP_FIXED | MAP_PRIVATE, fd, offset);
if (addr == MAP_FAILED) {
@@ -245,7 +245,7 @@ static int userspace_tramp(void *stack)
unsigned long v = STUB_CODE +
(unsigned long) stub_segv_handler -
- (unsigned long) &__syscall_stub_start;
+ (unsigned long) __syscall_stub_start;
set_sigstack((void *) STUB_DATA, UM_KERN_PAGE_SIZE);
sigemptyset(&sa.sa_mask);
@@ -474,7 +474,7 @@ static int __init init_thread_regs(void)
/* Set parent's instruction pointer to start of clone-stub */
thread_regs[REGS_IP_INDEX] = STUB_CODE +
(unsigned long) stub_clone_handler -
- (unsigned long) &__syscall_stub_start;
+ (unsigned long) __syscall_stub_start;
thread_regs[REGS_SP_INDEX] = STUB_DATA + UM_KERN_PAGE_SIZE -
sizeof(void *);
#ifdef __SIGNAL_FRAMESIZE
@@ -582,8 +582,7 @@ int map_stub_pages(int fd, unsigned long code, unsigned long data,
struct proc_mm_op mmop;
int n;
unsigned long long code_offset;
- int code_fd = phys_mapping(to_phys((void *) &__syscall_stub_start),
- &code_offset);
+ int code_fd = phys_mapping(to_phys(__syscall_stub_start), &code_offset);
mmop = ((struct proc_mm_op) { .op = MM_MMAP,
.u =
--
2.1.1
|
|
From: Nicolas I. <nic...@m4...> - 2014-10-12 11:03:31
|
The linker script defines some variables which are declared either with type char[] in include/asm-generic/sections.h or with a meaningless integer type in arch/um/include/asm/sections.h. Fix this inconsistency by declaring every variable char[]. Signed-off-by: Nicolas Iooss <nic...@m4...> --- arch/um/include/asm/sections.h | 4 ++-- arch/um/kernel/physmem.c | 4 ++-- arch/um/kernel/skas/mmu.c | 4 ++-- arch/um/kernel/um_arch.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/um/include/asm/sections.h b/arch/um/include/asm/sections.h index 3a6ebcc65519..cafcf684d947 100644 --- a/arch/um/include/asm/sections.h +++ b/arch/um/include/asm/sections.h @@ -3,7 +3,7 @@ #include <asm-generic/sections.h> -extern char __binary_start; -extern int __syscall_stub_start, __syscall_stub_end; +extern char __binary_start[]; +extern char __syscall_stub_start[], __syscall_stub_end[]; #endif diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c index db05c067665a..c833a5dec1e7 100644 --- a/arch/um/kernel/physmem.c +++ b/arch/um/kernel/physmem.c @@ -100,8 +100,8 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end, * Special kludge - This page will be mapped in to userspace processes * from physmem_fd, so it needs to be written out there. */ - os_seek_file(physmem_fd, __pa(&__syscall_stub_start)); - os_write_file(physmem_fd, &__syscall_stub_start, PAGE_SIZE); + os_seek_file(physmem_fd, __pa(__syscall_stub_start)); + os_write_file(physmem_fd, __syscall_stub_start, PAGE_SIZE); os_fsync_file(physmem_fd); bootmap_size = init_bootmem(pfn, pfn + delta); diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c index d2a0a4c0cd91..e40ce29bdc2c 100644 --- a/arch/um/kernel/skas/mmu.c +++ b/arch/um/kernel/skas/mmu.c @@ -108,7 +108,7 @@ void uml_setup_stubs(struct mm_struct *mm) return; ret = init_stub_pte(mm, STUB_CODE, - (unsigned long) &__syscall_stub_start); + (unsigned long) __syscall_stub_start); if (ret) goto out; @@ -116,7 +116,7 @@ void uml_setup_stubs(struct mm_struct *mm) if (ret) goto out; - mm->context.stub_pages[0] = virt_to_page(&__syscall_stub_start); + mm->context.stub_pages[0] = virt_to_page(__syscall_stub_start); mm->context.stub_pages[1] = virt_to_page(mm->context.id.stack); /* dup_mmap already holds mmap_sem */ diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index 02c21f6e0983..5dd632203dca 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -313,7 +313,7 @@ int __init linux_main(int argc, char **argv) physmem_size += UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end); } - uml_physmem = (unsigned long) &__binary_start & PAGE_MASK; + uml_physmem = (unsigned long) __binary_start & PAGE_MASK; /* Reserve up to 4M after the current brk */ uml_reserved = ROUND_4M(brk_start) + (1 << 22); -- 2.1.1 |
|
From: Nicolas I. <nic...@m4...> - 2014-10-12 11:03:21
|
arch/um/kernel/dyn.lds.S and arch/um/kernel/uml.lds.S define some
UML-specific symbols. These symbols are used in the kernel part of UML
with extern declarations.
Move these declarations to a new header, asm/sections.h, like other
architectures do.
Signed-off-by: Nicolas Iooss <nic...@m4...>
---
arch/um/include/asm/Kbuild | 1 -
arch/um/include/asm/sections.h | 9 +++++++++
arch/um/kernel/physmem.c | 3 +--
arch/um/kernel/skas/mmu.c | 3 +--
arch/um/kernel/um_arch.c | 2 --
5 files changed, 11 insertions(+), 7 deletions(-)
create mode 100644 arch/um/include/asm/sections.h
diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild
index 244b12c8cb39..21fd5c647442 100644
--- a/arch/um/include/asm/Kbuild
+++ b/arch/um/include/asm/Kbuild
@@ -23,7 +23,6 @@ generic-y += pci.h
generic-y += percpu.h
generic-y += preempt.h
generic-y += scatterlist.h
-generic-y += sections.h
generic-y += switch_to.h
generic-y += topology.h
generic-y += trace_clock.h
diff --git a/arch/um/include/asm/sections.h b/arch/um/include/asm/sections.h
new file mode 100644
index 000000000000..3a6ebcc65519
--- /dev/null
+++ b/arch/um/include/asm/sections.h
@@ -0,0 +1,9 @@
+#ifndef __UM_SECTIONS_H
+#define __UM_SECTIONS_H
+
+#include <asm-generic/sections.h>
+
+extern char __binary_start;
+extern int __syscall_stub_start, __syscall_stub_end;
+
+#endif
diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c
index 30fdd5d0067b..db05c067665a 100644
--- a/arch/um/kernel/physmem.c
+++ b/arch/um/kernel/physmem.c
@@ -8,6 +8,7 @@
#include <linux/mm.h>
#include <linux/pfn.h>
#include <asm/page.h>
+#include <asm/sections.h>
#include <as-layout.h>
#include <init.h>
#include <kern.h>
@@ -75,8 +76,6 @@ void map_memory(unsigned long virt, unsigned long phys, unsigned long len,
}
}
-extern int __syscall_stub_start;
-
void __init setup_physmem(unsigned long start, unsigned long reserve_end,
unsigned long len, unsigned long long highmem)
{
diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c
index 007d5503f49b..d2a0a4c0cd91 100644
--- a/arch/um/kernel/skas/mmu.c
+++ b/arch/um/kernel/skas/mmu.c
@@ -8,12 +8,11 @@
#include <linux/slab.h>
#include <asm/pgalloc.h>
#include <asm/pgtable.h>
+#include <asm/sections.h>
#include <as-layout.h>
#include <os.h>
#include <skas.h>
-extern int __syscall_stub_start;
-
static int init_stub_pte(struct mm_struct *mm, unsigned long proc,
unsigned long kernel)
{
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 016adf0985d5..02c21f6e0983 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -259,8 +259,6 @@ EXPORT_SYMBOL(end_iomem);
#define MIN_VMALLOC (32 * 1024 * 1024)
-extern char __binary_start;
-
int __init linux_main(int argc, char **argv)
{
unsigned long avail, diff;
--
2.1.1
|
|
From: Nicolas I. <nic...@m4...> - 2014-10-11 13:25:56
|
Le 11/10/2014 14:24, Richard Weinberger a écrit : > Am 11.10.2014 um 14:15 schrieb Nicolas Iooss: >> 2014-10-11 13:42 GMT+02:00 Richard Weinberger: >>> Am 11.10.2014 um 13:29 schrieb Nicolas Iooss: >>>> syscall_stub_start is declared with different types in C files: >>>> >>>> arch/um/kernel/physmem.c: extern int __syscall_stub_start; >>>> arch/um/kernel/skas/mmu.c: extern int __syscall_stub_start; >>>> arch/um/os-Linux/skas/mem.c: extern unsigned long __syscall_stub_start; >>>> arch/um/os-Linux/skas/process.c: extern int __syscall_stub_start; >>>> >>>> Fix this inconsistency by always using unsigned long. This does not >>>> change anything in the compiled code because only the address of >>>> __syscall_stub_start is used, but it makes the static checker I use >>>> stop complaining about incompatible declarations. >>> >>> While we're here, can you put these declarations into a single header >> file? >> >> Sure. Do you have a specific header file in mind or shall I create >> arch/um/include/asm/sections.h with declarations for >> __syscall_stub_start, __syscall_stub_end and __binary_start (used in >> arch/um/kernel/um_arch.c)? > > Not really. Maybe you can find a common header for all. > But I fear where is a reason why these declarations are not in a > common header. They are used in the kernel- and userspace part of > UML. > Anyway, please give it a try. :) Ok. I'll at least try to add a kernel header and send a new patch after some tests. By the way, most variables in include/asm-generic/sections.h are declared "char[]" and used without operator, contrary to __syscall_stub_start, declared "int" or "unsigned long" and only used with "&" operator. Is there any reason why there are in the kernel two ways of declaring/accessing code addresses defined in linker files? If not, I can send a patch which makes __syscall_stub_start "char[]" instead of "unsigned long" to make the code a little bit clearer. Nicolas |
|
From: Richard W. <ri...@no...> - 2014-10-11 12:24:46
|
Am 11.10.2014 um 14:15 schrieb Nicolas Iooss: > 2014-10-11 13:42 GMT+02:00 Richard Weinberger: >> Am 11.10.2014 um 13:29 schrieb Nicolas Iooss: >>> syscall_stub_start is declared with different types in C files: >>> >>> arch/um/kernel/physmem.c: extern int __syscall_stub_start; >>> arch/um/kernel/skas/mmu.c: extern int __syscall_stub_start; >>> arch/um/os-Linux/skas/mem.c: extern unsigned long __syscall_stub_start; >>> arch/um/os-Linux/skas/process.c: extern int __syscall_stub_start; >>> >>> Fix this inconsistency by always using unsigned long. This does not >>> change anything in the compiled code because only the address of >>> __syscall_stub_start is used, but it makes the static checker I use >>> stop complaining about incompatible declarations. >> >> While we're here, can you put these declarations into a single header > file? > > Sure. Do you have a specific header file in mind or shall I create > arch/um/include/asm/sections.h with declarations for > __syscall_stub_start, __syscall_stub_end and __binary_start (used in > arch/um/kernel/um_arch.c)? Not really. Maybe you can find a common header for all. But I fear where is a reason why these declarations are not in a common header. They are used in the kernel- and userspace part of UML. Anyway, please give it a try. :) Thanks, //richard |
|
From: Nicolas I. <nic...@m4...> - 2014-10-11 12:15:56
|
2014-10-11 13:42 GMT+02:00 Richard Weinberger: > Am 11.10.2014 um 13:29 schrieb Nicolas Iooss: >> syscall_stub_start is declared with different types in C files: >> >> arch/um/kernel/physmem.c: extern int __syscall_stub_start; >> arch/um/kernel/skas/mmu.c: extern int __syscall_stub_start; >> arch/um/os-Linux/skas/mem.c: extern unsigned long __syscall_stub_start; >> arch/um/os-Linux/skas/process.c: extern int __syscall_stub_start; >> >> Fix this inconsistency by always using unsigned long. This does not >> change anything in the compiled code because only the address of >> __syscall_stub_start is used, but it makes the static checker I use >> stop complaining about incompatible declarations. > > While we're here, can you put these declarations into a single header file? Sure. Do you have a specific header file in mind or shall I create arch/um/include/asm/sections.h with declarations for __syscall_stub_start, __syscall_stub_end and __binary_start (used in arch/um/kernel/um_arch.c)? Thanks for your quick reply, Nicolas |