[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 08/47] kernel: Move pm_power_off to common code



Acked-by: Lennox Wu <lennox.wu@xxxxxxxxx>

2014-10-21 12:12 GMT+08:00 Guenter Roeck <linux@xxxxxxxxxxxx>:
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 <david.vrabel@xxxxxxxxxx>
Acked-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Acked-by: Hirokazu Takata <takata@xxxxxxxxxxxxxx>
Acked-by: Jesper Nilsson <jesper.nilsson@xxxxxxxx>
Acked-by: Max Filippov <jcmvbkbc@xxxxxxxxx>
Acked-by: Rafael J. Wysocki <rjw@xxxxxxxxxxxxx>
Acked-by: Richard Weinberger <richard@xxxxxx>
Acked-by: Xuetao Guan <gxt@xxxxxxxxxxxxxxx>
Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
---
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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.