ASoC: adau1373: adau1373_hw_params: Silence overflow warning
authorTim Gardner <tim.gardner@canonical.com>
Mon, 11 Mar 2013 19:18:23 +0000 (13:18 -0600)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 11 Nov 2017 13:34:42 +0000 (13:34 +0000)
commitec7deb5897ca9b158713c8c06fb79769606dd7ce
tree83b94084889f74adf9907ec65a1623edcfb3689e
parentb88ca975802fdfc636f36df763628d41a4bd68d4
ASoC: adau1373: adau1373_hw_params: Silence overflow warning

commit 14a1b8ca172f4cfbc544051a729d85a380447a82 upstream.

ADAU1373_BCLKDIV_SOURCE is defined as BIT(5) which uses UL constants. On
amd64 the result of the ones complement operator is then truncated to
unsigned int according to the prototype of snd_soc_update_bits(). I think
gcc is correctly warning that the upper 32 bits are lost.

sound/soc/codecs/adau1373.c: In function 'adau1373_hw_params':
sound/soc/codecs/adau1373.c:940:3: warning: large integer implicitly truncated to unsigned type [-Woverflow]

gcc version 4.6.3

Add 2 more BCLKDIV mask macros as explained by Lars:

The BCLKDIV has three fields. The bitclock divider (bit 0-1), the samplerate
(bit 2-4) and the source select (bit 5). Here we want to update the bitclock
divider field and the samplerate field. When I wrote the code I was lazy and
used ~ADAU1373_BCLKDIV_SOURCE as the mask, which for this register is
functionally equivalent to ADAU1373_BCLKDIV_SR_MASK | ADAU1373_BCLKDIV_BCLK_MASK.

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
sound/soc/codecs/adau1373.c