ASoC: adau1373: Replace TLV_DB_RANGE_HEAD with DECLARE_TLV_DB_RANGE
authorLars-Peter Clausen <lars@metafoo.de>
Sun, 2 Aug 2015 15:19:31 +0000 (17:19 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 5 Aug 2015 12:16:17 +0000 (13:16 +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/adau1373.c

index a43160254929d5b31d7105cd75486263e14bf551..1fc1bd40ae778821d7f01589881403b623598ad4 100644 (file)
@@ -320,13 +320,12 @@ static const struct reg_default adau1373_reg_defaults[] = {
        { ADAU1373_DIGEN,               0x00 },
 };
 
-static const unsigned int adau1373_out_tlv[] = {
-       TLV_DB_RANGE_HEAD(4),
+static const DECLARE_TLV_DB_RANGE(adau1373_out_tlv,
        0, 7, TLV_DB_SCALE_ITEM(-7900, 400, 1),
        8, 15, TLV_DB_SCALE_ITEM(-4700, 300, 0),
        16, 23, TLV_DB_SCALE_ITEM(-2300, 200, 0),
-       24, 31, TLV_DB_SCALE_ITEM(-700, 100, 0),
-};
+       24, 31, TLV_DB_SCALE_ITEM(-700, 100, 0)
+);
 
 static const DECLARE_TLV_DB_MINMAX(adau1373_digital_tlv, -9563, 0);
 static const DECLARE_TLV_DB_SCALE(adau1373_in_pga_tlv, -1300, 100, 1);
@@ -381,12 +380,11 @@ static const char *adau1373_bass_hpf_cutoff_text[] = {
        "158Hz", "232Hz", "347Hz", "520Hz",
 };
 
-static const unsigned int adau1373_bass_tlv[] = {
-       TLV_DB_RANGE_HEAD(3),
+static const DECLARE_TLV_DB_RANGE(adau1373_bass_tlv,
        0, 2, TLV_DB_SCALE_ITEM(-600, 600, 1),
        3, 4, TLV_DB_SCALE_ITEM(950, 250, 0),
-       5, 7, TLV_DB_SCALE_ITEM(1400, 150, 0),
-};
+       5, 7, TLV_DB_SCALE_ITEM(1400, 150, 0)
+);
 
 static SOC_ENUM_SINGLE_DECL(adau1373_bass_lpf_cutoff_enum,
        ADAU1373_BASS1, 5, adau1373_bass_lpf_cutoff_text);
@@ -414,11 +412,10 @@ static SOC_ENUM_SINGLE_DECL(adau1373_3d_level_enum,
 static SOC_ENUM_SINGLE_DECL(adau1373_3d_cutoff_enum,
        ADAU1373_3D_CTRL1, 0, adau1373_3d_cutoff_text);
 
-static const unsigned int adau1373_3d_tlv[] = {
-       TLV_DB_RANGE_HEAD(2),
+static const DECLARE_TLV_DB_RANGE(adau1373_3d_tlv,
        0, 0, TLV_DB_SCALE_ITEM(0, 0, 0),
-       1, 7, TLV_DB_LINEAR_ITEM(-1800, -120),
-};
+       1, 7, TLV_DB_LINEAR_ITEM(-1800, -120)
+);
 
 static const char *adau1373_lr_mux_text[] = {
        "Mute",
This page took 0.096984 seconds and 5 git commands to generate.