diff mbox series

[2/2] media: i2c: imx415: Use v4l2_subdev_get_fmt()

Message ID 20230830045323.71768-3-umang.jain@ideasonboard.com (mailing list archive)
State Accepted
Headers show
Series media: Use v4l2_subdev_get_fmt() | expand

Commit Message

Umang Jain Aug. 30, 2023, 4:53 a.m. UTC
The imx415 driver uses the subdev active state, there's
no need to implement the .get_fmt() operation manually. Use
the v4l2_subdev_get_fmt() helper instead.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
---
 drivers/media/i2c/imx415.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

Comments

Michael Riesch Aug. 30, 2023, 6:54 a.m. UTC | #1
Hi Umang,

On 8/30/23 06:53, Umang Jain wrote:
> The imx415 driver uses the subdev active state, there's
> no need to implement the .get_fmt() operation manually. Use
> the v4l2_subdev_get_fmt() helper instead.
> 
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>

Thanks for the patch, we'll try to give it a test. Due to time
constraints this might take a bit, though :-/

Cc: Gerald

That said, without having it tested the patch LGTM:

Reviewed-by: Michael Riesch <michael.riesch@wolfvision.net>

Best regards,
Michael

> ---
>  drivers/media/i2c/imx415.c | 11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/drivers/media/i2c/imx415.c b/drivers/media/i2c/imx415.c
> index 3f00172df3cc..9a7ac81edc28 100644
> --- a/drivers/media/i2c/imx415.c
> +++ b/drivers/media/i2c/imx415.c
> @@ -842,15 +842,6 @@ static int imx415_enum_frame_size(struct v4l2_subdev *sd,
>  	return 0;
>  }
>  
> -static int imx415_get_format(struct v4l2_subdev *sd,
> -			     struct v4l2_subdev_state *state,
> -			     struct v4l2_subdev_format *fmt)
> -{
> -	fmt->format = *v4l2_subdev_get_pad_format(sd, state, fmt->pad);
> -
> -	return 0;
> -}
> -
>  static int imx415_set_format(struct v4l2_subdev *sd,
>  			     struct v4l2_subdev_state *state,
>  			     struct v4l2_subdev_format *fmt)
> @@ -913,7 +904,7 @@ static const struct v4l2_subdev_video_ops imx415_subdev_video_ops = {
>  static const struct v4l2_subdev_pad_ops imx415_subdev_pad_ops = {
>  	.enum_mbus_code = imx415_enum_mbus_code,
>  	.enum_frame_size = imx415_enum_frame_size,
> -	.get_fmt = imx415_get_format,
> +	.get_fmt = v4l2_subdev_get_fmt,
>  	.set_fmt = imx415_set_format,
>  	.get_selection = imx415_get_selection,
>  	.init_cfg = imx415_init_cfg,
Laurent Pinchart Aug. 30, 2023, 7:20 a.m. UTC | #2
Hi Umang,

Thank you for the patch.

On Wed, Aug 30, 2023 at 10:23:23AM +0530, Umang Jain wrote:
> The imx415 driver uses the subdev active state, there's
> no need to implement the .get_fmt() operation manually. Use
> the v4l2_subdev_get_fmt() helper instead.
> 
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/media/i2c/imx415.c | 11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/drivers/media/i2c/imx415.c b/drivers/media/i2c/imx415.c
> index 3f00172df3cc..9a7ac81edc28 100644
> --- a/drivers/media/i2c/imx415.c
> +++ b/drivers/media/i2c/imx415.c
> @@ -842,15 +842,6 @@ static int imx415_enum_frame_size(struct v4l2_subdev *sd,
>  	return 0;
>  }
>  
> -static int imx415_get_format(struct v4l2_subdev *sd,
> -			     struct v4l2_subdev_state *state,
> -			     struct v4l2_subdev_format *fmt)
> -{
> -	fmt->format = *v4l2_subdev_get_pad_format(sd, state, fmt->pad);
> -
> -	return 0;
> -}
> -
>  static int imx415_set_format(struct v4l2_subdev *sd,
>  			     struct v4l2_subdev_state *state,
>  			     struct v4l2_subdev_format *fmt)
> @@ -913,7 +904,7 @@ static const struct v4l2_subdev_video_ops imx415_subdev_video_ops = {
>  static const struct v4l2_subdev_pad_ops imx415_subdev_pad_ops = {
>  	.enum_mbus_code = imx415_enum_mbus_code,
>  	.enum_frame_size = imx415_enum_frame_size,
> -	.get_fmt = imx415_get_format,
> +	.get_fmt = v4l2_subdev_get_fmt,
>  	.set_fmt = imx415_set_format,
>  	.get_selection = imx415_get_selection,
>  	.init_cfg = imx415_init_cfg,
diff mbox series

Patch

diff --git a/drivers/media/i2c/imx415.c b/drivers/media/i2c/imx415.c
index 3f00172df3cc..9a7ac81edc28 100644
--- a/drivers/media/i2c/imx415.c
+++ b/drivers/media/i2c/imx415.c
@@ -842,15 +842,6 @@  static int imx415_enum_frame_size(struct v4l2_subdev *sd,
 	return 0;
 }
 
-static int imx415_get_format(struct v4l2_subdev *sd,
-			     struct v4l2_subdev_state *state,
-			     struct v4l2_subdev_format *fmt)
-{
-	fmt->format = *v4l2_subdev_get_pad_format(sd, state, fmt->pad);
-
-	return 0;
-}
-
 static int imx415_set_format(struct v4l2_subdev *sd,
 			     struct v4l2_subdev_state *state,
 			     struct v4l2_subdev_format *fmt)
@@ -913,7 +904,7 @@  static const struct v4l2_subdev_video_ops imx415_subdev_video_ops = {
 static const struct v4l2_subdev_pad_ops imx415_subdev_pad_ops = {
 	.enum_mbus_code = imx415_enum_mbus_code,
 	.enum_frame_size = imx415_enum_frame_size,
-	.get_fmt = imx415_get_format,
+	.get_fmt = v4l2_subdev_get_fmt,
 	.set_fmt = imx415_set_format,
 	.get_selection = imx415_get_selection,
 	.init_cfg = imx415_init_cfg,