Re: [PATCH v6 01/15] media: i2c: imx219: Inline imx219_update_pad_format() in its caller

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

 



Hi Laurent

On Fri, Mar 01, 2024 at 11:32:16PM +0200, Laurent Pinchart wrote:
> The imx219_update_pad_format() is short and called from a single place,
> in imx219_set_pad_format(). Inline the code in the caller to keep all
> format adjustements grouped in a single place and improve readability.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>

Reviewed-by: Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>

> ---
>  drivers/media/i2c/imx219.c | 28 ++++++++++++----------------
>  1 file changed, 12 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
> index e17ef2e9d9d0..3878da50860e 100644
> --- a/drivers/media/i2c/imx219.c
> +++ b/drivers/media/i2c/imx219.c
> @@ -758,21 +758,6 @@ static int imx219_set_stream(struct v4l2_subdev *sd, int enable)
>  	return ret;
>  }
>
> -static void imx219_update_pad_format(struct imx219 *imx219,
> -				     const struct imx219_mode *mode,
> -				     struct v4l2_mbus_framefmt *fmt, u32 code)
> -{
> -	/* Bayer order varies with flips */
> -	fmt->code = imx219_get_format_code(imx219, code);
> -	fmt->width = mode->width;
> -	fmt->height = mode->height;
> -	fmt->field = V4L2_FIELD_NONE;
> -	fmt->colorspace = V4L2_COLORSPACE_RAW;
> -	fmt->ycbcr_enc = V4L2_YCBCR_ENC_601;
> -	fmt->quantization = V4L2_QUANTIZATION_FULL_RANGE;
> -	fmt->xfer_func = V4L2_XFER_FUNC_NONE;
> -}
> -
>  static int imx219_enum_mbus_code(struct v4l2_subdev *sd,
>  				 struct v4l2_subdev_state *state,
>  				 struct v4l2_subdev_mbus_code_enum *code)
> @@ -819,12 +804,23 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
>  	struct v4l2_rect *crop;
>  	unsigned int bin_h, bin_v;
>
> +	/*
> +	 * Adjust the requested format to match the closest mode. The Bayer
> +	 * order varies with flips.
> +	 */
>  	mode = v4l2_find_nearest_size(supported_modes,
>  				      ARRAY_SIZE(supported_modes),
>  				      width, height,
>  				      fmt->format.width, fmt->format.height);
>
> -	imx219_update_pad_format(imx219, mode, &fmt->format, fmt->format.code);
> +	fmt->format.code = imx219_get_format_code(imx219, fmt->format.code);
> +	fmt->format.width = mode->width;
> +	fmt->format.height = mode->height;
> +	fmt->format.field = V4L2_FIELD_NONE;
> +	fmt->format.colorspace = V4L2_COLORSPACE_RAW;
> +	fmt->format.ycbcr_enc = V4L2_YCBCR_ENC_601;
> +	fmt->format.quantization = V4L2_QUANTIZATION_FULL_RANGE;
> +	fmt->format.xfer_func = V4L2_XFER_FUNC_NONE;
>
>  	format = v4l2_subdev_state_get_format(state, 0);
>  	*format = fmt->format;
> --
> Regards,
>
> Laurent Pinchart
>
>




[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