hwrng: mediatek - Force runtime pm ops for sleep ops
Subsystems (4)
PATCH 1/1 hwrng: mediatek - 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.
--- drivers/char/hw_random/mtk-rng.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/char/hw_random/mtk-rng.c +7 -2
@@ -166,8 +166,13 @@ static int mtk_rng_runtime_resume(struct device *dev)return mtk_rng_init (&priv->rng); } -static UNIVERSAL_DEV_PM_OPS(mtk_rng_pm_ops, mtk_rng_runtime_suspend, - mtk_rng_runtime_resume, NULL); +static const struct dev_pm_ops mtk_rng_pm_ops = { + SET_RUNTIME_PM_OPS(mtk_rng_runtime_suspend, + mtk_rng_runtime_resume, NULL) +SET_SYSTEM_SLEEP_PM_OPS (pm_runtime_force_suspend, + pm_runtime_force_resume) +}; +#define MTK_RNG_PM_OPS (&mtk_rng_pm_ops)#else /* CONFIG_PM */ #define MTK_RNG_PM_OPS NULL
Signature · 1 line
2.33.0
Hi,
Quoted 9 lines · Markus Schneider-Pargmann
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_suspendeven 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.
Quoted 5 lines
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.
Signed-off-by Markus Schneider-Pargmann <[email protected]>
Sorry, forgot to add this line in the commit message. I can add it for the next version.
Best,
Markus
Quoted 27 lines
--- drivers/char/hw_random/mtk-rng.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/char/hw_random/mtk-rng.c +7
-2@@ -166,8 +166,13 @@ static int mtk_rng_runtime_resume(struct device *dev)return mtk_rng_init (&priv->rng); } -static UNIVERSAL_DEV_PM_OPS(mtk_rng_pm_ops, mtk_rng_runtime_suspend, - mtk_rng_runtime_resume, NULL); +static const struct dev_pm_ops mtk_rng_pm_ops = { + SET_RUNTIME_PM_OPS(mtk_rng_runtime_suspend, + mtk_rng_runtime_resume, NULL) +SET_SYSTEM_SLEEP_PM_OPS (pm_runtime_force_suspend, + pm_runtime_force_resume) +}; +#define MTK_RNG_PM_OPS (&mtk_rng_pm_ops)#else /* CONFIG_PM */ #define MTK_RNG_PM_OPS NULLSignature · 1 line
2.33.0
Herbert Xu
maintainerQuoted 9 lines · Markus Schneider-Pargmann
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_suspendeven 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.
Quoted 8 lines
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.
Signed-off-by Markus Schneider-Pargmann <[email protected]>--- drivers/char/hw_random/mtk-rng.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt