Skip to content

Commit

Permalink
thinkpad-acpi: kill hotkey_thread_mutex
Browse files Browse the repository at this point in the history
hotkey_kthread() does try_to_freeze() under hotkey_thread_mutex.

We can simply kill this mutex, hotkey_poll_stop_sync() does not need to
serialize with hotkey_kthread().  When kthread_stop() returns the thread
is already dead, it called do_exit()->complete_vfork_done().

Reported-by: Artem Savkov <[email protected]>
Reported-by: Maciej Rutecki <[email protected]>
Signed-off-by: Oleg Nesterov <[email protected]>
Acked-by: Henrique de Moraes Holschuh <[email protected]>
Cc: Matthew Garrett <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Reviewed-by: Mandeep Singh Baines <[email protected]>
Cc: Aaron Lu <[email protected]>
Cc: Tejun Heo <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
oleg-nesterov authored and torvalds committed Apr 17, 2013
1 parent fca8316 commit 355f1ec
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions drivers/platform/x86/thinkpad_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1964,9 +1964,6 @@ struct tp_nvram_state {
/* kthread for the hotkey poller */
static struct task_struct *tpacpi_hotkey_task;

/* Acquired while the poller kthread is running, use to sync start/stop */
static struct mutex hotkey_thread_mutex;

/*
* Acquire mutex to write poller control variables as an
* atomic block.
Expand Down Expand Up @@ -2462,8 +2459,6 @@ static int hotkey_kthread(void *data)
unsigned int poll_freq;
bool was_frozen;

mutex_lock(&hotkey_thread_mutex);

if (tpacpi_lifecycle == TPACPI_LIFE_EXITING)
goto exit;

Expand Down Expand Up @@ -2523,7 +2518,6 @@ static int hotkey_kthread(void *data)
}

exit:
mutex_unlock(&hotkey_thread_mutex);
return 0;
}

Expand All @@ -2533,9 +2527,6 @@ static void hotkey_poll_stop_sync(void)
if (tpacpi_hotkey_task) {
kthread_stop(tpacpi_hotkey_task);
tpacpi_hotkey_task = NULL;
mutex_lock(&hotkey_thread_mutex);
/* at this point, the thread did exit */
mutex_unlock(&hotkey_thread_mutex);
}
}

Expand Down Expand Up @@ -3234,7 +3225,6 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
mutex_init(&hotkey_mutex);

#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL
mutex_init(&hotkey_thread_mutex);
mutex_init(&hotkey_thread_data_mutex);
#endif

Expand Down

0 comments on commit 355f1ec

Please sign in to comment.