mirror of
https://github.com/torvalds/linux.git
synced 2024-11-13 07:31:45 +00:00
eba2eb2495
snd_soc_card_get_kcontrol() must be holding a read lock on
card->controls_rwsem while walking the controls list.
Compare with snd_ctl_find_numid().
The existing function is renamed snd_soc_card_get_kcontrol_locked()
so that it can be called from contexts that are already holding
card->controls_rwsem (for example, control get/put functions).
There are few direct or indirect callers of
snd_soc_card_get_kcontrol(), and most are safe. Three require
changes, which have been included in this patch:
codecs/cs35l45.c:
cs35l45_activate_ctl() is called from a control put() function so
is changed to call snd_soc_card_get_kcontrol_locked().
codecs/cs35l56.c:
cs35l56_sync_asp1_mixer_widgets_with_firmware() is called from
control get()/put() functions so is changed to call
snd_soc_card_get_kcontrol_locked().
fsl/fsl_xcvr.c:
fsl_xcvr_activate_ctl() is called from three places, one of which
already holds card->controls_rwsem:
1. fsl_xcvr_mode_put(), a control put function, which will
already be holding card->controls_rwsem.
2. fsl_xcvr_startup(), a DAI startup function.
3. fsl_xcvr_shutdown(), a DAI shutdown function.
To fix this, fsl_xcvr_activate_ctl() has been changed to call
snd_soc_card_get_kcontrol_locked() so that it is safe to call
directly from fsl_xcvr_mode_put().
The fsl_xcvr_startup() and fsl_xcvr_shutdown() functions have been
changed to take a read lock on card->controls_rsem() around calls
to fsl_xcvr_activate_ctl(). While this is not very elegant, it
keeps the change small, to avoid this patch creating a large
collateral churn in fsl/fsl_xcvr.c.
Analysis of other callers of snd_soc_card_get_kcontrol() is that
they do not need any changes, they are not holding card->controls_rwsem
when they call snd_soc_card_get_kcontrol().
Direct callers of snd_soc_card_get_kcontrol():
fsl/fsl_spdif.c: fsl_spdif_dai_probe() - DAI probe function
fsl/fsl_micfil.c: voice_detected_fn() - IRQ handler
Indirect callers via soc_component_notify_control():
codecs/cs42l43: cs42l43_mic_shutter() - IRQ handler
codecs/cs42l43: cs42l43_spk_shutter() - IRQ handler
codecs/ak4118.c: ak4118_irq_handler() - IRQ handler
codecs/wm_adsp.c: wm_adsp_write_ctl() - not currently used
Indirect callers via snd_soc_limit_volume():
qcom/sc8280xp.c: sc8280xp_snd_init() - DAIlink init function
ti/rx51.c: rx51_aic34_init() - DAI init function
I don't have hardware to test the fsl/*, qcom/sc828xp.c, ti/rx51.c
and ak4118.c changes.
Backport note:
The fsl/, qcom/, cs35l45, cs35l56 and cs42l43 callers were added
since the Fixes commit so won't all be present on older kernels.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes:
|
||
---|---|---|
.. | ||
efika-audio-fabric.c | ||
eukrea-tlv320.c | ||
fsl_asrc_common.h | ||
fsl_asrc_dma.c | ||
fsl_asrc.c | ||
fsl_asrc.h | ||
fsl_aud2htx.c | ||
fsl_aud2htx.h | ||
fsl_audmix.c | ||
fsl_audmix.h | ||
fsl_dma.c | ||
fsl_dma.h | ||
fsl_easrc.c | ||
fsl_easrc.h | ||
fsl_esai.c | ||
fsl_esai.h | ||
fsl_micfil.c | ||
fsl_micfil.h | ||
fsl_mqs.c | ||
fsl_qmc_audio.c | ||
fsl_rpmsg.c | ||
fsl_rpmsg.h | ||
fsl_sai.c | ||
fsl_sai.h | ||
fsl_spdif.c | ||
fsl_spdif.h | ||
fsl_ssi_dbg.c | ||
fsl_ssi.c | ||
fsl_ssi.h | ||
fsl_utils.c | ||
fsl_utils.h | ||
fsl_xcvr.c | ||
fsl_xcvr.h | ||
fsl-asoc-card.c | ||
imx-audio-rpmsg.c | ||
imx-audmix.c | ||
imx-audmux.c | ||
imx-audmux.h | ||
imx-card.c | ||
imx-es8328.c | ||
imx-hdmi.c | ||
imx-pcm-dma.c | ||
imx-pcm-fiq.c | ||
imx-pcm-rpmsg.c | ||
imx-pcm-rpmsg.h | ||
imx-pcm.h | ||
imx-rpmsg.c | ||
imx-sgtl5000.c | ||
imx-spdif.c | ||
imx-ssi.h | ||
Kconfig | ||
Makefile | ||
mpc5200_dma.c | ||
mpc5200_dma.h | ||
mpc5200_psc_ac97.c | ||
mpc5200_psc_i2s.c | ||
p1022_ds.c | ||
p1022_rdk.c | ||
pcm030-audio-fabric.c |