[PATCH 2/5] media: nxp: imx8-isi: Simplify code by using helper macro
Frank Li
Frank.li at nxp.com
Wed Aug 27 07:28:22 PDT 2025
On Wed, Aug 27, 2025 at 05:53:49PM +0800, Guoniu Zhou wrote:
> Simplify code by using helper macro FIELD_PREP() and GENMASK().
>
> No functions changed.
>
> Signed-off-by: Guoniu Zhou <guoniu.zhou at nxp.com>
Reviewed-by: Frank Li <Frank.Li at 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
>
More information about the linux-arm-kernel
mailing list