media: imx: imx7-media-csi: Simplify imx7_csi_video_init_format()
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Fri, 27 Jan 2023 01:21:57 +0000 (02:21 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Wed, 8 Feb 2023 08:05:08 +0000 (09:05 +0100)
The imx7_csi_video_init_format() function instantiates a
v4l2_subdev_format on the stack, to only use the .format field of that
structure. Replace it with a v4l2_mbus_framefmt instance.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Adam Ford <aford173@gmail.com> #imx8mm-beacon-kit
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Tested-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/platform/nxp/imx7-media-csi.c

index f1d7da7..112af72 100644 (file)
@@ -1600,17 +1600,15 @@ static struct imx7_csi_vb2_buffer *imx7_csi_video_next_buf(struct imx7_csi *csi)
 
 static int imx7_csi_video_init_format(struct imx7_csi *csi)
 {
-       struct v4l2_subdev_format fmt_src = {
-               .pad = IMX7_CSI_PAD_SRC,
-               .which = V4L2_SUBDEV_FORMAT_ACTIVE,
-       };
-       fmt_src.format.code = IMX7_CSI_DEF_MBUS_CODE;
-       fmt_src.format.width = IMX7_CSI_DEF_PIX_WIDTH;
-       fmt_src.format.height = IMX7_CSI_DEF_PIX_HEIGHT;
-
-       imx7_csi_mbus_fmt_to_pix_fmt(&csi->vdev_fmt, &fmt_src.format, NULL);
-       csi->vdev_compose.width = fmt_src.format.width;
-       csi->vdev_compose.height = fmt_src.format.height;
+       struct v4l2_mbus_framefmt format = { };
+
+       format.code = IMX7_CSI_DEF_MBUS_CODE;
+       format.width = IMX7_CSI_DEF_PIX_WIDTH;
+       format.height = IMX7_CSI_DEF_PIX_HEIGHT;
+
+       imx7_csi_mbus_fmt_to_pix_fmt(&csi->vdev_fmt, &format, NULL);
+       csi->vdev_compose.width = format.width;
+       csi->vdev_compose.height = format.height;
 
        csi->vdev_cc = imx7_csi_find_pixel_format(csi->vdev_fmt.pixelformat);