linux_dsm_epyc7002/sound/soc
Kuninori Morimoto 20d9fdee72
ASoC: soc-core: add snd_soc_find_dai_with_mutex()
commit 25612477d2 ("ASoC: soc-dai: set dai_link dpcm_ flags with a helper")
added snd_soc_dai_link_set_capabilities().
But it is using snd_soc_find_dai() (A) which is required client_mutex (B).
And client_mutex is soc-core.c local.

	struct snd_soc_dai *snd_soc_find_dai(xxx)
	{
		...
(B)		lockdep_assert_held(&client_mutex);
		...
	}

	void snd_soc_dai_link_set_capabilities(xxx)
	{
		...
		for_each_pcm_streams(direction) {
			...
			for_each_link_cpus(dai_link, i, cpu) {
(A)				dai = snd_soc_find_dai(cpu);
				...
			}
			...
			for_each_link_codecs(dai_link, i, codec) {
(A)				dai = snd_soc_find_dai(codec);
				...
			}
		}
		...
	}

Because of these background, we will get WARNING if .config has CONFIG_LOCKDEP.

	WARNING: CPU: 2 PID: 53 at sound/soc/soc-core.c:814 snd_soc_find_dai+0xf8/0x100
	CPU: 2 PID: 53 Comm: kworker/2:1 Not tainted 5.7.0-rc1+ #328
	Hardware name: Renesas H3ULCB Kingfisher board based on r8a77951 (DT)
	Workqueue: events deferred_probe_work_func
	pstate: 60000005 (nZCv daif -PAN -UAO)
	pc : snd_soc_find_dai+0xf8/0x100
	lr : snd_soc_find_dai+0xf4/0x100
	...
	Call trace:
	 snd_soc_find_dai+0xf8/0x100
	 snd_soc_dai_link_set_capabilities+0xa0/0x16c
	 graph_dai_link_of_dpcm+0x390/0x3c0
	 graph_for_each_link+0x134/0x200
	 graph_probe+0x144/0x230
	 platform_drv_probe+0x5c/0xb0
	 really_probe+0xe4/0x430
	 driver_probe_device+0x60/0xf4

snd_soc_find_dai() will be used from (X) CPU/Codec/Platform driver with
mutex lock, and (Y) Card driver without mutex lock.
This snd_soc_dai_link_set_capabilities() is for Card driver,
this means called without mutex.
This patch adds snd_soc_find_dai_with_mutex() to solve it.

Fixes: 25612477d2 ("ASoC: soc-dai: set dai_link dpcm_ flags with a helper")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87blixvuab.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-28 11:38:23 +01:00
..
adi
amd ASoC: amd: Replacing component->name with codec_dai->name. 2020-08-10 18:42:48 +01:00
atmel
au1x
bcm
cirrus
codecs ASoC: rt700: Fix return check for devm_regmap_init_sdw() 2020-08-26 18:58:43 +01:00
dwc
fsl ASoC: Fixes for v5.9 2020-08-19 08:03:04 +02:00
generic
hisilicon
img
intel ASoC: Intel: tgl_max98373: fix a runtime pm issue in multi-thread case 2020-08-24 20:15:14 +01:00
jz4740
kirkwood
mediatek
meson
mxs
pxa
qcom ASoC: qcom: common: Fix refcount imbalance on error 2020-08-26 19:26:58 +01:00
rockchip
samsung
sh
sirf
sof
spear
sprd
sti
stm
sunxi
tegra
ti ASoC: ti: fixup ams_delta_mute() function name 2020-08-25 18:47:04 +01:00
txx9
uniphier
ux500
xilinx
xtensa
zte
Kconfig
Makefile
soc-ac97.c
soc-acpi.c
soc-card.c
soc-component.c ASoC: Make soc_component_read() returning an error code again 2020-08-11 14:05:46 +01:00
soc-compress.c
soc-core.c ASoC: soc-core: add snd_soc_find_dai_with_mutex() 2020-08-28 11:38:23 +01:00
soc-dai.c ASoC: soc-core: add snd_soc_find_dai_with_mutex() 2020-08-28 11:38:23 +01:00
soc-dapm.c
soc-devres.c
soc-generic-dmaengine-pcm.c
soc-jack.c
soc-link.c
soc-ops.c
soc-pcm.c
soc-topology.c
soc-utils.c