use pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
pm_runtime_put_noidle. this change is just to simplify the code, no
actual functional changes.
Signed-off-by: Tian Tao <[email protected]>
---
drivers/char/hw_random/exynos-trng.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/char/hw_random/exynos-trng.c b/drivers/char/hw_random/exynos-trng.c
index 8e1fe3f..d71ef3c 100644
--- a/drivers/char/hw_random/exynos-trng.c
+++ b/drivers/char/hw_random/exynos-trng.c
@@ -196,10 +196,9 @@ static int __maybe_unused exynos_trng_resume(struct device *dev)
{
int ret;
- ret = pm_runtime_get_sync(dev);
- if (ret < 0) {
+ ret = pm_runtime_resume_and_get(dev);
+ if (ret) {
dev_err(dev, "Could not get runtime PM.\n");
- pm_runtime_put_noidle(dev);
return ret;
}
--
2.7.4
On 20/05/2021 23:58, Tian Tao wrote:
> use pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
> pm_runtime_put_noidle. this change is just to simplify the code, no
> actual functional changes.
>
> Signed-off-by: Tian Tao <[email protected]>
> ---
> drivers/char/hw_random/exynos-trng.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/char/hw_random/exynos-trng.c b/drivers/char/hw_random/exynos-trng.c
> index 8e1fe3f..d71ef3c 100644
> --- a/drivers/char/hw_random/exynos-trng.c
> +++ b/drivers/char/hw_random/exynos-trng.c
> @@ -196,10 +196,9 @@ static int __maybe_unused exynos_trng_resume(struct device *dev)
> {
> int ret;
>
> - ret = pm_runtime_get_sync(dev);
> - if (ret < 0) {
> + ret = pm_runtime_resume_and_get(dev);
> + if (ret) {
> dev_err(dev, "Could not get runtime PM.\n");
> - pm_runtime_put_noidle(dev);
> return ret;
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Best regards,
Krzysztof
It was <2021-05-21 pią 11:58>, when Tian Tao wrote:
> use pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
> pm_runtime_put_noidle. this change is just to simplify the code, no
> actual functional changes.
>
> Signed-off-by: Tian Tao <[email protected]>
> ---
> drivers/char/hw_random/exynos-trng.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/char/hw_random/exynos-trng.c b/drivers/char/hw_random/exynos-trng.c
> index 8e1fe3f..d71ef3c 100644
> --- a/drivers/char/hw_random/exynos-trng.c
> +++ b/drivers/char/hw_random/exynos-trng.c
> @@ -196,10 +196,9 @@ static int __maybe_unused exynos_trng_resume(struct device *dev)
> {
> int ret;
>
> - ret = pm_runtime_get_sync(dev);
> - if (ret < 0) {
> + ret = pm_runtime_resume_and_get(dev);
> + if (ret) {
pm_runtime_resume_and_get() (see include/linux/pm_runtime.h) checks for
ret < 0 and returns it, so I think it is better to keep (ret < 0).
> dev_err(dev, "Could not get runtime PM.\n");
> - pm_runtime_put_noidle(dev);
> return ret;
> }
--
Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics