All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-media@vger.kernel.org
Cc: Steve Longerbeam <slongerbeam@gmail.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Rui Miguel Silva <rmfrfs@gmail.com>
Subject: [PATCH 3/8] media: imx: utils: Inline init_mbus_colorimetry() in its caller
Date: Tue, 10 Mar 2020 18:18:40 +0200	[thread overview]
Message-ID: <20200310161845.1588-4-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <20200310161845.1588-1-laurent.pinchart@ideasonboard.com>

The init_mbus_colorimetry() function is small and used in a single
place. The code becomes easier to follow if it gets inline in its
caller. Do so.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/staging/media/imx/imx-media-utils.c | 24 +++++++++------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c
index fae981698c49..75c4097a9d16 100644
--- a/drivers/staging/media/imx/imx-media-utils.c
+++ b/drivers/staging/media/imx/imx-media-utils.c
@@ -233,19 +233,6 @@ static const struct imx_media_pixfmt ipu_rgb_formats[] = {
 
 #define NUM_IPU_RGB_FORMATS ARRAY_SIZE(ipu_rgb_formats)
 
-static void init_mbus_colorimetry(struct v4l2_mbus_framefmt *mbus,
-				  const struct imx_media_pixfmt *fmt)
-{
-	mbus->colorspace = (fmt->cs == IPUV3_COLORSPACE_RGB) ?
-		V4L2_COLORSPACE_SRGB : V4L2_COLORSPACE_SMPTE170M;
-	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(fmt->cs == IPUV3_COLORSPACE_RGB,
-					      mbus->colorspace,
-					      mbus->ycbcr_enc);
-}
-
 static const
 struct imx_media_pixfmt *__find_format(u32 fourcc,
 				       u32 code,
@@ -488,7 +475,16 @@ int imx_media_init_mbus_fmt(struct v4l2_mbus_framefmt *mbus,
 	}
 
 	mbus->code = code;
-	init_mbus_colorimetry(mbus, lcc);
+
+	mbus->colorspace = (lcc->cs == IPUV3_COLORSPACE_RGB)
+			? V4L2_COLORSPACE_SRGB : V4L2_COLORSPACE_SMPTE170M;
+	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->cs == IPUV3_COLORSPACE_RGB,
+					      mbus->colorspace,
+					      mbus->ycbcr_enc);
+
 	if (cc)
 		*cc = lcc;
 
-- 
Regards,

Laurent Pinchart


  parent reply	other threads:[~2020-03-10 16:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-10 16:18 [PATCH 0/8] media: imx: Miscalleanous format-related cleanups Laurent Pinchart
2020-03-10 16:18 ` [PATCH 1/8] media: imx: imx7-mipi-csis: Cleanup and fix subdev pad format handling Laurent Pinchart
2020-03-10 16:18 ` [PATCH 2/8] media: imx: imx7-mipi-csis: Centralize initialization of pad formats Laurent Pinchart
2020-03-10 16:18 ` Laurent Pinchart [this message]
2020-03-10 16:18 ` [PATCH 4/8] media: imx: utils: Handle Bayer format lookup through a selection flag Laurent Pinchart
2020-03-10 16:18 ` [PATCH 5/8] media: imx: utils: Simplify IPU format lookup and enumeration Laurent Pinchart
2020-03-10 16:18 ` [PATCH 6/8] media: imx: utils: Make imx_media_pixfmt handle variable number of codes Laurent Pinchart
2020-03-10 16:18 ` [PATCH 7/8] media: imx: utils: Remove unneeded argument to (find|enum)_format() Laurent Pinchart
2020-03-10 16:18 ` [PATCH 8/8] media: imx: utils: Rename format lookup and enumeration functions Laurent Pinchart
2020-03-10 22:05 ` [PATCH 9/8] media: imx: utils: Constify mbus argument to imx_media_mbus_fmt_to_pix_fmt Laurent Pinchart
2020-03-11 14:35 ` [PATCH 0/8] media: imx: Miscalleanous format-related cleanups Rui Miguel Silva
2020-03-12  0:16 ` Steve Longerbeam
2020-03-12  0:47   ` Laurent Pinchart
2020-03-12  0:55     ` Steve Longerbeam
2020-03-14 22:30     ` Steve Longerbeam
2020-03-14 22:32       ` Laurent Pinchart
2020-03-14 22:33         ` Steve Longerbeam
2020-03-26 19:05         ` Steve Longerbeam
2020-03-26 19:53           ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200310161845.1588-4-laurent.pinchart@ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=rmfrfs@gmail.com \
    --cc=slongerbeam@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.