All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: rt5645: fix kernel hang when call rt5645_set_jack_detect()
@ 2015-05-18  2:34 John Lin
  2015-05-19 12:11 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: John Lin @ 2015-05-18  2:34 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: oder_chiou, alsa-devel, zhengxing, yang.a.fang, koro.chen,
	john.lin, bardliao, flove

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.

Signed-off-by: John Lin <john.lin@realtek.com>
---
 sound/soc/codecs/rt5645.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 14b12c5..aaede45 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -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;
 }
-- 
1.8.1.1.439.g50a6b54

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: rt5645: fix kernel hang when call rt5645_set_jack_detect()
  2015-05-18  2:34 [PATCH] ASoC: rt5645: fix kernel hang when call rt5645_set_jack_detect() John Lin
@ 2015-05-19 12:11 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2015-05-19 12:11 UTC (permalink / raw)
  To: John Lin
  Cc: oder_chiou, alsa-devel, zhengxing, yang.a.fang, koro.chen,
	lgirdwood, bardliao, flove


[-- Attachment #1.1: Type: text/plain, Size: 526 bytes --]

On Mon, May 18, 2015 at 10:34:03AM +0800, John Lin wrote:
> 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.

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.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-19 12:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-18  2:34 [PATCH] ASoC: rt5645: fix kernel hang when call rt5645_set_jack_detect() John Lin
2015-05-19 12:11 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.