ASoC: core: conditionally increase module refcount on component open
authorRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Fri, 5 Apr 2019 16:57:08 +0000 (09:57 -0700)
committerMark Brown <broonie@kernel.org>
Mon, 8 Apr 2019 07:15:44 +0000 (14:15 +0700)
commitb4ed6b51f356224c6c71540ed94087f7f09b84af
tree9f3a875aec0d01095919ca9b8517d74d168b74fe
parent17d3069ccf06970e2db3f7cbf4335f207524279e
ASoC: core: conditionally increase module refcount on component open

Recently, for Intel platforms the "ignore_module_refcount" field
was introduced for the component driver. In order to avoid a
deadlock preventing the PCI modules from being removed
even when the card was idle, the refcounts were not incremented
for the device driver module during component probe.

However, this change introduced a nasty side effect:
the device driver module can be unloaded while a pcm stream is open.

This patch proposes to change the field to be renamed as
"module_get_upon_open". When this field is set, the module
refcount should be incremented on pcm open amd decremented
upon pcm close. This will enable modules to be removed
when no PCM playback/capture happens and prevent removal
when the component is actually in use.

Also, align with the skylake component driver with the new name.

Fixes: b450b878('ASoC: core: don't increase component module refcount
                 unconditionally'
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc.h
sound/soc/intel/skylake/skl-pcm.c
sound/soc/soc-core.c