Re: [PATCH v4 04/10] dma-engine: sun4i: Add support for Allwinner suniv F1C100s

From: Csókás Bence
Date: Sat Nov 02 2024 - 05:07:12 EST


On 2024. 10. 31. 20:05, Amit Singh Tomar wrote:
   #define SUN4I_DMA_CFG_SRC_ADDR_MODE(mode)    ((mode) << 5)
   #define SUN4I_DMA_CFG_SRC_DRQ_TYPE(type)    (type)
+#define SUNIV_DMA_CFG_DST_DATA_WIDTH(width)    ((width) << 24)
+#define SUNIV_DMA_CFG_SRC_DATA_WIDTH(width)    ((width) << 8)

nit: Are the extra parentheses around width truly necessary? They seem to be used throughout the file.

It's macro safety. So for instance if someone writes ~SUNIV_DMA_CFG_DST_DATA_WIDTH(1 + 2), which would expand to ~1 + 2 << 24 it doesn't get mis-interpreted as (~1) + (2 << 24) for instance. So yeah, I sure hope that _all code_ that has macros with parameters did not forget to wrap everything in parentheses, and not just "throughout [this] file".

Bence