aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/thermal.c24
-rw-r--r--drivers/sbus/char/bbc_envctrl.c5
-rw-r--r--drivers/sbus/char/envctrl.c7
3 files changed, 6 insertions, 30 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 88a6fc7fd271..58f1338981bc 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -40,6 +40,7 @@
40#include <linux/jiffies.h> 40#include <linux/jiffies.h>
41#include <linux/kmod.h> 41#include <linux/kmod.h>
42#include <linux/seq_file.h> 42#include <linux/seq_file.h>
43#include <linux/reboot.h>
43#include <asm/uaccess.h> 44#include <asm/uaccess.h>
44 45
45#include <acpi/acpi_bus.h> 46#include <acpi/acpi_bus.h>
@@ -59,7 +60,6 @@
59#define ACPI_THERMAL_NOTIFY_CRITICAL 0xF0 60#define ACPI_THERMAL_NOTIFY_CRITICAL 0xF0
60#define ACPI_THERMAL_NOTIFY_HOT 0xF1 61#define ACPI_THERMAL_NOTIFY_HOT 0xF1
61#define ACPI_THERMAL_MODE_ACTIVE 0x00 62#define ACPI_THERMAL_MODE_ACTIVE 0x00
62#define ACPI_THERMAL_PATH_POWEROFF "/sbin/poweroff"
63 63
64#define ACPI_THERMAL_MAX_ACTIVE 10 64#define ACPI_THERMAL_MAX_ACTIVE 10
65#define ACPI_THERMAL_MAX_LIMIT_STR_LEN 65 65#define ACPI_THERMAL_MAX_LIMIT_STR_LEN 65
@@ -419,26 +419,6 @@ static int acpi_thermal_get_devices(struct acpi_thermal *tz)
419 return 0; 419 return 0;
420} 420}
421 421
422static int acpi_thermal_call_usermode(char *path)
423{
424 char *argv[2] = { NULL, NULL };
425 char *envp[3] = { NULL, NULL, NULL };
426
427
428 if (!path)
429 return -EINVAL;
430
431 argv[0] = path;
432
433 /* minimal command environment */
434 envp[0] = "HOME=/";
435 envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
436
437 call_usermodehelper(argv[0], argv, envp, 0);
438
439 return 0;
440}
441
442static int acpi_thermal_critical(struct acpi_thermal *tz) 422static int acpi_thermal_critical(struct acpi_thermal *tz)
443{ 423{
444 if (!tz || !tz->trips.critical.flags.valid) 424 if (!tz || !tz->trips.critical.flags.valid)
@@ -456,7 +436,7 @@ static int acpi_thermal_critical(struct acpi_thermal *tz)
456 acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL, 436 acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL,
457 tz->trips.critical.flags.enabled); 437 tz->trips.critical.flags.enabled);
458 438
459 acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF); 439 orderly_poweroff(true);
460 440
461 return 0; 441 return 0;
462} 442}
diff --git a/drivers/sbus/char/bbc_envctrl.c b/drivers/sbus/char/bbc_envctrl.c
index a54e4140683a..e821a155b658 100644
--- a/drivers/sbus/char/bbc_envctrl.c
+++ b/drivers/sbus/char/bbc_envctrl.c
@@ -7,6 +7,7 @@
7#include <linux/kthread.h> 7#include <linux/kthread.h>
8#include <linux/delay.h> 8#include <linux/delay.h>
9#include <linux/kmod.h> 9#include <linux/kmod.h>
10#include <linux/reboot.h>
10#include <asm/oplib.h> 11#include <asm/oplib.h>
11#include <asm/ebus.h> 12#include <asm/ebus.h>
12 13
@@ -170,8 +171,6 @@ static void get_current_temps(struct bbc_cpu_temperature *tp)
170static void do_envctrl_shutdown(struct bbc_cpu_temperature *tp) 171static void do_envctrl_shutdown(struct bbc_cpu_temperature *tp)
171{ 172{
172 static int shutting_down = 0; 173 static int shutting_down = 0;
173 static char *envp[] = { "HOME=/", "TERM=linux", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };
174 char *argv[] = { "/sbin/shutdown", "-h", "now", NULL };
175 char *type = "???"; 174 char *type = "???";
176 s8 val = -1; 175 s8 val = -1;
177 176
@@ -195,7 +194,7 @@ static void do_envctrl_shutdown(struct bbc_cpu_temperature *tp)
195 printk(KERN_CRIT "kenvctrld: Shutting down the system now.\n"); 194 printk(KERN_CRIT "kenvctrld: Shutting down the system now.\n");
196 195
197 shutting_down = 1; 196 shutting_down = 1;
198 if (call_usermodehelper("/sbin/shutdown", argv, envp, 0) < 0) 197 if (orderly_poweroff(true) < 0)
199 printk(KERN_CRIT "envctrl: shutdown execution failed\n"); 198 printk(KERN_CRIT "envctrl: shutdown execution failed\n");
200} 199}
201 200
diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c
index 8328acab47fd..dadabef116b6 100644
--- a/drivers/sbus/char/envctrl.c
+++ b/drivers/sbus/char/envctrl.c
@@ -26,6 +26,7 @@
26#include <linux/ioport.h> 26#include <linux/ioport.h>
27#include <linux/miscdevice.h> 27#include <linux/miscdevice.h>
28#include <linux/kmod.h> 28#include <linux/kmod.h>
29#include <linux/reboot.h>
29 30
30#include <asm/ebus.h> 31#include <asm/ebus.h>
31#include <asm/uaccess.h> 32#include <asm/uaccess.h>
@@ -966,10 +967,6 @@ static struct i2c_child_t *envctrl_get_i2c_child(unsigned char mon_type)
966static void envctrl_do_shutdown(void) 967static void envctrl_do_shutdown(void)
967{ 968{
968 static int inprog = 0; 969 static int inprog = 0;
969 static char *envp[] = {
970 "HOME=/", "TERM=linux", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };
971 char *argv[] = {
972 "/sbin/shutdown", "-h", "now", NULL };
973 int ret; 970 int ret;
974 971
975 if (inprog != 0) 972 if (inprog != 0)
@@ -977,7 +974,7 @@ static void envctrl_do_shutdown(void)
977 974
978 inprog = 1; 975 inprog = 1;
979 printk(KERN_CRIT "kenvctrld: WARNING: Shutting down the system now.\n"); 976 printk(KERN_CRIT "kenvctrld: WARNING: Shutting down the system now.\n");
980 ret = call_usermodehelper("/sbin/shutdown", argv, envp, 0); 977 ret = orderly_poweroff(true);
981 if (ret < 0) { 978 if (ret < 0) {
982 printk(KERN_CRIT "kenvctrld: WARNING: system shutdown failed!\n"); 979 printk(KERN_CRIT "kenvctrld: WARNING: system shutdown failed!\n");
983 inprog = 0; /* unlikely to succeed, but we could try again */ 980 inprog = 0; /* unlikely to succeed, but we could try again */