Merge branch 'linus' into x86/urgent
[pandora-kernel.git] / drivers / sbus / char / envctrl.c
index 2cea4f5..a408402 100644 (file)
 #include <linux/ioport.h>
 #include <linux/miscdevice.h>
 #include <linux/kmod.h>
+#include <linux/reboot.h>
+#include <linux/smp_lock.h>
 
 #include <asm/ebus.h>
 #include <asm/uaccess.h>
 #include <asm/envctrl.h>
+#include <asm/io.h>
 
 #define ENVCTRL_MINOR  162
 
@@ -692,6 +695,7 @@ envctrl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 static int
 envctrl_open(struct inode *inode, struct file *file)
 {
+       cycle_kernel_lock();
        file->private_data = NULL;
        return 0;
 }
@@ -726,7 +730,7 @@ static struct miscdevice envctrl_dev = {
  * Return: None.
  */
 static void envctrl_set_mon(struct i2c_child_t *pchild,
-                           char *chnl_desc,
+                           const char *chnl_desc,
                            int chnl_no)
 {
        /* Firmware only has temperature type.  It does not distinguish
@@ -763,8 +767,8 @@ static void envctrl_set_mon(struct i2c_child_t *pchild,
 static void envctrl_init_adc(struct i2c_child_t *pchild, struct device_node *dp)
 {
        int i = 0, len;
-       char *pos;
-       unsigned int *pval;
+       const char *pos;
+       const unsigned int *pval;
 
        /* Firmware describe channels into a stream separated by a '\0'. */
        pos = of_get_property(dp, "channels-description", &len);
@@ -859,7 +863,7 @@ static void envctrl_init_i2c_child(struct linux_ebus_child *edev_child,
 {
        int len, i, tbls_size = 0;
        struct device_node *dp = edev_child->prom_node;
-       void *pval;
+       const void *pval;
 
        /* Get device address. */
        pval = of_get_property(dp, "reg", &len);
@@ -965,10 +969,6 @@ static struct i2c_child_t *envctrl_get_i2c_child(unsigned char mon_type)
 static void envctrl_do_shutdown(void)
 {
        static int inprog = 0;
-       static char *envp[] = { 
-               "HOME=/", "TERM=linux", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };
-       char *argv[] = { 
-               "/sbin/shutdown", "-h", "now", NULL };  
        int ret;
 
        if (inprog != 0)
@@ -976,7 +976,7 @@ static void envctrl_do_shutdown(void)
 
        inprog = 1;
        printk(KERN_CRIT "kenvctrld: WARNING: Shutting down the system now.\n");
-       ret = call_usermodehelper("/sbin/shutdown", argv, envp, 0);
+       ret = orderly_poweroff(true);
        if (ret < 0) {
                printk(KERN_CRIT "kenvctrld: WARNING: system shutdown failed!\n"); 
                inprog = 0;  /* unlikely to succeed, but we could try again */