]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ASoC: wm8350: Replace TLV_DB_RANGE_HEAD with DECLARE_TLV_DB_RANGE
authorLars-Peter Clausen <lars@metafoo.de>
Sun, 2 Aug 2015 15:19:58 +0000 (17:19 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 5 Aug 2015 12:23:52 +0000 (13:23 +0100)
DECLARE_TLV_DB_RANGE() has the advantage over using TLV_DB_RANGE_HEAD()
that it automatically calculates the number of items in the TLV and is
hence less prone to manual error.

Generate using the following coccinelle script

// <smpl>
@@
declarer name DECLARE_TLV_DB_RANGE;
identifier tlv;
constant x;
@@
-unsigned int tlv[] = {
- TLV_DB_RANGE_HEAD(x),
+DECLARE_TLV_DB_RANGE(tlv,
...
-};
+);
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/wm8350.c

index 41c62c1e62db5dc5754512532e7a758025cce311..ffbf3df8ae970329cd91a317d88018b3009150f4 100644 (file)
@@ -394,11 +394,10 @@ static DECLARE_TLV_DB_SCALE(dac_pcm_tlv, -7163, 36, 1);
 static DECLARE_TLV_DB_SCALE(adc_pcm_tlv, -12700, 50, 1);
 static DECLARE_TLV_DB_SCALE(out_mix_tlv, -1500, 300, 1);
 
-static const unsigned int capture_sd_tlv[] = {
-       TLV_DB_RANGE_HEAD(2),
+static const DECLARE_TLV_DB_RANGE(capture_sd_tlv,
        0, 12, TLV_DB_SCALE_ITEM(-3600, 300, 1),
-       13, 15, TLV_DB_SCALE_ITEM(0, 0, 0),
-};
+       13, 15, TLV_DB_SCALE_ITEM(0, 0, 0)
+);
 
 static const struct snd_kcontrol_new wm8350_snd_controls[] = {
        SOC_ENUM("Playback Deemphasis", wm8350_enum[0]),