From: Eric W. Biederman This patch modifies startup of the kfand to use kthread_run not a combination of kernel_thread and daemonize, making the code a little simpler and more maintaintable. Cc: Benjamin Herrenschmidt Signed-off-by: Eric W. Biederman Signed-off-by: Andrew Morton --- drivers/macintosh/therm_pm72.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff -puN drivers/macintosh/therm_pm72.c~macintosh-therm_pm72c-partially-convert-to-kthread-api drivers/macintosh/therm_pm72.c --- a/drivers/macintosh/therm_pm72.c~macintosh-therm_pm72c-partially-convert-to-kthread-api +++ a/drivers/macintosh/therm_pm72.c @@ -122,6 +122,7 @@ #include #include #include +#include #include #include #include @@ -162,7 +163,7 @@ static struct slots_pid_state slots_sta static int state; static int cpu_count; static int cpu_pid_type; -static pid_t ctrl_task; +static int ctrl_task; static struct completion ctrl_complete; static int critical_state; static int rackmac; @@ -1780,8 +1781,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); @@ -1860,7 +1859,6 @@ static int main_control_loop(void *x) machine_power_off(); } - // FIXME: Deal with signals elapsed = jiffies - start; if (elapsed < HZ) schedule_timeout_interruptible(HZ - elapsed); @@ -1955,9 +1953,12 @@ static int create_control_loops(void) */ static void start_control_loops(void) { + struct task_struct *task; init_completion(&ctrl_complete); - ctrl_task = kernel_thread(main_control_loop, NULL, SIGCHLD | CLONE_KERNEL); + task = kthread_run(main_control_loop, NULL, "kfand"); + if (!IS_ERR(task)) + ctrl_task = 1; } /* _