]> err.no Git - linux-2.6/blobdiff - drivers/sbus/char/bbc_envctrl.c
Merge branch 'tracing/for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6] / drivers / sbus / char / bbc_envctrl.c
index 1cc706e111193c9fb7f066416e7f8edd9f3b4a7b..0bde26989a23a2ebaf89251414fe58cf384ea84a 100644 (file)
@@ -4,14 +4,10 @@
  * Copyright (C) 2001 David S. Miller (davem@redhat.com)
  */
 
-#define __KERNEL_SYSCALLS__
-static int errno;
-
-#include <linux/kernel.h>
 #include <linux/kthread.h>
-#include <linux/sched.h>
-#include <linux/slab.h>
 #include <linux/delay.h>
+#include <linux/kmod.h>
+#include <linux/reboot.h>
 #include <asm/oplib.h>
 #include <asm/ebus.h>
 
@@ -175,8 +171,6 @@ static void get_current_temps(struct bbc_cpu_temperature *tp)
 static void do_envctrl_shutdown(struct bbc_cpu_temperature *tp)
 {
        static int shutting_down = 0;
-       static char *envp[] = { "HOME=/", "TERM=linux", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };
-       char *argv[] = { "/sbin/shutdown", "-h", "now", NULL };
        char *type = "???";
        s8 val = -1;
 
@@ -200,7 +194,7 @@ static void do_envctrl_shutdown(struct bbc_cpu_temperature *tp)
        printk(KERN_CRIT "kenvctrld: Shutting down the system now.\n");
 
        shutting_down = 1;
-       if (execve("/sbin/shutdown", argv, envp) < 0)
+       if (orderly_poweroff(true) < 0)
                printk(KERN_CRIT "envctrl: shutdown execution failed\n");
 }
 
@@ -485,11 +479,12 @@ static int kenvctrld(void *__unused)
 
 static void attach_one_temp(struct linux_ebus_child *echild, int temp_idx)
 {
-       struct bbc_cpu_temperature *tp = kmalloc(sizeof(*tp), GFP_KERNEL);
+       struct bbc_cpu_temperature *tp;
 
+       tp = kzalloc(sizeof(*tp), GFP_KERNEL);
        if (!tp)
                return;
-       memset(tp, 0, sizeof(*tp));
+
        tp->client = bbc_i2c_attach(echild);
        if (!tp->client) {
                kfree(tp);
@@ -531,11 +526,12 @@ static void attach_one_temp(struct linux_ebus_child *echild, int temp_idx)
 
 static void attach_one_fan(struct linux_ebus_child *echild, int fan_idx)
 {
-       struct bbc_fan_control *fp = kmalloc(sizeof(*fp), GFP_KERNEL);
+       struct bbc_fan_control *fp;
 
+       fp = kzalloc(sizeof(*fp), GFP_KERNEL);
        if (!fp)
                return;
-       memset(fp, 0, sizeof(*fp));
+
        fp->client = bbc_i2c_attach(echild);
        if (!fp->client) {
                kfree(fp);