]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mtd: nand: raw: gpmi: fix clocks when CONFIG_PM=N
authorMaarten Zanders <maarten@zanders.be>
Mon, 22 Sep 2025 15:39:38 +0000 (17:39 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Mon, 29 Sep 2025 15:56:31 +0000 (17:56 +0200)
Commit f04ced6d545e ("mtd: nand: raw: gpmi: improve power management
handling") moved all clock handling into PM callbacks. With CONFIG_PM
disabled, those callbacks are missing, leaving the driver unusable.

Add clock init/teardown for !CONFIG_PM builds to restore basic operation.
Keeping the driver working without requiring CONFIG_PM is preferred over
adding a Kconfig dependency.

Fixes: f04ced6d545e ("mtd: nand: raw: gpmi: improve power management handling")
Signed-off-by: Maarten Zanders <maarten@zanders.be>
Cc: stable@vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c

index f4e68008ea030340da928474c0127e7ba3d6c87f..a750f5839e3424e4a84180678479b533c5b5dc61 100644 (file)
@@ -145,6 +145,9 @@ err_clk:
        return ret;
 }
 
+#define gpmi_enable_clk(x)     __gpmi_enable_clk(x, true)
+#define gpmi_disable_clk(x)    __gpmi_enable_clk(x, false)
+
 static int gpmi_init(struct gpmi_nand_data *this)
 {
        struct resources *r = &this->resources;
@@ -2765,6 +2768,11 @@ static int gpmi_nand_probe(struct platform_device *pdev)
        pm_runtime_enable(&pdev->dev);
        pm_runtime_set_autosuspend_delay(&pdev->dev, 500);
        pm_runtime_use_autosuspend(&pdev->dev);
+#ifndef CONFIG_PM
+       ret = gpmi_enable_clk(this);
+       if (ret)
+               goto exit_acquire_resources;
+#endif
 
        ret = gpmi_init(this);
        if (ret)
@@ -2800,6 +2808,9 @@ static void gpmi_nand_remove(struct platform_device *pdev)
        release_resources(this);
        pm_runtime_dont_use_autosuspend(&pdev->dev);
        pm_runtime_disable(&pdev->dev);
+#ifndef CONFIG_PM
+       gpmi_disable_clk(this);
+#endif
 }
 
 static int gpmi_pm_suspend(struct device *dev)
@@ -2846,9 +2857,6 @@ static int gpmi_pm_resume(struct device *dev)
        return 0;
 }
 
-#define gpmi_enable_clk(x)     __gpmi_enable_clk(x, true)
-#define gpmi_disable_clk(x)    __gpmi_enable_clk(x, false)
-
 static int gpmi_runtime_suspend(struct device *dev)
 {
        struct gpmi_nand_data *this = dev_get_drvdata(dev);