All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tty: serdev: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
@ 2022-04-18 11:06 cgel.zte
  2022-04-19  7:59 ` Jiri Slaby
  2022-04-20  8:21 ` Johan Hovold
  0 siblings, 2 replies; 3+ messages in thread
From: cgel.zte @ 2022-04-18 11:06 UTC (permalink / raw)
  To: robh
  Cc: gregkh, jirislaby, linux-serial, linux-kernel, Minghao Chi, Zeal Robot

From: Minghao Chi <chi.minghao@zte.com.cn>

Using pm_runtime_resume_and_get is more appropriate
for simplifing code

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
 drivers/tty/serdev/core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
index 0180e1e4e75d..e550ad3e7f2b 100644
--- a/drivers/tty/serdev/core.c
+++ b/drivers/tty/serdev/core.c
@@ -156,11 +156,9 @@ int serdev_device_open(struct serdev_device *serdev)
 	if (ret)
 		return ret;
 
-	ret = pm_runtime_get_sync(&ctrl->dev);
-	if (ret < 0) {
-		pm_runtime_put_noidle(&ctrl->dev);
+	ret = pm_runtime_resume_and_get(&ctrl->dev);
+	if (ret < 0)
 		goto err_close;
-	}
 
 	return 0;
 
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] tty: serdev: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
  2022-04-18 11:06 [PATCH] tty: serdev: using pm_runtime_resume_and_get instead of pm_runtime_get_sync cgel.zte
@ 2022-04-19  7:59 ` Jiri Slaby
  2022-04-20  8:21 ` Johan Hovold
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2022-04-19  7:59 UTC (permalink / raw)
  To: cgel.zte, robh
  Cc: gregkh, linux-serial, linux-kernel, Minghao Chi, Zeal Robot

On 18. 04. 22, 13:06, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> Using pm_runtime_resume_and_get is more appropriate
> for simplifing code

... because it's helper doing exactly the same thing.

Reviewed-by: Jiri Slaby <jirislaby@kernel.org>

> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> ---
>   drivers/tty/serdev/core.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
> index 0180e1e4e75d..e550ad3e7f2b 100644
> --- a/drivers/tty/serdev/core.c
> +++ b/drivers/tty/serdev/core.c
> @@ -156,11 +156,9 @@ int serdev_device_open(struct serdev_device *serdev)
>   	if (ret)
>   		return ret;
>   
> -	ret = pm_runtime_get_sync(&ctrl->dev);
> -	if (ret < 0) {
> -		pm_runtime_put_noidle(&ctrl->dev);
> +	ret = pm_runtime_resume_and_get(&ctrl->dev);
> +	if (ret < 0)
>   		goto err_close;
> -	}
>   
>   	return 0;
>   


-- 
js
suse labs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tty: serdev: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
  2022-04-18 11:06 [PATCH] tty: serdev: using pm_runtime_resume_and_get instead of pm_runtime_get_sync cgel.zte
  2022-04-19  7:59 ` Jiri Slaby
@ 2022-04-20  8:21 ` Johan Hovold
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2022-04-20  8:21 UTC (permalink / raw)
  To: cgel.zte
  Cc: robh, gregkh, jirislaby, linux-serial, linux-kernel, Minghao Chi,
	Zeal Robot

On Mon, Apr 18, 2022 at 11:06:35AM +0000, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> Using pm_runtime_resume_and_get is more appropriate
> for simplifing code
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> ---
>  drivers/tty/serdev/core.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
> index 0180e1e4e75d..e550ad3e7f2b 100644
> --- a/drivers/tty/serdev/core.c
> +++ b/drivers/tty/serdev/core.c
> @@ -156,11 +156,9 @@ int serdev_device_open(struct serdev_device *serdev)
>  	if (ret)
>  		return ret;
>  
> -	ret = pm_runtime_get_sync(&ctrl->dev);
> -	if (ret < 0) {
> -		pm_runtime_put_noidle(&ctrl->dev);
> +	ret = pm_runtime_resume_and_get(&ctrl->dev);
> +	if (ret < 0)
>  		goto err_close;
> -	}

As the author of this piece of the code, I prefer using the traditional
API consistently rather than mixing in the new helper that uses a
different naming scheme.

No need to change this.

>  
>  	return 0;

Johan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-20  8:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-18 11:06 [PATCH] tty: serdev: using pm_runtime_resume_and_get instead of pm_runtime_get_sync cgel.zte
2022-04-19  7:59 ` Jiri Slaby
2022-04-20  8:21 ` Johan Hovold

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.