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 v2 07/11] media: imx: utils: Remove unneeded argument to (find|enum)_format()
Date: Fri, 27 Mar 2020 00:08:36 +0200	[thread overview]
Message-ID: <20200326220840.18540-8-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <20200326220840.18540-1-laurent.pinchart@ideasonboard.com>

The find_format() and enum_format() functions take an argument that
tells whether to take into account formats that don't have associated
media bus codes. The same information can be deduced from the fourcc
argument passed to these functions. Remove the allow_non_mbus argument
and use fourcc instead internally.

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

diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c
index 2dcb6285a6c0..cbf441716cab 100644
--- a/drivers/staging/media/imx/imx-media-utils.c
+++ b/drivers/staging/media/imx/imx-media-utils.c
@@ -196,8 +196,7 @@ static const struct imx_media_pixfmt pixel_formats[] = {
 static const
 struct imx_media_pixfmt *find_format(u32 fourcc,
 				     u32 code,
-				     enum codespace_sel cs_sel,
-				     bool allow_non_mbus)
+				     enum codespace_sel cs_sel)
 {
 	bool allow_bayer = cs_sel & CS_SEL_BAYER;
 	unsigned int i;
@@ -213,7 +212,7 @@ struct imx_media_pixfmt *find_format(u32 fourcc,
 			   ? CS_SEL_YUV : CS_SEL_RGB;
 
 		if ((cs_sel != CS_SEL_ANY && fmt_cs_sel != cs_sel) ||
-		    (!allow_non_mbus && !fmt->codes) ||
+		    (!fourcc && !fmt->codes) ||
 		    (!allow_bayer && fmt->bayer))
 			continue;
 
@@ -233,8 +232,7 @@ struct imx_media_pixfmt *find_format(u32 fourcc,
 }
 
 static int enum_format(u32 *fourcc, u32 *code, u32 index,
-		       enum codespace_sel cs_sel,
-		       bool allow_non_mbus)
+		       enum codespace_sel cs_sel)
 {
 	bool allow_bayer = cs_sel & CS_SEL_BAYER;
 	unsigned int i;
@@ -250,7 +248,7 @@ static int enum_format(u32 *fourcc, u32 *code, u32 index,
 			   ? CS_SEL_YUV : CS_SEL_RGB;
 
 		if ((cs_sel != CS_SEL_ANY && fmt_cs_sel != cs_sel) ||
-		    (!allow_non_mbus && !fmt->codes) ||
+		    (!fourcc && !fmt->codes) ||
 		    (!allow_bayer && fmt->bayer))
 			continue;
 
@@ -280,26 +278,26 @@ static int enum_format(u32 *fourcc, u32 *code, u32 index,
 const struct imx_media_pixfmt *
 imx_media_find_format(u32 fourcc, enum codespace_sel cs_sel)
 {
-	return find_format(fourcc, 0, cs_sel, true);
+	return find_format(fourcc, 0, cs_sel);
 }
 EXPORT_SYMBOL_GPL(imx_media_find_format);
 
 int imx_media_enum_format(u32 *fourcc, u32 index, enum codespace_sel cs_sel)
 {
-	return enum_format(fourcc, NULL, index, cs_sel, true);
+	return enum_format(fourcc, NULL, index, cs_sel);
 }
 EXPORT_SYMBOL_GPL(imx_media_enum_format);
 
 const struct imx_media_pixfmt *
 imx_media_find_mbus_format(u32 code, enum codespace_sel cs_sel)
 {
-	return find_format(0, code, cs_sel, false);
+	return find_format(0, code, cs_sel);
 }
 EXPORT_SYMBOL_GPL(imx_media_find_mbus_format);
 
 int imx_media_enum_mbus_format(u32 *code, u32 index, enum codespace_sel cs_sel)
 {
-	return enum_format(NULL, code, index, cs_sel, false);
+	return enum_format(NULL, code, index, cs_sel);
 }
 EXPORT_SYMBOL_GPL(imx_media_enum_mbus_format);
 
-- 
Regards,

Laurent Pinchart


  parent reply	other threads:[~2020-03-26 22:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-26 22:08 [PATCH v2 00/11] media: imx: Miscalleanous format-related cleanups Laurent Pinchart
2020-03-26 22:08 ` [PATCH v2 01/11] media: imx: fix and simplify pixel format enumeration Laurent Pinchart
2020-03-26 22:08 ` [PATCH v2 02/11] media: imx: fix media bus " Laurent Pinchart
2020-03-26 22:08 ` [PATCH v2 03/11] media: imx: utils: Inline init_mbus_colorimetry() in its caller Laurent Pinchart
2020-03-26 22:08 ` [PATCH v2 04/11] media: imx: utils: Handle Bayer format lookup through a selection flag Laurent Pinchart
2020-03-26 22:08 ` [PATCH v2 05/11] media: imx: utils: Simplify IPU format lookup and enumeration Laurent Pinchart
2020-03-26 22:08 ` [PATCH v2 06/11] media: imx: utils: Make imx_media_pixfmt handle variable number of codes Laurent Pinchart
2020-03-26 22:08 ` Laurent Pinchart [this message]
2020-03-26 22:08 ` [PATCH v2 08/11] media: imx: utils: Rename format lookup and enumeration functions Laurent Pinchart
2020-03-26 22:08 ` [PATCH v2 09/11] media: imx: utils: Constify mbus argument to imx_media_mbus_fmt_to_pix_fmt Laurent Pinchart
2020-03-26 22:08 ` [PATCH v2 10/11] media: imx: utils: Decouple mbus- and pixel-based format lookup and enum Laurent Pinchart
2020-03-26 22:08 ` [PATCH v2 11/11] media: imx: utils: Add ability to filter pixel formats by mbus code 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=20200326220840.18540-8-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.