Skip to content

Commit 34e3d3c

Browse files
Jacopo Mondimchehab
authored andcommitted
media: i2c: imx219: Simplify code handling in s_fmt
The imx219_set_pad_format() function adjusts the media bus code provided through the v4l2_subdev_format parameter to a media bus code known to be supported by the sensor. The same exact operation is performed by the imx219_get_format_code() function which called by imx219_update_pad_format(), which is in the imx219_set_pad_format() call path. Remove the duplicated operation and simplify imx219_set_pad_format(). Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
1 parent 7319d57 commit 34e3d3c

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

drivers/media/i2c/imx219.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -750,21 +750,13 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
750750
const struct imx219_mode *mode;
751751
int exposure_max, exposure_def, hblank;
752752
struct v4l2_mbus_framefmt *format;
753-
unsigned int i;
754-
755-
for (i = 0; i < ARRAY_SIZE(imx219_mbus_formats); i++)
756-
if (imx219_mbus_formats[i] == fmt->format.code)
757-
break;
758-
if (i >= ARRAY_SIZE(imx219_mbus_formats))
759-
i = 0;
760753

761754
mode = v4l2_find_nearest_size(supported_modes,
762755
ARRAY_SIZE(supported_modes),
763756
width, height,
764757
fmt->format.width, fmt->format.height);
765758

766-
imx219_update_pad_format(imx219, mode, &fmt->format,
767-
imx219_mbus_formats[i]);
759+
imx219_update_pad_format(imx219, mode, &fmt->format, fmt->format.code);
768760
format = v4l2_subdev_get_pad_format(sd, sd_state, 0);
769761

770762
if (imx219->mode == mode && format->code == fmt->format.code)

0 commit comments

Comments
 (0)