hwmon: (adt7470) Allow faster removal
adt7470_remove will wait for the update thread to complete before returning. This had a worst-case time of up to the user-configurable auto_update_interval. Replace msleep_interruptible with set_current_state and schedule_timeout so that kthread_stop will interrupt the sleep. Signed-off-by: Joshua Scott <joshua.scott@alliedtelesis.co.nz> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
parent
feca3132d9
commit
93cacfd41f
1 changed files with 4 additions and 1 deletions
|
@ -273,9 +273,12 @@ static int adt7470_update_thread(void *p)
|
||||||
mutex_lock(&data->lock);
|
mutex_lock(&data->lock);
|
||||||
adt7470_read_temperatures(client, data);
|
adt7470_read_temperatures(client, data);
|
||||||
mutex_unlock(&data->lock);
|
mutex_unlock(&data->lock);
|
||||||
|
|
||||||
|
set_current_state(TASK_INTERRUPTIBLE);
|
||||||
if (kthread_should_stop())
|
if (kthread_should_stop())
|
||||||
break;
|
break;
|
||||||
msleep_interruptible(data->auto_update_interval);
|
|
||||||
|
schedule_timeout(msecs_to_jiffies(data->auto_update_interval));
|
||||||
}
|
}
|
||||||
|
|
||||||
complete_all(&data->auto_update_stop);
|
complete_all(&data->auto_update_stop);
|
||||||
|
|
Loading…
Add table
Reference in a new issue