Re: [PATCH] ASoC: ux500: avoid -Wparentheses warning
From: Linus Walleij
Date: Wed Sep 16 2026 - 05:23:46 EST
On Tue, Sep 15, 2026 at 10:20 PM Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> gcc warns about a slightly confusing expression in two lines
> of this driver:
>
> In file included from sound/soc/ux500/ux500_msp_i2s.c:20:
> sound/soc/ux500/ux500_msp_i2s.c: In function 'configure_protocol':
> sound/soc/ux500/ux500_msp_i2s.h:151:38: error: suggest parentheses around arithmetic in operand of '^' [-Werror=parentheses]
> 151 | #define MSP_TX_CLKPOL_BIT(n) ((n & TCKPOL_MASK) << TCKPOL_SHIFT)
> sound/soc/ux500/ux500_msp_i2s.c:204:21: note: in expansion of macro 'MSP_TX_CLKPOL_BIT'
> 204 | temp_reg |= MSP_TX_CLKPOL_BIT(!protdesc->tx_clk_pol ^
> | ^~~~~~~~~~~~~~~~~
>
> config->bclk_inverted is a boolean variable, while protdesc->tx_clk_pol
> is a 32-bit unsigned integer that can only be zero or one in order to
> be passed into MSP_RX_CLKPOL_BIT().
>
> Move the negation out of the inner expression to make this easier
> to understand by the compiler.
>
> Fixes: 9ccbacf5a012 ("ASoC: ux500: Validate MSP DAI configuration")
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
OK fair eniugh,
Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>
Yours,
Linus Walleij