Skip to content

Commit

Permalink
[PATCH] Don't export machine_restart, machine_halt, or machine_power_…
Browse files Browse the repository at this point in the history
…off.

machine_restart, machine_halt and machine_power_off are machine
specific hooks deep into the reboot logic, that modules
have no business messing with.  Usually code should be calling
kernel_restart, kernel_halt, kernel_power_off, or
emergency_restart. So don't export machine_restart,
machine_halt, and machine_power_off so we can catch buggy users.

Signed-off-by: Eric W. Biederman <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
ebiederm authored and Linus Torvalds committed Jul 26, 2005
1 parent 16dcb4b commit 59586e5
Show file tree
Hide file tree
Showing 29 changed files with 0 additions and 152 deletions.
3 changes: 0 additions & 3 deletions arch/alpha/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,23 +165,20 @@ machine_restart(char *restart_cmd)
common_shutdown(LINUX_REBOOT_CMD_RESTART, restart_cmd);
}

EXPORT_SYMBOL(machine_restart);

void
machine_halt(void)
{
common_shutdown(LINUX_REBOOT_CMD_HALT, NULL);
}

EXPORT_SYMBOL(machine_halt);

void
machine_power_off(void)
{
common_shutdown(LINUX_REBOOT_CMD_POWER_OFF, NULL);
}

EXPORT_SYMBOL(machine_power_off);

/* Used by sysrq-p, among others. I don't believe r9-r15 are ever
saved in the context it's used. */
Expand Down
4 changes: 0 additions & 4 deletions arch/arm/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,13 @@ void machine_halt(void)
{
}

EXPORT_SYMBOL(machine_halt);

void machine_power_off(void)
{
if (pm_power_off)
pm_power_off();
}

EXPORT_SYMBOL(machine_power_off);

void machine_restart(char * __unused)
{
Expand Down Expand Up @@ -169,8 +167,6 @@ void machine_restart(char * __unused)
while (1);
}

EXPORT_SYMBOL(machine_restart);

void __show_regs(struct pt_regs *regs)
{
unsigned long flags = condition_codes(regs);
Expand Down
5 changes: 0 additions & 5 deletions arch/arm26/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ void machine_power_off(void)
{
}

EXPORT_SYMBOL(machine_halt);
EXPORT_SYMBOL(machine_power_off);

void machine_restart(char * __unused)
{
/*
Expand Down Expand Up @@ -136,8 +133,6 @@ void machine_restart(char * __unused)
while (1);
}

EXPORT_SYMBOL(machine_restart);

void show_regs(struct pt_regs * regs)
{
unsigned long flags;
Expand Down
6 changes: 0 additions & 6 deletions arch/cris/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,6 @@ void machine_restart(char *cmd)
hard_reset_now();
}

EXPORT_SYMBOL(machine_restart);

/*
* Similar to machine_power_off, but don't shut off power. Add code
* here to freeze the system for e.g. post-mortem debug purpose when
Expand All @@ -226,16 +224,12 @@ void machine_halt(void)
{
}

EXPORT_SYMBOL(machine_halt);

/* If or when software power-off is implemented, add code here. */

void machine_power_off(void)
{
}

EXPORT_SYMBOL(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.
Expand Down
6 changes: 0 additions & 6 deletions arch/h8300/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,26 +90,20 @@ void machine_restart(char * __unused)
__asm__("jmp @@0");
}

EXPORT_SYMBOL(machine_restart);

void machine_halt(void)
{
local_irq_disable();
__asm__("sleep");
for (;;);
}

EXPORT_SYMBOL(machine_halt);

void machine_power_off(void)
{
local_irq_disable();
__asm__("sleep");
for (;;);
}

EXPORT_SYMBOL(machine_power_off);

void show_regs(struct pt_regs * regs)
{
printk("\nPC: %08lx Status: %02x",
Expand Down
5 changes: 0 additions & 5 deletions arch/i386/kernel/reboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,10 @@ void machine_restart(char * __unused)
machine_real_restart(jump_to_bios, sizeof(jump_to_bios));
}

EXPORT_SYMBOL(machine_restart);

void machine_halt(void)
{
}

EXPORT_SYMBOL(machine_halt);

void machine_power_off(void)
{
lapic_shutdown();
Expand All @@ -355,5 +351,4 @@ void machine_power_off(void)
pm_power_off();
}

EXPORT_SYMBOL(machine_power_off);

5 changes: 0 additions & 5 deletions arch/i386/mach-visws/reboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ void machine_restart(char * __unused)
outb(PIIX4_RESET_VAL, PIIX4_RESET_PORT);
}

EXPORT_SYMBOL(machine_restart);

void machine_power_off(void)
{
unsigned short pm_status;
Expand All @@ -43,10 +41,7 @@ void machine_power_off(void)
outl(PIIX_SPECIAL_STOP, 0xCFC);
}

EXPORT_SYMBOL(machine_power_off);

void machine_halt(void)
{
}

EXPORT_SYMBOL(machine_halt);
5 changes: 0 additions & 5 deletions arch/i386/mach-voyager/voyager_basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,6 @@ machine_restart(char *cmd)
}
}

EXPORT_SYMBOL(machine_restart);

