]> git.karo-electronics.de Git - linux-beck.git/commitdiff
hwmon: (adt7470) Allow faster removal
authorJoshua Scott <joshua.scott@alliedtelesis.co.nz>
Fri, 9 Sep 2016 05:19:26 +0000 (17:19 +1200)
committerGuenter Roeck <linux@roeck-us.net>
Sat, 10 Sep 2016 23:21:09 +0000 (16:21 -0700)
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>
drivers/hwmon/adt7470.c

index dbd758be1924cf7a463be279158acbfd24a62143..ffe1edc10ef05f0fb5c556ede00f7febd140f7ff 100644 (file)
@@ -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);