Re: [PATCH 08/13] media: imx355: pixel_rate never changes, so don't recompute

From: Jacopo Mondi

Date: Thu May 07 2026 - 10:20:35 EST


Hi Dave

On Wed, May 06, 2026 at 07:23:46PM +0100, Dave Stevenson wrote:
> The pixel rate is always the same, so there is no need to try and
> recompute it in imx355_set_pad_format, and then no need to have the
> pointer to it stored.
>
> Signed-off-by: Dave Stevenson <dave.stevenson@xxxxxxxxxxxxxxx>

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

> ---
> drivers/media/i2c/imx355.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/media/i2c/imx355.c b/drivers/media/i2c/imx355.c
> index b0cddb614775..12005bc40f36 100644
> --- a/drivers/media/i2c/imx355.c
> +++ b/drivers/media/i2c/imx355.c
> @@ -161,7 +161,6 @@ struct imx355 {
> struct v4l2_ctrl_handler ctrl_handler;
> /* V4L2 Controls */
> struct v4l2_ctrl *link_freq;
> - struct v4l2_ctrl *pixel_rate;
> struct v4l2_ctrl *vblank;
> struct v4l2_ctrl *hblank;
> struct v4l2_ctrl *exposure;
> @@ -860,7 +859,6 @@ imx355_set_pad_format(struct v4l2_subdev *sd,
> s32 vblank_def;
> s32 vblank_min;
> s64 h_blank;
> - u64 pixel_rate;
> u32 height;
>
> mutex_lock(&imx355->mutex);
> @@ -881,9 +879,6 @@ imx355_set_pad_format(struct v4l2_subdev *sd,
> *framefmt = fmt->format;
> } else {
> imx355->cur_mode = mode;
> - pixel_rate = IMX355_LINK_FREQ_DEFAULT * 2 * 4;
> - do_div(pixel_rate, 10);
> - __v4l2_ctrl_s_ctrl_int64(imx355->pixel_rate, pixel_rate);
> /* Update limits and set FPS to default */
> height = imx355->cur_mode->height;
> vblank_def = imx355->cur_mode->fll_def - height;
> @@ -1175,9 +1170,8 @@ static int imx355_init_controls(struct imx355 *imx355)
> pixel_rate = IMX355_LINK_FREQ_DEFAULT * 2 * 4;
> do_div(pixel_rate, 10);
> /* By default, PIXEL_RATE is read only */
> - imx355->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &imx355_ctrl_ops,
> - V4L2_CID_PIXEL_RATE, pixel_rate,
> - pixel_rate, 1, pixel_rate);
> + v4l2_ctrl_new_std(ctrl_hdlr, &imx355_ctrl_ops, V4L2_CID_PIXEL_RATE,
> + pixel_rate, pixel_rate, 1, pixel_rate);
>
> /* Initialize vblank/hblank/exposure parameters based on current mode */
> mode = imx355->cur_mode;
>
> --
> 2.34.1
>
>