diff mbox series

[1/2] media: i2c: imx214: Use v4l2_subdev_get_fmt()

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

Commit Message

Umang Jain Aug. 30, 2023, 4:53 a.m. UTC
The imx214 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/imx214.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

Comments

Laurent Pinchart Aug. 30, 2023, 7:19 a.m. UTC | #1
On Wed, Aug 30, 2023 at 10:23:22AM +0530, Umang Jain wrote:
> The imx214 driver uses the subdev active state, there's no

Does it ? I don't see a call to v4l2_subdev_init_finalize(), and the
imx214 struct has fmt and crop fields in which it stores the active
format.

> 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/imx214.c | 17 +----------------
>  1 file changed, 1 insertion(+), 16 deletions(-)
> 
> diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c
> index 2f9c8582f940..d8bdc52f552a 100644
> --- a/drivers/media/i2c/imx214.c
> +++ b/drivers/media/i2c/imx214.c
> @@ -548,21 +548,6 @@ __imx214_get_pad_format(struct imx214 *imx214,
>  	}
>  }
>  
> -static int imx214_get_format(struct v4l2_subdev *sd,
> -			     struct v4l2_subdev_state *sd_state,
> -			     struct v4l2_subdev_format *format)
> -{
> -	struct imx214 *imx214 = to_imx214(sd);
> -
> -	mutex_lock(&imx214->mutex);
> -	format->format = *__imx214_get_pad_format(imx214, sd_state,
> -						  format->pad,
> -						  format->which);
> -	mutex_unlock(&imx214->mutex);
> -
> -	return 0;
> -}
> -
>  static struct v4l2_rect *
>  __imx214_get_pad_crop(struct imx214 *imx214,
>  		      struct v4l2_subdev_state *sd_state,
> @@ -842,7 +827,7 @@ static const struct v4l2_subdev_pad_ops imx214_subdev_pad_ops = {
>  	.enum_mbus_code = imx214_enum_mbus_code,
>  	.enum_frame_size = imx214_enum_frame_size,
>  	.enum_frame_interval = imx214_enum_frame_interval,
> -	.get_fmt = imx214_get_format,
> +	.get_fmt = v4l2_subdev_get_fmt,
>  	.set_fmt = imx214_set_format,
>  	.get_selection = imx214_get_selection,
>  	.init_cfg = imx214_entity_init_cfg,
Umang Jain Aug. 30, 2023, 7:22 a.m. UTC | #2
Hi Laurent,

On 8/30/23 12:49 PM, Laurent Pinchart wrote:
> On Wed, Aug 30, 2023 at 10:23:22AM +0530, Umang Jain wrote:
>> The imx214 driver uses the subdev active state, there's no
> Does it ? I don't see a call to v4l2_subdev_init_finalize(), and the
> imx214 struct has fmt and crop fields in which it stores the active
> format.

Yes, It doesn't. Got confused with one of the pad ops (.init_cfg) which 
led me thinking this driver uses active state, whereas I should have 
checked v4l2_subdev_init_finalize()

Apologies for the noise.

This patch should be discarded.
>
>> 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/imx214.c | 17 +----------------
>>   1 file changed, 1 insertion(+), 16 deletions(-)
>>
>> diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c
>> index 2f9c8582f940..d8bdc52f552a 100644
>> --- a/drivers/media/i2c/imx214.c
>> +++ b/drivers/media/i2c/imx214.c
>> @@ -548,21 +548,6 @@ __imx214_get_pad_format(struct imx214 *imx214,
>>   	}
>>   }
>>   
>> -static int imx214_get_format(struct v4l2_subdev *sd,
>> -			     struct v4l2_subdev_state *sd_state,
>> -			     struct v4l2_subdev_format *format)
>> -{
>> -	struct imx214 *imx214 = to_imx214(sd);
>> -
>> -	mutex_lock(&imx214->mutex);
>> -	format->format = *__imx214_get_pad_format(imx214, sd_state,
>> -						  format->pad,
>> -						  format->which);
>> -	mutex_unlock(&imx214->mutex);
>> -
>> -	return 0;
>> -}
>> -
>>   static struct v4l2_rect *
>>   __imx214_get_pad_crop(struct imx214 *imx214,
>>   		      struct v4l2_subdev_state *sd_state,
>> @@ -842,7 +827,7 @@ static const struct v4l2_subdev_pad_ops imx214_subdev_pad_ops = {
>>   	.enum_mbus_code = imx214_enum_mbus_code,
>>   	.enum_frame_size = imx214_enum_frame_size,
>>   	.enum_frame_interval = imx214_enum_frame_interval,
>> -	.get_fmt = imx214_get_format,
>> +	.get_fmt = v4l2_subdev_get_fmt,
>>   	.set_fmt = imx214_set_format,
>>   	.get_selection = imx214_get_selection,
>>   	.init_cfg = imx214_entity_init_cfg,
diff mbox series

Patch

diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c
index 2f9c8582f940..d8bdc52f552a 100644
--- a/drivers/media/i2c/imx214.c
+++ b/drivers/media/i2c/imx214.c
@@ -548,21 +548,6 @@  __imx214_get_pad_format(struct imx214 *imx214,
 	}
 }
 
-static int imx214_get_format(struct v4l2_subdev *sd,
-			     struct v4l2_subdev_state *sd_state,
-			     struct v4l2_subdev_format *format)
-{
-	struct imx214 *imx214 = to_imx214(sd);
-
-	mutex_lock(&imx214->mutex);
-	format->format = *__imx214_get_pad_format(imx214, sd_state,
-						  format->pad,
-						  format->which);
-	mutex_unlock(&imx214->mutex);
-
-	return 0;
-}
-
 static struct v4l2_rect *
 __imx214_get_pad_crop(struct imx214 *imx214,
 		      struct v4l2_subdev_state *sd_state,
@@ -842,7 +827,7 @@  static const struct v4l2_subdev_pad_ops imx214_subdev_pad_ops = {
 	.enum_mbus_code = imx214_enum_mbus_code,
 	.enum_frame_size = imx214_enum_frame_size,
 	.enum_frame_interval = imx214_enum_frame_interval,
-	.get_fmt = imx214_get_format,
+	.get_fmt = v4l2_subdev_get_fmt,
 	.set_fmt = imx214_set_format,
 	.get_selection = imx214_get_selection,
 	.init_cfg = imx214_entity_init_cfg,