Merge with master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
This commit is contained in:
+4
-5
@@ -111,12 +111,11 @@ NORET_TYPE void panic(const char * fmt, ...)
|
||||
mdelay(1);
|
||||
i++;
|
||||
}
|
||||
/*
|
||||
* Should we run the reboot notifier. For the moment Im
|
||||
* choosing not too. It might crash, be corrupt or do
|
||||
* more harm than good for other reasons.
|
||||
/* This will not be a clean reboot, with everything
|
||||
* shutting down. But if there is a chance of
|
||||
* rebooting the system it will be rebooted.
|
||||
*/
|
||||
machine_restart(NULL);
|
||||
emergency_restart();
|
||||
}
|
||||
#ifdef __sparc__
|
||||
{
|
||||
|
||||
+3
-6
@@ -59,16 +59,13 @@ static void power_down(suspend_disk_method_t mode)
|
||||
error = pm_ops->enter(PM_SUSPEND_DISK);
|
||||
break;
|
||||
case PM_DISK_SHUTDOWN:
|
||||
printk("Powering off system\n");
|
||||
device_shutdown();
|
||||
machine_power_off();
|
||||
kernel_power_off();
|
||||
break;
|
||||
case PM_DISK_REBOOT:
|
||||
device_shutdown();
|
||||
machine_restart(NULL);
|
||||
kernel_restart(NULL);
|
||||
break;
|
||||
}
|
||||
machine_halt();
|
||||
kernel_halt();
|
||||
/* Valid image is on the disk, if we continue we risk serious data corruption
|
||||
after resume. */
|
||||
printk(KERN_CRIT "Please power me down manually\n");
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/reboot.h>
|
||||
|
||||
/*
|
||||
* When the user hits Sys-Rq o to power down the machine this is the
|
||||
@@ -17,8 +18,7 @@
|
||||
|
||||
static void do_poweroff(void *dummy)
|
||||
{
|
||||
if (pm_power_off)
|
||||
pm_power_off();
|
||||
kernel_power_off();
|
||||
}
|
||||
|
||||
static DECLARE_WORK(poweroff_work, do_poweroff, NULL);
|
||||
|
||||
+5
-3
@@ -3486,7 +3486,7 @@ static void __setscheduler(struct task_struct *p, int policy, int prio)
|
||||
p->policy = policy;
|
||||
p->rt_priority = prio;
|
||||
if (policy != SCHED_NORMAL)
|
||||
p->prio = MAX_USER_RT_PRIO-1 - p->rt_priority;
|
||||
p->prio = MAX_RT_PRIO-1 - p->rt_priority;
|
||||
else
|
||||
p->prio = p->static_prio;
|
||||
}
|
||||
@@ -3518,7 +3518,8 @@ recheck:
|
||||
* 1..MAX_USER_RT_PRIO-1, valid priority for SCHED_NORMAL is 0.
|
||||
*/
|
||||
if (param->sched_priority < 0 ||
|
||||
param->sched_priority > MAX_USER_RT_PRIO-1)
|
||||
(p->mm && param->sched_priority > MAX_USER_RT_PRIO-1) ||
|
||||
(!p->mm && param->sched_priority > MAX_RT_PRIO-1))
|
||||
return -EINVAL;
|
||||
if ((policy == SCHED_NORMAL) != (param->sched_priority == 0))
|
||||
return -EINVAL;
|
||||
@@ -3528,7 +3529,8 @@ recheck:
|
||||
*/
|
||||
if (!capable(CAP_SYS_NICE)) {
|
||||
/* can't change policy */
|
||||
if (policy != p->policy)
|
||||
if (policy != p->policy &&
|
||||
!p->signal->rlim[RLIMIT_RTPRIO].rlim_cur)
|
||||
return -EPERM;
|
||||
/* can't increase priority */
|
||||
if (policy != SCHED_NORMAL &&
|
||||
|
||||
+71
-42
@@ -361,6 +361,68 @@ out_unlock:
|
||||
return retval;
|
||||
}
|
||||
|
||||
void emergency_restart(void)
|
||||
{
|
||||
machine_emergency_restart();
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(emergency_restart);
|
||||
|
||||
void kernel_restart(char *cmd)
|
||||
{
|
||||
notifier_call_chain(&reboot_notifier_list, SYS_RESTART, cmd);
|
||||
system_state = SYSTEM_RESTART;
|
||||
device_suspend(PMSG_FREEZE);
|
||||
device_shutdown();
|
||||
if (!cmd) {
|
||||
printk(KERN_EMERG "Restarting system.\n");
|
||||
} else {
|
||||
printk(KERN_EMERG "Restarting system with command '%s'.\n", cmd);
|
||||
}
|
||||
printk(".\n");
|
||||
machine_restart(cmd);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kernel_restart);
|
||||
|
||||
void kernel_kexec(void)
|
||||
{
|
||||
#ifdef CONFIG_KEXEC
|
||||
struct kimage *image;
|
||||
image = xchg(&kexec_image, 0);
|
||||
if (!image) {
|
||||
return;
|
||||
}
|
||||
notifier_call_chain(&reboot_notifier_list, SYS_RESTART, NULL);
|
||||
system_state = SYSTEM_RESTART;
|
||||
device_suspend(PMSG_FREEZE);
|
||||
device_shutdown();
|
||||
printk(KERN_EMERG "Starting new kernel\n");
|
||||
machine_shutdown();
|
||||
machine_kexec(image);
|
||||
#endif
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kernel_kexec);
|
||||
|
||||
void kernel_halt(void)
|
||||
{
|
||||
notifier_call_chain(&reboot_notifier_list, SYS_HALT, NULL);
|
||||
system_state = SYSTEM_HALT;
|
||||
device_suspend(PMSG_SUSPEND);
|
||||
device_shutdown();
|
||||
printk(KERN_EMERG "System halted.\n");
|
||||
machine_halt();
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kernel_halt);
|
||||
|
||||
void kernel_power_off(void)
|
||||
{
|
||||
notifier_call_chain(&reboot_notifier_list, SYS_POWER_OFF, NULL);
|
||||
system_state = SYSTEM_POWER_OFF;
|
||||
device_suspend(PMSG_SUSPEND);
|
||||
device_shutdown();
|
||||
printk(KERN_EMERG "Power down.\n");
|
||||
machine_power_off();
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kernel_power_off);
|
||||
|
||||
/*
|
||||
* Reboot system call: for obvious reasons only root may call it,
|
||||
@@ -389,11 +451,7 @@ asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void __user
|
||||
lock_kernel();
|
||||
switch (cmd) {
|
||||
case LINUX_REBOOT_CMD_RESTART:
|
||||
notifier_call_chain(&reboot_notifier_list, SYS_RESTART, NULL);
|
||||
system_state = SYSTEM_RESTART;
|
||||
device_shutdown();
|
||||
printk(KERN_EMERG "Restarting system.\n");
|
||||
machine_restart(NULL);
|
||||
kernel_restart(NULL);
|
||||
break;
|
||||
|
||||
case LINUX_REBOOT_CMD_CAD_ON:
|
||||
@@ -405,23 +463,13 @@ asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void __user
|
||||
break;
|
||||
|
||||
case LINUX_REBOOT_CMD_HALT:
|
||||
notifier_call_chain(&reboot_notifier_list, SYS_HALT, NULL);
|
||||
system_state = SYSTEM_HALT;
|
||||
device_suspend(PMSG_SUSPEND);
|
||||
device_shutdown();
|
||||
printk(KERN_EMERG "System halted.\n");
|
||||
machine_halt();
|
||||
kernel_halt();
|
||||
unlock_kernel();
|
||||
do_exit(0);
|
||||
break;
|
||||
|
||||
case LINUX_REBOOT_CMD_POWER_OFF:
|
||||
notifier_call_chain(&reboot_notifier_list, SYS_POWER_OFF, NULL);
|
||||
system_state = SYSTEM_POWER_OFF;
|
||||
device_suspend(PMSG_SUSPEND);
|
||||
device_shutdown();
|
||||
printk(KERN_EMERG "Power down.\n");
|
||||
machine_power_off();
|
||||
kernel_power_off();
|
||||
unlock_kernel();
|
||||
do_exit(0);
|
||||
break;
|
||||
@@ -433,32 +481,14 @@ asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void __user
|
||||
}
|
||||
buffer[sizeof(buffer) - 1] = '\0';
|
||||
|
||||
notifier_call_chain(&reboot_notifier_list, SYS_RESTART, buffer);
|
||||
system_state = SYSTEM_RESTART;
|
||||
device_suspend(PMSG_FREEZE);
|
||||
device_shutdown();
|
||||
printk(KERN_EMERG "Restarting system with command '%s'.\n", buffer);
|
||||
machine_restart(buffer);
|
||||
kernel_restart(buffer);
|
||||
break;
|
||||
|
||||
#ifdef CONFIG_KEXEC
|
||||
case LINUX_REBOOT_CMD_KEXEC:
|
||||
{
|
||||
struct kimage *image;
|
||||
image = xchg(&kexec_image, 0);
|
||||
if (!image) {
|
||||
unlock_kernel();
|
||||
return -EINVAL;
|
||||
}
|
||||
notifier_call_chain(&reboot_notifier_list, SYS_RESTART, NULL);
|
||||
system_state = SYSTEM_RESTART;
|
||||
device_shutdown();
|
||||
printk(KERN_EMERG "Starting new kernel\n");
|
||||
machine_shutdown();
|
||||
machine_kexec(image);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
kernel_kexec();
|
||||
unlock_kernel();
|
||||
return -EINVAL;
|
||||
|
||||
#ifdef CONFIG_SOFTWARE_SUSPEND
|
||||
case LINUX_REBOOT_CMD_SW_SUSPEND:
|
||||
{
|
||||
@@ -478,8 +508,7 @@ asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void __user
|
||||
|
||||
static void deferred_cad(void *dummy)
|
||||
{
|
||||
notifier_call_chain(&reboot_notifier_list, SYS_RESTART, NULL);
|
||||
machine_restart(NULL);
|
||||
kernel_restart(NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user