Skip to content

Commit 93cacfd

Browse files
Joshua Scottgroeck
authored andcommitted
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>
1 parent feca313 commit 93cacfd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/hwmon/adt7470.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,12 @@ static int adt7470_update_thread(void *p)
273273
mutex_lock(&data->lock);
274274
adt7470_read_temperatures(client, data);
275275
mutex_unlock(&data->lock);
276+
277+
set_current_state(TASK_INTERRUPTIBLE);
276278
if (kthread_should_stop())
277279
break;
278-
msleep_interruptible(data->auto_update_interval);
280+
281+
schedule_timeout(msecs_to_jiffies(data->auto_update_interval));
279282
}
280283

281284
complete_all(&data->auto_update_stop);

0 commit comments

Comments
 (0)