dmic: change spin_lock to spin_try_lock in dmic_work()

In order to avoid dead locks in dmic_work I've replaced
spin_lock() with spin_try_lock(). In case when
spin_try_lock() fails we reschedule dmic work.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
This commit is contained in:
Bartosz Kokoszko 2019-11-08 11:09:51 +01:00 committed by Liam Girdwood
parent b03e15a765
commit 6a0cf6740f
1 changed files with 8 additions and 1 deletions

View File

@ -159,9 +159,16 @@ static enum task_state dmic_work(void *data)
int32_t gval;
uint32_t val;
int i;
int ret;
tracev_dmic("dmic_work()");
spin_lock(dai->lock);
spin_try_lock(dai->lock, ret);
if (!ret) {
tracev_dmic("dmic_work(): spin_try_lock(dai->lock, ret)"
"failed: RESCHEDULE");
return SOF_TASK_STATE_RESCHEDULE;
}
/* Increment gain with logarithmic step.
* Gain is Q2.30 and gain modifier is Q12.20.