From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm2-f12.google.com (mail-wm2-f12.google.com [74.125.225.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A1374E56CB for ; Wed, 16 Sep 2026 12:34:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.140 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789562097; cv=none; b=naJ0DhAu02PObxqwmlD/vJhWwHbdU8TahSSun4ZyfosF6o637o+8uoPdqhWA//9CDqppVBn74mMlTy1k1unwfIl9WxZqKPr19eUtNkNRVOZCOa00g8/DGV5RuOfgnzN/ozgJ7wSKMyy1EbHgr9/2kRfka7cSHqBgHi+WYgTEePg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789562097; c=relaxed/simple; bh=J2mnMneTYDIrpgB5k5VIkuxwj0BCnLfl7kCAK1Mrvtw=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=am+3FUxmXGsW46Qrbkgdb8WSV8uQIAOq2dAw9h8+nogUal1Hh0BKnEtGCNlAXd93X9RP5z7uZi8ABwQ9Vhwkfh5cwFYZ5sjo4Xo3HJ7zhDbdmLHeLLJwElIld1VFTScUhDSL76ogq3iB/TJgDmx4RKbGaU53yjE9SMLxs6E/ZzY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DiEpCa7W; arc=none smtp.client-ip=74.125.225.140 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DiEpCa7W" Received: by mail-wm2-f12.google.com with SMTP id 5b1f17b1804b1-49e69b9e16aso8565325e9.1 for ; Wed, 16 Sep 2026 05:34:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789562088; x=1790166888; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=wmytOkW2R/xIUqZXV3QPl8yko/uu1lEG9yR+JJLsZQc=; b=DiEpCa7Wo/uFu4wx5mcsUKYPkZ+X2biNDLoeA3nmLjhZNInCEkGAD1WNRz9tC6YP1Y DEAp3VKAyLfWQoHSrZOf8Ja0Xuv70iEVom1UwOm+bg5a77B+Us672pSSJhOyT9lxENdm WQr//ExCqxprQbPR7ITV1+mC9Gaie7zWuhjSwqQ4PCSdiNLHyZAFZnKl3J7SgTVSyemL CShDuF4SJc7Psg4oLpiBADyyPY3aPUtYCjHRZpd7WTaA4bN9UmBDNEEHfyDwANtWZbwa e4hLmOHti4AU0bIzAnvkRnkMYqwt2WZsBztJFDmRcOEh1i3HfPELAU3vm+P295s0O5Yg EdQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789562088; x=1790166888; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=wmytOkW2R/xIUqZXV3QPl8yko/uu1lEG9yR+JJLsZQc=; b=aCeuzVKoP+FEd0edyjiGiOP/xSXv9/9tO196/tRzyvsB/hK6qW35HaRf+UnJOTkAF3 gwYdcEGZR4YR7QDxGI3tq/xwCvtI936ZHCA+PNToBeJHp/k9dF55ZvFWhOt5iA9Rysb+ wgSKPwANhT709bsaPu4hOM0rqI0G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8.1789562087480; Wed, 16 Sep 2026 05:34:47 -0700 (PDT) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49e84202028sm57591175e9.0.2026.09.16.05.34.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2026 05:34:47 -0700 (PDT) Date: Wed, 16 Sep 2026 13:34:42 +0100 From: David Laight To: Arnd Bergmann Cc: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Linus Walleij , Arnd Bergmann , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ASoC: ux500: avoid -Wparentheses warning Message-ID: <20260916133442.2d21ff5f@pumpkin> In-Reply-To: <20260915202038.3534453-1-arnd@kernel.org> References: <20260915202038.3534453-1-arnd@kernel.org> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 15 Sep 2026 22:20:31 +0200 Arnd Bergmann wrote: > From: Arnd Bergmann > > 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 > --- > I still find the new version equally confusing, if anyone has a > better idea to make this more readable, let's do that instead. How about: temp_reg = readl(msp->registers + MSP_GCR); if (protdesc->tx_clk_pol ^ config->bclk_inverted) temp_req &= ~TX_CLK_POL_RISING; else temp_req |= TX_CLK_POL_RISING; if (protdesc->rx_clk_pol ^ config->bclk_inverted) temp_req |= RX_CLK_POL_RISING; else temp_req &= ~RX_CLK_POL_RISING; writel(temp_reg, msp->registers + MSP_GCR); Assuming that [rt]x_clk_pol is only ever 0 or 1, if invalid if will default to 'normal polarity; clocks. Completely open-coding it removes the negation. You could try replacing the ^ with != David > --- > 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;