The kthread_stop() waits for the thread to exit. There is no need for an
additional synchronization needed to join on the kthread.
The completion was added by
89fac11cb3e7 ("adt7470: make automatic fan
control really work").
Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Cc: Darrick J. Wong <djwong@us.ibm.com>
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
u8 pwm_auto_temp[ADT7470_PWM_COUNT];
struct task_struct *auto_update;
u8 pwm_auto_temp[ADT7470_PWM_COUNT];
struct task_struct *auto_update;
- struct completion auto_update_stop;
unsigned int auto_update_interval;
};
unsigned int auto_update_interval;
};
schedule_timeout(msecs_to_jiffies(data->auto_update_interval));
}
schedule_timeout(msecs_to_jiffies(data->auto_update_interval));
}
- complete_all(&data->auto_update_stop);
if (IS_ERR(hwmon_dev))
return PTR_ERR(hwmon_dev);
if (IS_ERR(hwmon_dev))
return PTR_ERR(hwmon_dev);
- init_completion(&data->auto_update_stop);
data->auto_update = kthread_run(adt7470_update_thread, client, "%s",
dev_name(hwmon_dev));
if (IS_ERR(data->auto_update)) {
data->auto_update = kthread_run(adt7470_update_thread, client, "%s",
dev_name(hwmon_dev));
if (IS_ERR(data->auto_update)) {
struct adt7470_data *data = i2c_get_clientdata(client);
kthread_stop(data->auto_update);
struct adt7470_data *data = i2c_get_clientdata(client);
kthread_stop(data->auto_update);
- wait_for_completion(&data->auto_update_stop);