diff options
author | Ranjani Sridharan <ranjani.sridharan@linux.intel.com> | 2019-04-05 09:57:08 -0700 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-04-08 14:15:44 +0700 |
commit | b4ed6b51f356224c6c71540ed94087f7f09b84af (patch) | |
tree | 9f3a875aec0d01095919ca9b8517d74d168b74fe /include/sound | |
parent | 17d3069ccf06970e2db3f7cbf4335f207524279e (diff) | |
download | linux-b4ed6b51f356224c6c71540ed94087f7f09b84af.tar.gz linux-b4ed6b51f356224c6c71540ed94087f7f09b84af.tar.bz2 linux-b4ed6b51f356224c6c71540ed94087f7f09b84af.zip |
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>
Diffstat (limited to 'include/sound')
-rw-r--r-- | include/sound/soc.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h index 1e2be35ed36f..482b4ea87c3c 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -802,8 +802,13 @@ struct snd_soc_component_driver { int probe_order; int remove_order; - /* signal if the module handling the component cannot be removed */ - unsigned int ignore_module_refcount:1; + /* + * signal if the module handling the component should not be removed + * if a pcm is open. Setting this would prevent the module + * refcount being incremented in probe() but allow it be incremented + * when a pcm is opened and decremented when it is closed. + */ + unsigned int module_get_upon_open:1; /* bits */ unsigned int idle_bias_on:1; |