diff mbox series

[v2,2/8] rcar-vin: Remove unneeded calls to pm_runtime_{enable,disable}

Message ID 20190516011417.10590-3-niklas.soderlund+renesas@ragnatech.se (mailing list archive)
State Superseded
Delegated to: Kieran Bingham
Headers show
Series rcar-vin: Merge Gen2 and Gen3 file operations | expand

Commit Message

Niklas Söderlund May 16, 2019, 1:14 a.m. UTC
Runtime PM is already enabled unconditionally when the driver is probed
and disabled when it's removed. There is no point in doing it again for
Gen2 when opening and closing the video device.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Ulrich Hecht <uli+renesas@fpond.eu>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Geert Uytterhoeven May 16, 2019, 7:27 a.m. UTC | #1
Hi Niklas,

On Thu, May 16, 2019 at 3:49 AM Niklas Söderlund
<niklas.soderlund+renesas@ragnatech.se> wrote:
> Runtime PM is already enabled unconditionally when the driver is probed
> and disabled when it's removed. There is no point in doing it again for
> Gen2 when opening and closing the video device.
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> Reviewed-by: Ulrich Hecht <uli+renesas@fpond.eu>
> ---
>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> index b821ea01786eb1ff..0841f1a0bfd7ba3a 100644
> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> @@ -797,8 +797,6 @@ static int rvin_initialize_device(struct file *file)
>         if (ret < 0)
>                 return ret;
>
> -       pm_runtime_enable(&vin->vdev.dev);

Ah, this already (partly) answers my question on patch 1/8.

> -
>         /*
>          * Try to configure with default parameters. Notice: this is the
>          * very first open, so, we cannot race against other calls,

Gr{oetje,eeting}s,

                        Geert


--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Laurent Pinchart May 16, 2019, 11:34 a.m. UTC | #2
On Thu, May 16, 2019 at 09:27:03AM +0200, Geert Uytterhoeven wrote:
> On Thu, May 16, 2019 at 3:49 AM Niklas Söderlund wrote:
> > Runtime PM is already enabled unconditionally when the driver is probed
> > and disabled when it's removed. There is no point in doing it again for
> > Gen2 when opening and closing the video device.
> >
> > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> > Reviewed-by: Ulrich Hecht <uli+renesas@fpond.eu>
> > ---
> >  drivers/media/platform/rcar-vin/rcar-v4l2.c | 7 +------
> >  1 file changed, 1 insertion(+), 6 deletions(-)
> >
> > diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> > index b821ea01786eb1ff..0841f1a0bfd7ba3a 100644
> > --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> > +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> > @@ -797,8 +797,6 @@ static int rvin_initialize_device(struct file *file)
> >         if (ret < 0)
> >                 return ret;
> >
> > -       pm_runtime_enable(&vin->vdev.dev);
> 
> Ah, this already (partly) answers my question on patch 1/8.

Note that those are two different devices, here we enable runtime PM in
the V4L2 video node class device, while at probe time we enable it on
the platform device. I agree that this call should go, but that's only
because all runtime PM calls on the class device should go :-)

> 
> > -
> >         /*
> >          * Try to configure with default parameters. Notice: this is the
> >          * very first open, so, we cannot race against other calls,
diff mbox series

Patch

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index b821ea01786eb1ff..0841f1a0bfd7ba3a 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -797,8 +797,6 @@  static int rvin_initialize_device(struct file *file)
 	if (ret < 0)
 		return ret;
 
-	pm_runtime_enable(&vin->vdev.dev);
-
 	/*
 	 * Try to configure with default parameters. Notice: this is the
 	 * very first open, so, we cannot race against other calls,
@@ -813,7 +811,6 @@  static int rvin_initialize_device(struct file *file)
 
 	return 0;
 esfmt:
-	pm_runtime_disable(&vin->vdev.dev);
 	rvin_power_off(vin);
 
 	return ret;
@@ -863,10 +860,8 @@  static int rvin_release(struct file *file)
 	 * If this was the last open file.
 	 * Then de-initialize hw module.
 	 */
-	if (fh_singular) {
-		pm_runtime_disable(&vin->vdev.dev);
+	if (fh_singular)
 		rvin_power_off(vin);
-	}
 
 	mutex_unlock(&vin->lock);