]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: imx-pxp: Rewrite coeff expression
authorRicardo Ribalda <ribalda@chromium.org>
Fri, 28 Jun 2024 15:11:15 +0000 (15:11 +0000)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Fri, 9 Aug 2024 05:56:38 +0000 (07:56 +0200)
GCC5 cannot figure out that the expressions are constant, and that
triggers a build failure. Rewrite the expressions.

The following gcc5 error is workaround:

 #define BM_PXP_CSC1_COEF0_YCBCR_MODE 0x80000000
                                      ^
    BM_PXP_CSC1_COEF0_YCBCR_MODE |
    ^
 #define BM_PXP_CSC1_COEF0_YCBCR_MODE 0x80000000
                                      ^

drivers/media/platform/nxp/imx-pxp.c: In function 'pxp_setup_csc':
drivers/media/platform/nxp/imx-pxp.h:582:38: error: initializer element is not constant
drivers/media/platform/nxp/imx-pxp.c:374:4: note: in expansion of macro 'BM_PXP_CSC1_COEF0_YCBCR_MODE'
drivers/media/platform/nxp/imx-pxp.h:582:38: note: (near initialization for 'csc1_coef_bt601_lim[0]')

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/nxp/imx-pxp.h

index 44f95c749d2ea6917f3576a18f5d82fd55103b02..476f2042fa6f32eda847a980fb261e4b808d3e4f 100644 (file)
        (((v) << 18) & BM_PXP_CSC1_COEF0_C0)
 #define BP_PXP_CSC1_COEF0_UV_OFFSET      9
 #define BM_PXP_CSC1_COEF0_UV_OFFSET 0x0003FE00
+
+/*
+ * We use v * (1 << 9) instead of v << 9, to workaround a gcc5 bug.
+ * The compiler cannot understand that the expression is constant.
+ */
 #define BF_PXP_CSC1_COEF0_UV_OFFSET(v)  \
-       (((v) << 9) & BM_PXP_CSC1_COEF0_UV_OFFSET)
+       (((v) * (1 << 9)) & BM_PXP_CSC1_COEF0_UV_OFFSET)
 #define BP_PXP_CSC1_COEF0_Y_OFFSET      0
 #define BM_PXP_CSC1_COEF0_Y_OFFSET 0x000001FF
 #define BF_PXP_CSC1_COEF0_Y_OFFSET(v)  \
-       (((v) << 0) & BM_PXP_CSC1_COEF0_Y_OFFSET)
+       ((v) & BM_PXP_CSC1_COEF0_Y_OFFSET)
 
 #define HW_PXP_CSC1_COEF1      (0x000001b0)