Skip to contentSkip to conversation

drm/sun4i: Fix macros in sun8i_csc.h

PATCH In review Jernej Skrabec 3 participants 3 messages Aug 31, 2021 – Sep 1, 2021

Subsystems (6)
lore
Share & tools
lore

Jernej Skrabec

author maintainer
#0 lore raw

PATCH 1/1 drm/sun4i: Fix macros in sun8i_csc.h

Macros SUN8I_CSC_CTRL() and SUN8I_CSC_COEFF() don't follow usual recommendation of having arguments enclosed in parenthesis. While that didn't change anything for quiet sometime, it actually become important after CSC code rework with commit ea067aee45a8 ("drm/sun4i: de2/de3:
Remove redundant CSC matrices").

Without this fix, colours are completely off for supported YVU formats on SoCs with DE2 (A64, H3, R40, etc.).

Fix the issue by enclosing macro arguments in parenthesis.

Fixes 883029390550 ("drm/sun4i: Add DE2 CSC library")
---
 drivers/gpu/drm/sun4i/sun8i_csc.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/sun4i/sun8i_csc.h +2 -2
index a55a38ad849c..022cafa6c06c 100644
@@ -16,8 +16,8 @@ struct sun8i_mixer;
 #define CCSC10_OFFSET 0xA0000
 #define CCSC11_OFFSET 0xF0000
 
-#define SUN8I_CSC_CTRL(base)		(base + 0x0)
-#define SUN8I_CSC_COEFF(base, i)	(base + 0x10 + 4 * i)
+#define SUN8I_CSC_CTRL(base)		((base) + 0x0)
+#define SUN8I_CSC_COEFF(base, i)	((base) + 0x10 + 4 * (i))
 
 #define SUN8I_CSC_CTRL_EN		BIT(0)
 
Signature · 1 line
2.33.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Jernej Skrabec

Macros SUN8I_CSC_CTRL() and SUN8I_CSC_COEFF() don't follow usual recommendation of having arguments enclosed in parenthesis. While that didn't change anything for quiet sometime, it actually become important

^ Typo

Quoted 6 lines

after CSC code rework with commit ea067aee45a8 ("drm/sun4i: de2/de3:
Remove redundant CSC matrices").

Without this fix, colours are completely off for supported YVU formats on SoCs with DE2 (A64, H3, R40, etc.).

Quoted 6 lines

Fix the issue by enclosing macro arguments in parenthesis.

Fixes 883029390550 ("drm/sun4i: Add DE2 CSC library")

Otherwise,

#2 lore raw
Quoted 16 lines · Chen-Yu Tsai
Quoted 4 lines · Jernej Skrabec

Macros SUN8I_CSC_CTRL() and SUN8I_CSC_COEFF() don't follow usual recommendation of having arguments enclosed in parenthesis. While that didn't change anything for quiet sometime, it actually become important

^ Typo

Quoted 8 lines

after CSC code rework with commit ea067aee45a8 ("drm/sun4i: de2/de3:
Remove redundant CSC matrices").

Without this fix, colours are completely off for supported YVU formats on SoCs with DE2 (A64, H3, R40, etc.).

Fix the issue by enclosing macro arguments in parenthesis.

Quoted 8 lines
Quoted 4 lines
Fixes 883029390550 ("drm/sun4i: Add DE2 CSC library")

Otherwise,

Fixed the typo and applied, thanks
Maxime