Skip to content

Commit

Permalink
[POWERPC] Convert therm_pm72.c to use the kthread API
Browse files Browse the repository at this point in the history
This converts the therm_pm72.c driver to use the kthread API.  I
thought about making it use kthread_stop() instead of the `state'
variable and the `ctrl_complete' completion, but that isn't simple and
will require changing the way that `state' is used.

Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Paul Mackerras committed Dec 19, 2007
1 parent c61dace commit 39d183d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/macintosh/therm_pm72.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
#include <linux/reboot.h>
#include <linux/kmod.h>
#include <linux/i2c.h>
#include <linux/kthread.h>
#include <asm/prom.h>
#include <asm/machdep.h>
#include <asm/io.h>
Expand Down Expand Up @@ -161,7 +162,7 @@ static struct slots_pid_state slots_state;
static int state;
static int cpu_count;
static int cpu_pid_type;
static pid_t ctrl_task;
static struct task_struct *ctrl_task;
static struct completion ctrl_complete;
static int critical_state;
static int rackmac;
Expand Down Expand Up @@ -1779,8 +1780,6 @@ static int call_critical_overtemp(void)
*/
static int main_control_loop(void *x)
{
daemonize("kfand");

DBG("main_control_loop started\n");

down(&driver_lock);
Expand Down Expand Up @@ -1956,15 +1955,15 @@ static void start_control_loops(void)
{
init_completion(&ctrl_complete);

ctrl_task = kernel_thread(main_control_loop, NULL, SIGCHLD | CLONE_KERNEL);
ctrl_task = kthread_run(main_control_loop, NULL, "kfand");
}

/*
* Stop the control loops when tearing down
*/
static void stop_control_loops(void)
{
if (ctrl_task != 0)
if (ctrl_task)
wait_for_completion(&ctrl_complete);
}

Expand Down

0 comments on commit 39d183d

Please sign in to comment.