]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mfd: cs42l43: Move IRQ enable/disable to encompass force suspend
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Wed, 3 Sep 2025 09:45:48 +0000 (10:45 +0100)
committerLee Jones <lee@kernel.org>
Wed, 1 Oct 2025 09:28:55 +0000 (10:28 +0100)
As pm_runtime_force_suspend() will force the device state to suspend,
the driver needs to ensure no IRQ handlers are currently running. If not
those handlers may find they are now running on suspended hardware
despite holding a PM runtime reference. disable_irq() will sync any
currently running handlers, so move the IRQ disabling to cover the whole
of the forced suspend state to avoid such race conditions.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20250903094549.271068-6-ckeepax@opensource.cirrus.com
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/mfd/cs42l43.c

index 07c8f1b8183eec8d2d5e8611237036aa32b3650f..959298c8232f458d362fc040a92e0d76d16960a6 100644 (file)
@@ -1151,6 +1151,8 @@ static int cs42l43_suspend(struct device *dev)
                return ret;
        }
 
+       disable_irq(cs42l43->irq);
+
        ret = pm_runtime_force_suspend(dev);
        if (ret) {
                dev_err(cs42l43->dev, "Failed to force suspend: %d\n", ret);
@@ -1164,8 +1166,6 @@ static int cs42l43_suspend(struct device *dev)
        if (ret)
                return ret;
 
-       disable_irq(cs42l43->irq);
-
        return 0;
 }
 
@@ -1196,14 +1196,14 @@ static int cs42l43_resume(struct device *dev)
        if (ret)
                return ret;
 
-       enable_irq(cs42l43->irq);
-
        ret = pm_runtime_force_resume(dev);
        if (ret) {
                dev_err(cs42l43->dev, "Failed to force resume: %d\n", ret);
                return ret;
        }
 
+       enable_irq(cs42l43->irq);
+
        return 0;
 }