[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4a52cf8b-dd55-4bf8-8c37-29c07749bee0@prolan.hu>
Date: Sat, 2 Nov 2024 10:06:49 +0100
From: Csókás Bence <csokas.bence@...lan.hu>
To: Amit Singh Tomar <amitsinght@...vell.com>, <dmaengine@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>,
<linux-sunxi@...ts.linux.dev>
CC: Mesih Kilinc <mesihkilinc@...il.com>, Vinod Koul <vkoul@...nel.org>,
Chen-Yu Tsai <wens@...e.org>, Jernej Skrabec <jernej.skrabec@...il.com>,
Samuel Holland <samuel@...lland.org>
Subject: Re: [PATCH v4 04/10] dma-engine: sun4i: Add support for Allwinner
suniv F1C100s
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
Powered by blists - more mailing lists