Skip to content

Commit 32ce5d8

Browse files
jhovoldgregkh
authored andcommitted
bus: simple-pm-bus: fix forced runtime PM use
The simple-pm-bus driver only enables runtime PM for some buses ('simple-pm-bus') yet has started calling pm_runtime_force_suspend() and pm_runtime_force_resume() during system suspend unconditionally. This currently works, but that is not obvious and depends on implementation details which may change at some point. Add dedicated system sleep ops and only call pm_runtime_force_suspend() and pm_runtime_force_resume() for buses that use runtime PM to avoid any future surprises. Fixes: c458393 ("drivers: bus: simple-pm-bus: Use clocks") Cc: Liu Ying <victor.liu@nxp.com> Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Liu Ying <victor.liu@nxp.com> Acked-by: Rafael J. Wysocki <rafael@kernel.org> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/20250214102130.3000-1-johan+linaro@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6d991f5 commit 32ce5d8

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

drivers/bus/simple-pm-bus.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,29 @@ static int simple_pm_bus_runtime_resume(struct device *dev)
109109
return 0;
110110
}
111111

112+
static int simple_pm_bus_suspend(struct device *dev)
113+
{
114+
struct simple_pm_bus *bus = dev_get_drvdata(dev);
115+
116+
if (!bus)
117+
return 0;
118+
119+
return pm_runtime_force_suspend(dev);
120+
}
121+
122+
static int simple_pm_bus_resume(struct device *dev)
123+
{
124+
struct simple_pm_bus *bus = dev_get_drvdata(dev);
125+
126+
if (!bus)
127+
return 0;
128+
129+
return pm_runtime_force_resume(dev);
130+
}
131+
112132
static const struct dev_pm_ops simple_pm_bus_pm_ops = {
113133
RUNTIME_PM_OPS(simple_pm_bus_runtime_suspend, simple_pm_bus_runtime_resume, NULL)
114-
NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
134+
NOIRQ_SYSTEM_SLEEP_PM_OPS(simple_pm_bus_suspend, simple_pm_bus_resume)
115135
};
116136

117137
#define ONLY_BUS ((void *) 1) /* Match if the device is only a bus. */

0 commit comments

Comments
 (0)