From: Arnd Bergmann <arnd@kernel.org>
To: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>, Linus Walleij <linusw@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] ASoC: ux500: avoid -Wparentheses warning
Date: Tue, 15 Sep 2026 22:20:31 +0200 [thread overview]
Message-ID: <20260915202038.3534453-1-arnd@kernel.org> (raw)
From: Arnd Bergmann <arnd@arndb.de>
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@arndb.de>
---
I still find the new version equally confusing, if anyone has a
better idea to make this more readable, let's do that instead.
---
sound/soc/ux500/ux500_msp_i2s.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c
index 683b485fb570..588d381230b6 100644
--- a/sound/soc/ux500/ux500_msp_i2s.c
+++ b/sound/soc/ux500/ux500_msp_i2s.c
@@ -201,12 +201,12 @@ static int configure_protocol(struct ux500_msp *msp,
/* The code below should not be separated. */
temp_reg = readl(msp->registers + MSP_GCR) & ~TX_CLK_POL_RISING;
- temp_reg |= MSP_TX_CLKPOL_BIT(!protdesc->tx_clk_pol ^
- config->bclk_inverted);
+ temp_reg |= MSP_TX_CLKPOL_BIT(!(protdesc->tx_clk_pol ^
+ config->bclk_inverted));
writel(temp_reg, msp->registers + MSP_GCR);
temp_reg = readl(msp->registers + MSP_GCR) & ~RX_CLK_POL_RISING;
- temp_reg |= MSP_RX_CLKPOL_BIT(protdesc->rx_clk_pol ^
- config->bclk_inverted);
+ temp_reg |= MSP_RX_CLKPOL_BIT(!!(protdesc->rx_clk_pol ^
+ config->bclk_inverted));
writel(temp_reg, msp->registers + MSP_GCR);
return 0;
--
2.53.0
next reply other threads:[~2026-09-15 20:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 20:20 Arnd Bergmann [this message]
2026-09-16 9:15 ` Linus Walleij
2026-09-16 12:34 ` David Laight
2026-09-16 12:36 ` Mark Brown
2026-09-16 12:50 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260915202038.3534453-1-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=arnd@arndb.de \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linusw@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®