linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guoniu Zhou <guoniu.zhou@nxp.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Shawn Guo <shawnguo@kernel.org>,
	 Sascha Hauer <s.hauer@pengutronix.de>,
	 Pengutronix Kernel Team <kernel@pengutronix.de>,
	 Fabio Estevam <festevam@gmail.com>, Frank Li <frank.li@nxp.com>
Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	 imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	 linux-kernel@vger.kernel.org, Guoniu Zhou <guoniu.zhou@nxp.com>
Subject: [PATCH 2/5] media: nxp: imx8-isi: Simplify code by using helper macro
Date: Wed, 27 Aug 2025 17:53:49 +0800	[thread overview]
Message-ID: <20250827-isi_imx93-v1-2-83e6b4b50c4d@nxp.com> (raw)
In-Reply-To: <20250827-isi_imx93-v1-0-83e6b4b50c4d@nxp.com>

Simplify code by using helper macro FIELD_PREP() and GENMASK().

No functions changed.

Signed-off-by: Guoniu Zhou <guoniu.zhou@nxp.com>
---
 drivers/media/platform/nxp/imx8-isi/imx8-isi-gasket.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-gasket.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-gasket.c
index f69c3b5d478209c083738477edf380e3f280c471..c05e26798032367813c8730550a7eec2f237b4eb 100644
--- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-gasket.c
+++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-gasket.c
@@ -16,8 +16,7 @@
 #define GASKET_BASE(n)				(0x0060 + (n) * 0x30)
 
 #define GASKET_CTRL				0x0000
-#define GASKET_CTRL_DATA_TYPE(dt)		((dt) << 8)
-#define GASKET_CTRL_DATA_TYPE_MASK		(0x3f << 8)
+#define GASKET_CTRL_DATA_TYPE(dt)		FIELD_PREP(GENMASK(13, 8), (dt))
 #define GASKET_CTRL_DUAL_COMP_ENABLE		BIT(1)
 #define GASKET_CTRL_ENABLE			BIT(0)
 
@@ -58,7 +57,7 @@ const struct mxc_gasket_ops mxc_imx8_gasket_ops = {
  */
 
 #define DISP_MIX_CAMERA_MUX                     0x30
-#define DISP_MIX_CAMERA_MUX_DATA_TYPE(x)        (((x) & 0x3f) << 3)
+#define DISP_MIX_CAMERA_MUX_DATA_TYPE(x)        FIELD_PREP(GENMASK(8, 3), (x))
 #define DISP_MIX_CAMERA_MUX_GASKET_ENABLE       BIT(16)
 
 static void mxc_imx93_gasket_enable(struct mxc_isi_dev *isi,

-- 
2.34.1


  parent reply	other threads:[~2025-08-27  9:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-27  9:53 [PATCH 0/5] media: imx91: Add ISI support Guoniu Zhou
2025-08-27  9:53 ` [PATCH 1/5] media: dt-bindings: nxp,imx8-isi: Add i.MX91 ISI compatible string Guoniu Zhou
2025-08-27 12:58   ` Krzysztof Kozlowski
2025-08-27 14:40   ` Frank Li
2025-08-27  9:53 ` Guoniu Zhou [this message]
2025-08-27 14:28   ` [PATCH 2/5] media: nxp: imx8-isi: Simplify code by using helper macro Frank Li
2025-08-27 16:29   ` kernel test robot
2025-08-27  9:53 ` [PATCH 3/5] media: nxp: imx8-isi: Add parallel camera input support Guoniu Zhou
2025-08-27 14:29   ` Frank Li
2025-08-27  9:53 ` [PATCH 4/5] media: nxp: imx8-isi: Reorder the platform data Guoniu Zhou
2025-08-27 14:30   ` Frank Li
2025-08-27  9:53 ` [PATCH 5/5] media: nxp: imx8-isi: Add ISI support for i.MX91 Guoniu Zhou
2025-08-27 14:39   ` Frank Li
2025-08-27 13:00 ` [PATCH 0/5] media: imx91: Add ISI support Krzysztof Kozlowski

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=20250827-isi_imx93-v1-2-83e6b4b50c4d@nxp.com \
    --to=guoniu.zhou@nxp.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=frank.li@nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=krzk+dt@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).