diff mbox

[v2,03/54] v4l: subdev: Call pad init_cfg operation when opening subdevs

Message ID 1458902668-1141-4-git-send-email-laurent.pinchart+renesas@ideasonboard.com (mailing list archive)
State Not Applicable
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Laurent Pinchart March 25, 2016, 10:43 a.m. UTC
The subdev core code currently rely on the subdev open handler to
initialize the file handle's pad configuration, even though subdevs now
have a pad operation dedicated for that purpose.

As a first step towards migration to init_cfg, call the operation
operation in the subdev core open implementation. Subdevs that haven't
been moved to init_cfg yet will just continue implementing pad config
initialization in their open handler.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/media/v4l2-core/v4l2-subdev.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Hans Verkuil March 25, 2016, 12:40 p.m. UTC | #1
On 03/25/2016 11:43 AM, Laurent Pinchart wrote:
> The subdev core code currently rely on the subdev open handler to
> initialize the file handle's pad configuration, even though subdevs now
> have a pad operation dedicated for that purpose.
> 
> As a first step towards migration to init_cfg, call the operation
> operation in the subdev core open implementation. Subdevs that haven't
> been moved to init_cfg yet will just continue implementing pad config
> initialization in their open handler.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
>  drivers/media/v4l2-core/v4l2-subdev.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
> index d4007f8f58d1..1fa6b713ee19 100644
> --- a/drivers/media/v4l2-core/v4l2-subdev.c
> +++ b/drivers/media/v4l2-core/v4l2-subdev.c
> @@ -83,6 +83,12 @@ static int subdev_open(struct file *file)
>  	}
>  #endif
>  
> +#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
> +	ret = v4l2_subdev_call(sd, pad, init_cfg, subdev_fh->pad);
> +	if (ret < 0 && ret != -ENOIOCTLCMD)
> +		goto err;
> +#endif

Am I missing something here? Doesn't the subdev_fh_init() call earlier in this
function call pad.init_cfg already?

Regards,

	Hans

> +
>  	if (sd->internal_ops && sd->internal_ops->open) {
>  		ret = sd->internal_ops->open(sd, subdev_fh);
>  		if (ret < 0)
>
Laurent Pinchart March 25, 2016, 2:17 p.m. UTC | #2
Hi Hans,

On Friday 25 Mar 2016 13:40:55 Hans Verkuil wrote:
> On 03/25/2016 11:43 AM, Laurent Pinchart wrote:
> > The subdev core code currently rely on the subdev open handler to
> > initialize the file handle's pad configuration, even though subdevs now
> > have a pad operation dedicated for that purpose.
> > 
> > As a first step towards migration to init_cfg, call the operation
> > operation in the subdev core open implementation. Subdevs that haven't
> > been moved to init_cfg yet will just continue implementing pad config
> > initialization in their open handler.
> > 
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> > 
> >  drivers/media/v4l2-core/v4l2-subdev.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/drivers/media/v4l2-core/v4l2-subdev.c
> > b/drivers/media/v4l2-core/v4l2-subdev.c index d4007f8f58d1..1fa6b713ee19
> > 100644
> > --- a/drivers/media/v4l2-core/v4l2-subdev.c
> > +++ b/drivers/media/v4l2-core/v4l2-subdev.c
> > @@ -83,6 +83,12 @@ static int subdev_open(struct file *file)
> > 
> >  	}
> >  
> >  #endif
> > 
> > +#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
> > +	ret = v4l2_subdev_call(sd, pad, init_cfg, subdev_fh->pad);
> > +	if (ret < 0 && ret != -ENOIOCTLCMD)
> > +		goto err;
> > +#endif
> 
> Am I missing something here? Doesn't the subdev_fh_init() call earlier in
> this function call pad.init_cfg already?

You're absolutely right, I'll drop this patch.

> > +
> > 
> >  	if (sd->internal_ops && sd->internal_ops->open) {
> >  	
> >  		ret = sd->internal_ops->open(sd, subdev_fh);
> >  		if (ret < 0)
diff mbox

Patch

diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index d4007f8f58d1..1fa6b713ee19 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -83,6 +83,12 @@  static int subdev_open(struct file *file)
 	}
 #endif
 
+#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
+	ret = v4l2_subdev_call(sd, pad, init_cfg, subdev_fh->pad);
+	if (ret < 0 && ret != -ENOIOCTLCMD)
+		goto err;
+#endif
+
 	if (sd->internal_ops && sd->internal_ops->open) {
 		ret = sd->internal_ops->open(sd, subdev_fh);
 		if (ret < 0)