Skip to content

Commit b6f5f0c

Browse files
scosuherbertx
authored andcommitted
hwrng: mtk - Force runtime pm ops for sleep ops
Currently mtk_rng_runtime_suspend/resume is called for both runtime pm and system sleep operations. This is wrong as these should only be runtime ops as the name already suggests. Currently freezing the system will lead to a call to mtk_rng_runtime_suspend even if the device currently isn't active. This leads to a clock warning because it is disabled/unprepared although it isn't enabled/prepared currently. This patch fixes this by only setting the runtime pm ops and forces to call the runtime pm ops from the system sleep ops as well if active but not otherwise. Fixes: 81d2b34 ("hwrng: mtk - add runtime PM support") Signed-off-by: Markus Schneider-Pargmann <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 82e269a commit b6f5f0c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/char/hw_random/mtk-rng.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,13 @@ static int mtk_rng_runtime_resume(struct device *dev)
166166
return mtk_rng_init(&priv->rng);
167167
}
168168

169-
static UNIVERSAL_DEV_PM_OPS(mtk_rng_pm_ops, mtk_rng_runtime_suspend,
170-
mtk_rng_runtime_resume, NULL);
169+
static const struct dev_pm_ops mtk_rng_pm_ops = {
170+
SET_RUNTIME_PM_OPS(mtk_rng_runtime_suspend,
171+
mtk_rng_runtime_resume, NULL)
172+
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
173+
pm_runtime_force_resume)
174+
};
175+
171176
#define MTK_RNG_PM_OPS (&mtk_rng_pm_ops)
172177
#else /* CONFIG_PM */
173178
#define MTK_RNG_PM_OPS NULL

0 commit comments

Comments
 (0)