Skip to content

Commit 1da032d

Browse files
Maarten Zandersgregkh
authored andcommitted
mtd: nand: raw: gpmi: fix clocks when CONFIG_PM=N
commit 1001cc1 upstream. Commit f04ced6 ("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: f04ced6 ("mtd: nand: raw: gpmi: improve power management handling") Signed-off-by: Maarten Zanders <[email protected]> Cc: [email protected] Signed-off-by: Miquel Raynal <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1fa0743 commit 1da032d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ static int __gpmi_enable_clk(struct gpmi_nand_data *this, bool v)
145145
return ret;
146146
}
147147

148+
#define gpmi_enable_clk(x) __gpmi_enable_clk(x, true)
149+
#define gpmi_disable_clk(x) __gpmi_enable_clk(x, false)
150+
148151
static int gpmi_init(struct gpmi_nand_data *this)
149152
{
150153
struct resources *r = &this->resources;
@@ -2765,6 +2768,11 @@ static int gpmi_nand_probe(struct platform_device *pdev)
27652768
pm_runtime_enable(&pdev->dev);
27662769
pm_runtime_set_autosuspend_delay(&pdev->dev, 500);
27672770
pm_runtime_use_autosuspend(&pdev->dev);
2771+
#ifndef CONFIG_PM
2772+
ret = gpmi_enable_clk(this);
2773+
if (ret)
2774+
goto exit_acquire_resources;
2775+
#endif
27682776

27692777
ret = gpmi_init(this);
27702778
if (ret)
@@ -2800,6 +2808,9 @@ static void gpmi_nand_remove(struct platform_device *pdev)
28002808
release_resources(this);
28012809
pm_runtime_dont_use_autosuspend(&pdev->dev);
28022810
pm_runtime_disable(&pdev->dev);
2811+
#ifndef CONFIG_PM
2812+
gpmi_disable_clk(this);
2813+
#endif
28032814
}
28042815

28052816
static int gpmi_pm_suspend(struct device *dev)
@@ -2846,9 +2857,6 @@ static int gpmi_pm_resume(struct device *dev)
28462857
return 0;
28472858
}
28482859

2849-
#define gpmi_enable_clk(x) __gpmi_enable_clk(x, true)
2850-
#define gpmi_disable_clk(x) __gpmi_enable_clk(x, false)
2851-
28522860
static int gpmi_runtime_suspend(struct device *dev)
28532861
{
28542862
struct gpmi_nand_data *this = dev_get_drvdata(dev);

0 commit comments

Comments
 (0)