diff options
author | Joshua Scott <joshua.scott@alliedtelesis.co.nz> | 2016-09-09 08:19:26 +0300 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2016-09-11 02:21:09 +0300 |
commit | 93cacfd41f82eea00b420d62e29a493ca3d07b74 (patch) | |
tree | f8fde6c4b864e7e1baaa8f83458a8bebf212996f /drivers/hwmon | |
parent | feca3132d9fd9822a28f67c25051efd468174de8 (diff) | |
download | linux-93cacfd41f82eea00b420d62e29a493ca3d07b74.tar.xz |
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>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/adt7470.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c index dbd758be1924..ffe1edc10ef0 100644 --- a/drivers/hwmon/adt7470.c +++ b/drivers/hwmon/adt7470.c @@ -273,9 +273,12 @@ static int adt7470_update_thread(void *p) mutex_lock(&data->lock); adt7470_read_temperatures(client, data); mutex_unlock(&data->lock); + + set_current_state(TASK_INTERRUPTIBLE); if (kthread_should_stop()) break; - msleep_interruptible(data->auto_update_interval); + + schedule_timeout(msecs_to_jiffies(data->auto_update_interval)); } complete_all(&data->auto_update_stop); |