Skip to content

Commit

Permalink
ASoC: ab8500-codec: Drop bank prefix from AB8500_GPIO_DIR4_REG regist…
Browse files Browse the repository at this point in the history
…er define

The AB8500_GPIO_DIR4_REG register define has the bank for the register in the
upper 8 bits and the register itself in the lower 8 bits. When passing it to
abx500_{set,get}_register_interruptible() the upper bits get truncated which
generates the following warning from sparse:
	sound/soc/codecs/ab8500-codec.c:1972:53: warning: cast truncates bits
	 from constant value (1013 becomes 13)
	sound/soc/codecs/ab8500-codec.c:1980:53: warning: cast truncates bits
	 from constant value (1013 becomes 13)

The bank is passed separately to abx500_{set,get}_register_interruptible() so
the code works fine as it is. Given that all users of AB8500_GPIO_DIR4_REG
always truncate the upper 8 bits just remove them from the define.

Also remove the unnecessary casts to u8.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Lars-Peter Clausen authored and Mark Brown committed Aug 17, 2014
1 parent 7d1311b commit 6391fff
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions sound/soc/codecs/ab8500-codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@
#define GPIO31_DIR_OUTPUT 0x40

/* Macrocell register definitions */
#define AB8500_CTRL3_REG 0x0200
#define AB8500_GPIO_DIR4_REG 0x1013
#define AB8500_GPIO_DIR4_REG 0x13 /* Bank AB8500_MISC */

/* Nr of FIR/IIR-coeff banks in ANC-block */
#define AB8500_NR_OF_ANC_COEFF_BANKS 2
Expand Down Expand Up @@ -1968,16 +1967,16 @@ static int ab8500_audio_setup_mics(struct snd_soc_codec *codec,
dev_dbg(codec->dev, "%s: Enter.\n", __func__);

/* Set DMic-clocks to outputs */
status = abx500_get_register_interruptible(codec->dev, (u8)AB8500_MISC,
(u8)AB8500_GPIO_DIR4_REG,
status = abx500_get_register_interruptible(codec->dev, AB8500_MISC,
AB8500_GPIO_DIR4_REG,
&value8);
if (status < 0)
return status;
value = value8 | GPIO27_DIR_OUTPUT | GPIO29_DIR_OUTPUT |
GPIO31_DIR_OUTPUT;
status = abx500_set_register_interruptible(codec->dev,
(u8)AB8500_MISC,
(u8)AB8500_GPIO_DIR4_REG,
AB8500_MISC,
AB8500_GPIO_DIR4_REG,
value);
if (status < 0)
return status;
Expand Down

0 comments on commit 6391fff

Please sign in to comment.