ASoC: rt5645: fix kernel hang when call rt5645_set_jack_detect()
Subsystems (3)
PATCH 1/1 ASoC: rt5645: fix kernel hang when call rt5645_set_jack_detect()
rt5645_set_jack_detect() is usually called from snd_soc_dai_link.init() and it calls snd_soc_jack_report() from rt5645_irq_detection() if jack is inserted. snd_soc_jack_report() results in kernel hang if it is called from a context which cannot sleep.
This patch makes sure snd_soc_jack_report() is called from workqueue. It can fix the kernel hang issue.
--- sound/soc/codecs/rt5645.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/codecs/rt5645.c +2 -1
@@ -2876,6 +2876,7 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert) }static int rt5645_irq_detection (struct rt5645_priv *rt5645); +static irqreturn_t rt5645_irq (int irq,void *data); int rt5645_set_jack_detect(struct snd_soc_codec *codec, struct snd_soc_jack *hp_jack, struct snd_soc_jack *mic_jack,
@@ -2895,7 +2896,7 @@ int rt5645_set_jack_detect(struct snd_soc_codec *codec,regmap_update_bits (rt5645->regmap,RT5645_GEN_CTRL1 ,RT5645_DIG_GATE_CTRL ,RT5645_DIG_GATE_CTRL ); } -rt5645_irq_detection (rt5645); +rt5645_irq (0 , rt5645);return 0 ; }
Signature · 1 line
1.8.1.1.439.g50a6b54
Quoted 5 lines · John Lin
rt5645_set_jack_detect()is usually called fromsnd_soc_dai_link.init()and it callssnd_soc_jack_report()fromrt5645_irq_detection()if jack is inserted.snd_soc_jack_report()results in kernel hang if it is called from a context which cannot sleep.
Applied, thanks - I rather suspect this is a case of trying to reacquire the same lock rather than being called from a context that can't sleep though, we shouldn't be doing device init in atomic context.