Re: [PATCH] media: i2c: Use pm_runtime_resume_and_get()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Donnerstag, dem 14.09.2023 um 20:20 +0300 schrieb Laurent Pinchart:
> Simplify error handling by using pm_runtime_resume_and_get() instead
> of
> pm_runtime_get_sync() with a put call in the error path.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
> ---
>  drivers/media/i2c/ccs/ccs-core.c |  6 +++---
>  drivers/media/i2c/hi846.c        |  6 ++----
>  drivers/media/i2c/hi847.c        |  5 ++---
>  drivers/media/i2c/imx208.c       | 14 +++++++-------
>  drivers/media/i2c/og01a1b.c      |  5 ++---
>  drivers/media/i2c/ov5693.c       |  6 +++---
>  drivers/media/i2c/ov7251.c       |  8 +++++---
>  drivers/media/i2c/st-vgxy61.c    |  9 ++-------
>  8 files changed, 26 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/media/i2c/ccs/ccs-core.c
> b/drivers/media/i2c/ccs/ccs-core.c
> index 49e0d9a09530..569bf9b67539 100644
> --- a/drivers/media/i2c/ccs/ccs-core.c
> +++ b/drivers/media/i2c/ccs/ccs-core.c
> @@ -1893,9 +1893,9 @@ static int ccs_pm_get_init(struct ccs_sensor
> *sensor)
>          * relies at the returned value to detect if the device was
> already
>          * active or not.
>          */
> -       rval = pm_runtime_get_sync(&client->dev);
> -       if (rval < 0)
> -               goto error;
> +       rval = pm_runtime_resume_and_get(&client->dev);
> +       if (rval)
> +               return rval;
>  
>         /* Device was already active, so don't set controls */
>         if (rval == 1)
> diff --git a/drivers/media/i2c/hi846.c b/drivers/media/i2c/hi846.c
> index fa0038749a3b..8a8ae89a8453 100644
> --- a/drivers/media/i2c/hi846.c
> +++ b/drivers/media/i2c/hi846.c
> @@ -1613,11 +1613,9 @@ static int hi846_set_stream(struct v4l2_subdev
> *sd, int enable)
>         mutex_lock(&hi846->mutex);
>  
>         if (enable) {
> -               ret = pm_runtime_get_sync(&client->dev);
> -               if (ret < 0) {
> -                       pm_runtime_put_noidle(&client->dev);
> +               ret = pm_runtime_resume_and_get(&client->dev);
> +               if (ret)
>                         goto out;
> -               }
>  
>                 ret = hi846_start_streaming(hi846);
> 

for the hi846 driver:

Tested-by: Martin Kepplinger <martink@xxxxxxxxx> 

thanks for the patch!





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux