Re: [PATCH v2 3/9] ASoC: audio-graph: Identify 'no_pcm' DAI links for DPCM

From: Kuninori Morimoto
Date: Tue Aug 25 2020 - 00:54:31 EST



Hi Sameer

> +static bool soc_component_is_pcm(struct snd_soc_dai_link_component *dlc)
> +{
> + struct snd_soc_dai *dai = snd_soc_find_dai(dlc);
> +
> + if (dai && (dai->component->driver->pcm_construct ||
> + dai->driver->pcm_new))
> + return true;
> +
> + return false;
> +}
(snip)
> I tried testing this with LOCKDEP config enabled at my end.
> It seems I don't see warning originated from above function.
> Are you suggesting that, in general, snd_soc_find_dai()
> should be called with client_mutex held?

Hmm ? strange...

snd_soc_find_dai() is using lockdep_assert_held()

struct snd_soc_dai *snd_soc_find_dai(...)
{
...
=> lockdep_assert_held(&client_mutex);
...
}

and lockdep_assert_held() will indicate WARN_ON()

-- lockdep.h --
...
#ifdef CONFIG_LOCKDEP
...
#define lockdep_assert_held(l) do { \
=> WARN_ON(debug_locks && !lockdep_is_held(l)); \
} while (0)

> May be snd_soc_dai_link_set_capabilities() requires similar fix?

Yes, I'm posting fixup patch.

https://patchwork.kernel.org/patch/11719919/

Thank you for your help !!

Best regards
---
Kuninori Morimoto