stm class: Fix link list locking
authorAlexander Shishkin <alexander.shishkin@linux.intel.com>
Tue, 22 Dec 2015 15:25:19 +0000 (17:25 +0200)
committerMathieu Poirier <mathieu.poirier@linaro.org>
Wed, 1 Jun 2016 21:28:40 +0000 (15:28 -0600)
commit0f049c5ab8a7bc839647702fd29c63177f9e7c6b
tree85d1bff227e830dae80c563cb0dca4038e86994f
parentdf313b9ca8b14575387fbe53e5609caacde3e243
stm class: Fix link list locking

Currently, the list of stm_sources linked to an stm device is protected by
a spinlock, which also means that sources' .unlink() method is called under
this spinlock. However, this method may (and does) sleep, which means
trouble.

This patch slightly reworks locking around stm::link_list so that bits that
might_sleep() are called with a mutex held instead. Modification of this
list requires both mutex and spinlock to be held, while looking at the list
can be done under either mutex or spinlock.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit c74f7e8281add80bdfa0ad2998b8df287b13df73)
drivers/hwtracing/stm/core.c
drivers/hwtracing/stm/stm.h