Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 5740
b: refs/heads/master
c: bc24066
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Hellwig authored and David S. Miller committed Aug 9, 2005
1 parent 7626e07 commit b90817f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 218b29e0c3995ee15782de55ad1dd74cce1a728d
refs/heads/master: bc2406684b5929cea5d40b9cc4fd872816956779
39 changes: 10 additions & 29 deletions trunk/drivers/sbus/char/bbc_envctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#define __KERNEL_SYSCALLS__

#include <linux/kernel.h>
#include <linux/kthread.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/delay.h>
Expand Down Expand Up @@ -459,18 +460,14 @@ static struct task_struct *kenvctrld_task;

static int kenvctrld(void *__unused)
{
daemonize("kenvctrld");
allow_signal(SIGKILL);
kenvctrld_task = current;

printk(KERN_INFO "bbc_envctrl: kenvctrld starting...\n");
last_warning_jiffies = jiffies - WARN_INTERVAL;
for (;;) {
struct bbc_cpu_temperature *tp;
struct bbc_fan_control *fp;

msleep_interruptible(POLL_INTERVAL);
if (signal_pending(current))
if (kthread_should_stop())
break;

for (tp = all_bbc_temps; tp; tp = tp->next) {
Expand Down Expand Up @@ -577,17 +574,20 @@ int bbc_envctrl_init(void)
int temp_index = 0;
int fan_index = 0;
int devidx = 0;
int err = 0;

while ((echild = bbc_i2c_getdev(devidx++)) != NULL) {
if (!strcmp(echild->prom_name, "temperature"))
attach_one_temp(echild, temp_index++);
if (!strcmp(echild->prom_name, "fan-control"))
attach_one_fan(echild, fan_index++);
}
if (temp_index != 0 && fan_index != 0)
err = kernel_thread(kenvctrld, NULL, CLONE_FS | CLONE_FILES);
return err;
if (temp_index != 0 && fan_index != 0) {
kenvctrld_task = kthread_run(kenvctrld, NULL, "kenvctrld");
if (IS_ERR(kenvctrld_task))
return PTR_ERR(kenvctrld_task);
}

return 0;
}

static void destroy_one_temp(struct bbc_cpu_temperature *tp)
Expand All @@ -607,26 +607,7 @@ void bbc_envctrl_cleanup(void)
struct bbc_cpu_temperature *tp;
struct bbc_fan_control *fp;

if (kenvctrld_task != NULL) {
force_sig(SIGKILL, kenvctrld_task);
for (;;) {
struct task_struct *p;
int found = 0;

read_lock(&tasklist_lock);
for_each_process(p) {
if (p == kenvctrld_task) {
found = 1;
break;
}
}
read_unlock(&tasklist_lock);
if (!found)
break;
msleep(1000);
}
kenvctrld_task = NULL;
}
kthread_stop(kenvctrld_task);

tp = all_bbc_temps;
while (tp != NULL) {
Expand Down

0 comments on commit b90817f

Please sign in to comment.