Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Lars-Peter Clausen and committed by
Mark Brown
fcbb71e9 5d272d89

+6 -8
+6 -8
sound/soc/codecs/wm8962.c
··· 1456 1456 1457 1457 static const DECLARE_TLV_DB_SCALE(inpga_tlv, -2325, 75, 0); 1458 1458 static const DECLARE_TLV_DB_SCALE(mixin_tlv, -1500, 300, 0); 1459 - static const unsigned int mixinpga_tlv[] = { 1460 - TLV_DB_RANGE_HEAD(5), 1459 + static const DECLARE_TLV_DB_RANGE(mixinpga_tlv, 1461 1460 0, 1, TLV_DB_SCALE_ITEM(0, 600, 0), 1462 1461 2, 2, TLV_DB_SCALE_ITEM(1300, 1300, 0), 1463 1462 3, 4, TLV_DB_SCALE_ITEM(1800, 200, 0), 1464 1463 5, 5, TLV_DB_SCALE_ITEM(2400, 0, 0), 1465 - 6, 7, TLV_DB_SCALE_ITEM(2700, 300, 0), 1466 - }; 1464 + 6, 7, TLV_DB_SCALE_ITEM(2700, 300, 0) 1465 + ); 1467 1466 static const DECLARE_TLV_DB_SCALE(beep_tlv, -9600, 600, 1); 1468 1467 static const DECLARE_TLV_DB_SCALE(digital_tlv, -7200, 75, 1); 1469 1468 static const DECLARE_TLV_DB_SCALE(st_tlv, -3600, 300, 0); ··· 1470 1471 static const DECLARE_TLV_DB_SCALE(bypass_tlv, -1500, 300, 0); 1471 1472 static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1); 1472 1473 static const DECLARE_TLV_DB_SCALE(hp_tlv, -700, 100, 0); 1473 - static const unsigned int classd_tlv[] = { 1474 - TLV_DB_RANGE_HEAD(2), 1474 + static const DECLARE_TLV_DB_RANGE(classd_tlv, 1475 1475 0, 6, TLV_DB_SCALE_ITEM(0, 150, 0), 1476 - 7, 7, TLV_DB_SCALE_ITEM(1200, 0, 0), 1477 - }; 1476 + 7, 7, TLV_DB_SCALE_ITEM(1200, 0, 0) 1477 + ); 1478 1478 static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); 1479 1479 1480 1480 static int wm8962_dsp2_write_config(struct snd_soc_codec *codec)