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

ASoC: wm8993: 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
f1022087 00769dbe

+3 -4
+3 -4
sound/soc/codecs/wm8993.c
··· 628 628 static const DECLARE_TLV_DB_SCALE(drc_comp_threash, -4500, 75, 0); 629 629 static const DECLARE_TLV_DB_SCALE(drc_comp_amp, -2250, 75, 0); 630 630 static const DECLARE_TLV_DB_SCALE(drc_min_tlv, -1800, 600, 0); 631 - static const unsigned int drc_max_tlv[] = { 632 - TLV_DB_RANGE_HEAD(2), 631 + static const DECLARE_TLV_DB_RANGE(drc_max_tlv, 633 632 0, 2, TLV_DB_SCALE_ITEM(1200, 600, 0), 634 - 3, 3, TLV_DB_SCALE_ITEM(3600, 0, 0), 635 - }; 633 + 3, 3, TLV_DB_SCALE_ITEM(3600, 0, 0) 634 + ); 636 635 static const DECLARE_TLV_DB_SCALE(drc_qr_tlv, 1200, 600, 0); 637 636 static const DECLARE_TLV_DB_SCALE(drc_startup_tlv, -1800, 300, 0); 638 637 static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);