]> git.baikalelectronics.ru Git - kernel.git/commit
ASoC: soc-pcm: Fix and cleanup DPCM locking
authorTakashi Iwai <tiwai@suse.de>
Tue, 7 Dec 2021 17:37:42 +0000 (11:37 -0600)
committerMark Brown <broonie@kernel.org>
Tue, 14 Dec 2021 17:15:45 +0000 (17:15 +0000)
commitdc62d188e0da6d6f243f5db4790c654e8d1b8640
treea5c9444e4a461bdf7b7e819f2c9ef23ed7a46ddb
parentfef301b5d9681275aa8fd9d50dbef80db44a8266
ASoC: soc-pcm: Fix and cleanup DPCM locking

The existing locking for DPCM has several issues
a) a confusing mix of card->mutex and card->pcm_mutex.
b) a dpcm_lock spinlock added inconsistently and on paths that could
be recursively taken. The use of irqsave/irqrestore was also overkill.

The suggested model is:

1) The pcm_mutex is the top-most protection of BE links in the FE. The
pcm_mutex is applied always on either the top PCM callbacks or the
external call from DAPM, not taken in the internal functions.

2) the FE stream lock is taken in higher levels before invoking
dpcm_be_dai_trigger()

3) when adding and deleting a BE, both the pcm_mutex and FE stream
lock are taken.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
[clarification of commit message by plbossart]
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211207173745.15850-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc.h
sound/soc/soc-core.c
sound/soc/soc-pcm.c