void
mca_nmi_hook(void)
{
Expand Down Expand Up @@ -315,12 +313,9 @@ machine_halt(void)
machine_power_off();
}

EXPORT_SYMBOL(machine_halt);

void machine_power_off(void)
{
if (pm_power_off)
pm_power_off();
}

EXPORT_SYMBOL(machine_power_off);
5 changes: 0 additions & 5 deletions arch/ia64/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,16 +807,12 @@ machine_restart (char *restart_cmd)
(*efi.reset_system)(EFI_RESET_WARM, 0, 0, NULL);
}

EXPORT_SYMBOL(machine_restart);

void
machine_halt (void)
{
cpu_halt();
}

EXPORT_SYMBOL(machine_halt);

void
machine_power_off (void)
{
Expand All @@ -825,4 +821,3 @@ machine_power_off (void)
machine_halt();
}

EXPORT_SYMBOL(machine_power_off);
6 changes: 0 additions & 6 deletions arch/m32r/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,24 +115,18 @@ void machine_restart(char *__unused)
cpu_relax();
}

EXPORT_SYMBOL(machine_restart);

void machine_halt(void)
{
printk("Please push reset button!\n");
while (1)
cpu_relax();
}

EXPORT_SYMBOL(machine_halt);

void machine_power_off(void)
{
/* M32R_FIXME */
}

EXPORT_SYMBOL(machine_power_off);

static int __init idle_setup (char *str)
{
if (!strncmp(str, "poll", 4)) {
Expand Down
6 changes: 0 additions & 6 deletions arch/m68k/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,20 @@ void machine_restart(char * __unused)
for (;;);
}

EXPORT_SYMBOL(machine_restart);

void machine_halt(void)
{
if (mach_halt)
mach_halt();
for (;;);
}

EXPORT_SYMBOL(machine_halt);

void machine_power_off(void)
{
if (mach_power_off)
mach_power_off();
for (;;);
}

EXPORT_SYMBOL(machine_power_off);

void show_regs(struct pt_regs * regs)
{
printk("\n");
Expand Down
6 changes: 0 additions & 6 deletions arch/m68knommu/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,26 +80,20 @@ void machine_restart(char * __unused)
for (;;);
}

EXPORT_SYMBOL(machine_restart);

void machine_halt(void)
{
if (mach_halt)
mach_halt();
for (;;);
}

EXPORT_SYMBOL(machine_halt);

void machine_power_off(void)
{
if (mach_power_off)
mach_power_off();
for (;;);
}

EXPORT_SYMBOL(machine_power_off);

void show_regs(struct pt_regs * regs)
{
printk(KERN_NOTICE "\n");
Expand Down
5 changes: 0 additions & 5 deletions arch/mips/kernel/reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,13 @@ void machine_restart(char *command)
_machine_restart(command);
}

EXPORT_SYMBOL(machine_restart);

void machine_halt(void)
{
_machine_halt();
}

EXPORT_SYMBOL(machine_halt);

void machine_power_off(void)
{
_machine_power_off();
}

EXPORT_SYMBOL(machine_power_off);
6 changes: 0 additions & 6 deletions arch/parisc/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ void machine_restart(char *cmd)

}

EXPORT_SYMBOL(machine_restart);

void machine_halt(void)
{
/*
Expand All @@ -160,8 +158,6 @@ void machine_halt(void)
*/
}

EXPORT_SYMBOL(machine_halt);


/*
* This routine is called from sys_reboot to actually turn off the
Expand All @@ -187,8 +183,6 @@ void machine_power_off(void)
KERN_EMERG "Please power this system off now.");
}

EXPORT_SYMBOL(machine_power_off);


/*
* Create a kernel thread
Expand Down
6 changes: 0 additions & 6 deletions arch/ppc/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ void machine_restart(char *cmd)
ppc_md.restart(cmd);
}

EXPORT_SYMBOL(machine_restart);

void machine_power_off(void)
{
#ifdef CONFIG_NVRAM
Expand All @@ -131,8 +129,6 @@ void machine_power_off(void)
ppc_md.power_off();
}

EXPORT_SYMBOL(machine_power_off);

void machine_halt(void)
{
#ifdef CONFIG_NVRAM
Expand All @@ -141,8 +137,6 @@ void machine_halt(void)
ppc_md.halt();
}

EXPORT_SYMBOL(machine_halt);

void (*pm_power_off)(void) = machine_power_off;

#ifdef CONFIG_TAU
Expand Down
3 changes: 0 additions & 3 deletions arch/ppc64/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,6 @@ void machine_restart(char *cmd)
local_irq_disable();
while (1) ;
}
EXPORT_SYMBOL(machine_restart);

void machine_power_off(void)
{
Expand All @@ -707,7 +706,6 @@ void machine_power_off(void)
local_irq_disable();
while (1) ;
}
EXPORT_SYMBOL(machine_power_off);

void machine_halt(void)
{
Expand All @@ -720,7 +718,6 @@ void machine_halt(void)
local_irq_disable();
while (1) ;
}
EXPORT_SYMBOL(machine_halt);

static int ppc64_panic_event(struct notifier_block *this,
unsigned long event, void *ptr)
Expand Down
Loading

0 comments on commit 59586e5

Please sign in to comment.