Re: [PATCH 4/8] ASoC: rt5640: Fix sleep in atomic context

From: Sameer Pujar
Date: Fri Jun 23 2023 - 00:54:59 EST




On 22-06-2023 17:42, Mark Brown wrote:
On Thu, Jun 22, 2023 at 05:04:12PM +0530, Sameer Pujar wrote:

The IRQ handler rt5640_irq() runs in interrupt context and can sleep
during cancel_delayed_work_sync().
Fix this by running IRQ handler, rt5640_irq(), in thread context.
Hence replace request_irq() calls with devm_request_threaded_irq().
- ret = request_irq(rt5640->jd_gpio_irq, rt5640_jd_gpio_irq,
- IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
- "rt5640-jd-gpio", rt5640);
+ ret = devm_request_threaded_irq(component->dev,
+ rt5640->jd_gpio_irq,
+ NULL, rt5640_jd_gpio_irq,
+ IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+ "rt5640-jd-gpio", rt5640);
This is rt5640_jd_gpio_irq() which just does a queue_delayed_work() not
a cancel. Why is it being changed?

Will drop this part in v2. Thanks.