[PATCH 43/50] staging: media: imx: imx7-media-csi: Inline imx7_csi_init_mbus_fmt()

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

 



Inline the imx7_csi_init_mbus_fmt() function in its only caller. This
allows simplifying the code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
---
 drivers/staging/media/imx/imx7-media-csi.c | 54 ++++++----------------
 1 file changed, 15 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c
index b3fa3e20873b..bc3a87656117 100644
--- a/drivers/staging/media/imx/imx7-media-csi.c
+++ b/drivers/staging/media/imx/imx7-media-csi.c
@@ -1022,39 +1022,6 @@ static int imx7_csi_enum_mbus_formats(u32 *code, u32 index)
 	return -EINVAL;
 }
 
-static int imx7_csi_init_mbus_fmt(struct v4l2_mbus_framefmt *mbus,
-				  u32 width, u32 height, u32 code, u32 field,
-				  const struct imx7_csi_pixfmt **cc)
-{
-	const struct imx7_csi_pixfmt *lcc;
-
-	mbus->width = width;
-	mbus->height = height;
-	mbus->field = field;
-
-	if (code == 0)
-		code = IMX7_CSI_DEF_MBUS_CODE;
-
-	lcc = imx7_csi_find_mbus_format(code);
-	if (!lcc)
-		return -EINVAL;
-
-	mbus->code = code;
-
-	mbus->colorspace = V4L2_COLORSPACE_SRGB;
-	mbus->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(mbus->colorspace);
-	mbus->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(mbus->colorspace);
-	mbus->quantization =
-		V4L2_MAP_QUANTIZATION_DEFAULT(!lcc->yuv,
-					      mbus->colorspace,
-					      mbus->ycbcr_enc);
-
-	if (cc)
-		*cc = lcc;
-
-	return 0;
-}
-
 static int imx7_csi_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix,
 					const struct v4l2_mbus_framefmt *mbus,
 					const struct imx7_csi_pixfmt *cc)
@@ -1738,18 +1705,27 @@ static int imx7_csi_init_cfg(struct v4l2_subdev *sd,
 	const enum v4l2_subdev_format_whence which =
 		sd_state ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE;
 	struct imx7_csi *csi = v4l2_get_subdevdata(sd);
-	int ret;
+	const struct imx7_csi_pixfmt *cc;
 	int i;
 
+	cc = imx7_csi_find_mbus_format(IMX7_CSI_DEF_MBUS_CODE);
+
 	for (i = 0; i < IMX7_CSI_PADS_NUM; i++) {
 		struct v4l2_mbus_framefmt *mf =
 			imx7_csi_get_format(csi, sd_state, i, which);
 
-		ret = imx7_csi_init_mbus_fmt(mf, IMX7_CSI_DEF_PIX_WIDTH,
-					     IMX7_CSI_DEF_PIX_HEIGHT, 0,
-					     V4L2_FIELD_NONE, &csi->cc[i]);
-		if (ret < 0)
-			return ret;
+		mf->code = IMX7_CSI_DEF_MBUS_CODE;
+		mf->width = IMX7_CSI_DEF_PIX_WIDTH;
+		mf->height = IMX7_CSI_DEF_PIX_HEIGHT;
+		mf->field = V4L2_FIELD_NONE;
+
+		mf->colorspace = V4L2_COLORSPACE_SRGB;
+		mf->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(mf->colorspace);
+		mf->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(mf->colorspace);
+		mf->quantization = V4L2_MAP_QUANTIZATION_DEFAULT(!cc->yuv,
+					mf->colorspace, mf->ycbcr_enc);
+
+		csi->cc[i] = cc;
 	}
 
 	return 0;
-- 
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