ASoC: soc-pcm: serialize BE triggers
authorTakashi Iwai <tiwai@suse.de>
Tue, 7 Dec 2021 17:37:43 +0000 (11:37 -0600)
committerMark Brown <broonie@kernel.org>
Tue, 14 Dec 2021 17:15:46 +0000 (17:15 +0000)
commitb2ae80663008a7662febe7d13f14ea1b2eb0cd51
treed92cb896969d3041cc02ac73a6287cbf86cd3498
parentb7898396f4bbe160f546d0c5e9fa17cca9a7d153
ASoC: soc-pcm: serialize BE triggers

When more than one FE is connected to a BE, e.g. in a mixing use case,
the BE can be triggered multiple times when the FE are opened/started
concurrently. This race condition is problematic in the case of
SoundWire BE dailinks, and this is not desirable in a general
case.

This patch relies on the existing BE PCM lock, which takes atomicity into
account. The locking model assumes that all interactions start with
the FE, so that there is no deadlock between FE and BE locks.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
[test, checkpatch fix and 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-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-pcm.c