diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2015-08-02 11:20:03 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-08-05 08:24:13 -0400 |
commit | fcbb71e9ccac59940b619bdd5a51c96495dd4731 (patch) | |
tree | 570107f8973a4fca4a988689c702a54af7719d7c | |
parent | 5d272d89339a4f8c1905d5bdf5851346582b78f2 (diff) |
ASoC: wm8962: Replace TLV_DB_RANGE_HEAD with DECLARE_TLV_DB_RANGE
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>
-rw-r--r-- | sound/soc/codecs/wm8962.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index c5748fd4f296..b618da93525d 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c | |||
@@ -1456,14 +1456,13 @@ static int wm8962_reset(struct wm8962_priv *wm8962) | |||
1456 | 1456 | ||
1457 | static const DECLARE_TLV_DB_SCALE(inpga_tlv, -2325, 75, 0); | 1457 | static const DECLARE_TLV_DB_SCALE(inpga_tlv, -2325, 75, 0); |
1458 | static const DECLARE_TLV_DB_SCALE(mixin_tlv, -1500, 300, 0); | 1458 | static const DECLARE_TLV_DB_SCALE(mixin_tlv, -1500, 300, 0); |
1459 | static const unsigned int mixinpga_tlv[] = { | 1459 | static const DECLARE_TLV_DB_RANGE(mixinpga_tlv, |
1460 | TLV_DB_RANGE_HEAD(5), | ||
1461 | 0, 1, TLV_DB_SCALE_ITEM(0, 600, 0), | 1460 | 0, 1, TLV_DB_SCALE_ITEM(0, 600, 0), |
1462 | 2, 2, TLV_DB_SCALE_ITEM(1300, 1300, 0), | 1461 | 2, 2, TLV_DB_SCALE_ITEM(1300, 1300, 0), |
1463 | 3, 4, TLV_DB_SCALE_ITEM(1800, 200, 0), | 1462 | 3, 4, TLV_DB_SCALE_ITEM(1800, 200, 0), |
1464 | 5, 5, TLV_DB_SCALE_ITEM(2400, 0, 0), | 1463 | 5, 5, TLV_DB_SCALE_ITEM(2400, 0, 0), |
1465 | 6, 7, TLV_DB_SCALE_ITEM(2700, 300, 0), | 1464 | 6, 7, TLV_DB_SCALE_ITEM(2700, 300, 0) |
1466 | }; | 1465 | ); |
1467 | static const DECLARE_TLV_DB_SCALE(beep_tlv, -9600, 600, 1); | 1466 | static const DECLARE_TLV_DB_SCALE(beep_tlv, -9600, 600, 1); |
1468 | static const DECLARE_TLV_DB_SCALE(digital_tlv, -7200, 75, 1); | 1467 | static const DECLARE_TLV_DB_SCALE(digital_tlv, -7200, 75, 1); |
1469 | static const DECLARE_TLV_DB_SCALE(st_tlv, -3600, 300, 0); | 1468 | static const DECLARE_TLV_DB_SCALE(st_tlv, -3600, 300, 0); |
@@ -1471,11 +1470,10 @@ static const DECLARE_TLV_DB_SCALE(inmix_tlv, -600, 600, 0); | |||
1471 | static const DECLARE_TLV_DB_SCALE(bypass_tlv, -1500, 300, 0); | 1470 | static const DECLARE_TLV_DB_SCALE(bypass_tlv, -1500, 300, 0); |
1472 | static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1); | 1471 | static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1); |
1473 | static const DECLARE_TLV_DB_SCALE(hp_tlv, -700, 100, 0); | 1472 | static const DECLARE_TLV_DB_SCALE(hp_tlv, -700, 100, 0); |
1474 | static const unsigned int classd_tlv[] = { | 1473 | static const DECLARE_TLV_DB_RANGE(classd_tlv, |
1475 | TLV_DB_RANGE_HEAD(2), | ||
1476 | 0, 6, TLV_DB_SCALE_ITEM(0, 150, 0), | 1474 | 0, 6, TLV_DB_SCALE_ITEM(0, 150, 0), |
1477 | 7, 7, TLV_DB_SCALE_ITEM(1200, 0, 0), | 1475 | 7, 7, TLV_DB_SCALE_ITEM(1200, 0, 0) |
1478 | }; | 1476 | ); |
1479 | static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); | 1477 | static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); |
1480 | 1478 | ||
1481 | static int wm8962_dsp2_write_config(struct snd_soc_codec *codec) | 1479 | static int wm8962_dsp2_write_config(struct snd_soc_codec *codec) |