提交 9c76958b 编写于 作者: C Cezary Rojewski 提交者: Takashi Iwai

ALSA: hda: Make device usage_count consistent across subsequent probing

AVS HDAudio bus driver does not tie with codec drivers tighly and
snd_hda_codec_device_new() can be called after codec's module reload. In
such case, rpm is forbidden and invoking pm_runtime_forbid()
unconditionally causes device's usage_count to become unbalanced. This
is later caught by WARN_ON() found in sound/soc/hda.c. Detect such
circumstance and bump the usage_count instead.
Signed-off-by: NCezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220706120230.427296-4-cezary.rojewski@intel.comSigned-off-by: NTakashi Iwai <tiwai@suse.de>
上级 0fcc43e2
...@@ -1045,8 +1045,14 @@ int snd_hda_codec_device_new(struct hda_bus *bus, struct snd_card *card, ...@@ -1045,8 +1045,14 @@ int snd_hda_codec_device_new(struct hda_bus *bus, struct snd_card *card,
goto error; goto error;
} }
#ifdef CONFIG_PM
/* PM runtime needs to be enabled later after binding codec */ /* PM runtime needs to be enabled later after binding codec */
pm_runtime_forbid(&codec->core.dev); if (codec->core.dev.power.runtime_auto)
pm_runtime_forbid(&codec->core.dev);
else
/* Keep the usage_count consistent across subsequent probing */
pm_runtime_get_noresume(&codec->core.dev);
#endif
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册