Patch "ASoC: rt5640: Revert "Fix sleep in atomic context"" has been added to the 6.5-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ASoC: rt5640: Revert "Fix sleep in atomic context"

to the 6.5-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     asoc-rt5640-revert-fix-sleep-in-atomic-context.patch
and it can be found in the queue-6.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f0694dcc97f64b6bb2fecca8c13b78dc868d02e9
Author: Hans de Goede <hdegoede@xxxxxxxxxx>
Date:   Tue Sep 12 13:32:40 2023 +0200

    ASoC: rt5640: Revert "Fix sleep in atomic context"
    
    [ Upstream commit fa6a0c0c1dd53b3949ca56bf7213648dfd6a62ee ]
    
    Commit 70a6404ff610 ("ASoC: rt5640: Fix sleep in atomic context")
    not only switched from request_irq() to request_threaded_irq(),
    to fix the sleep in atomic context issue, but it also added
    devm management of the IRQ by actually switching to
    devm_request_threaded_irq() (without any explanation in the commit
    message for this change).
    
    This is wrong since the IRQ was already explicitly managed by
    the driver. On unbind the ASoC core will call rt5640_set_jack(NULL)
    which in turn will call rt5640_disable_jack_detect() which
    frees the IRQ already. So now we have a double free.
    
    Besides the unexplained switch to devm being wrong, the actual fix
    for the sleep in atomic context issue also is not the best solution.
    
    The only thing which rt5640_irq() does is cancel + (re-)queue
    the jack_work delayed_work. This can be done in a single non sleeping
    call by replacing queue_delayed_work() with mod_delayed_work(),
    which does not sleep. Using mod_delayed_work() is a much better fix
    then adding a thread which does nothing other then queuing a work-item.
    
    This patch is a straight revert of the troublesome changes, the switch
    to mod_delayed_work() is done in a separate follow-up patch.
    
    Fixes: 70a6404ff610 ("ASoC: rt5640: Fix sleep in atomic context")
    Cc: Sameer Pujar <spujar@xxxxxxxxxx>
    Cc: Oder Chiou <oder_chiou@xxxxxxxxxxx>
    Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230912113245.320159-2-hdegoede@xxxxxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
index eceed82097877..7ec930fb9aab5 100644
--- a/sound/soc/codecs/rt5640.c
+++ b/sound/soc/codecs/rt5640.c
@@ -2566,10 +2566,9 @@ static void rt5640_enable_jack_detect(struct snd_soc_component *component,
 	if (jack_data && jack_data->use_platform_clock)
 		rt5640->use_platform_clock = jack_data->use_platform_clock;
 
-	ret = devm_request_threaded_irq(component->dev, rt5640->irq,
-					NULL, rt5640_irq,
-					IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
-					"rt5640", rt5640);
+	ret = request_irq(rt5640->irq, rt5640_irq,
+			  IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+			  "rt5640", rt5640);
 	if (ret) {
 		dev_warn(component->dev, "Failed to reguest IRQ %d: %d\n", rt5640->irq, ret);
 		rt5640_disable_jack_detect(component);
@@ -2622,9 +2621,8 @@ static void rt5640_enable_hda_jack_detect(
 
 	rt5640->jack = jack;
 
-	ret = devm_request_threaded_irq(component->dev, rt5640->irq,
-					NULL, rt5640_irq, IRQF_TRIGGER_RISING | IRQF_ONESHOT,
-					"rt5640", rt5640);
+	ret = request_irq(rt5640->irq, rt5640_irq,
+			  IRQF_TRIGGER_RISING | IRQF_ONESHOT, "rt5640", rt5640);
 	if (ret) {
 		dev_warn(component->dev, "Failed to reguest IRQ %d: %d\n", rt5640->irq, ret);
 		rt5640->irq = -ENXIO;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux