X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fsbus%2Fchar%2Fbbc_envctrl.c;h=0bde26989a23a2ebaf89251414fe58cf384ea84a;hb=9fec6060d9e48ed7db0dac0e16d0f0f0e615b7f6;hp=d27e4f6d7045a3a5f21e38d6bab32455d83c3d8a;hpb=b4a9071af62f95dc6d22040a0b37ac7225ce4d54;p=linux-2.6 diff --git a/drivers/sbus/char/bbc_envctrl.c b/drivers/sbus/char/bbc_envctrl.c index d27e4f6d70..0bde26989a 100644 --- a/drivers/sbus/char/bbc_envctrl.c +++ b/drivers/sbus/char/bbc_envctrl.c @@ -4,11 +4,10 @@ * Copyright (C) 2001 David S. Miller (davem@redhat.com) */ -#include #include -#include -#include #include +#include +#include #include #include @@ -172,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; @@ -197,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 (kernel_execve("/sbin/shutdown", argv, envp) < 0) + if (orderly_poweroff(true) < 0) printk(KERN_CRIT "envctrl: shutdown execution failed\n"); } @@ -482,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); @@ -528,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);