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

ASoC: max9768: 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
44744eec 4689ac53

+3 -4
+3 -4
sound/soc/codecs/max9768.c
··· 63 63 return 0; 64 64 } 65 65 66 - static const unsigned int volume_tlv[] = { 67 - TLV_DB_RANGE_HEAD(43), 66 + static const DECLARE_TLV_DB_RANGE(volume_tlv, 68 67 0, 0, TLV_DB_SCALE_ITEM(-16150, 0, 0), 69 68 1, 1, TLV_DB_SCALE_ITEM(-9280, 0, 0), 70 69 2, 2, TLV_DB_SCALE_ITEM(-9030, 0, 0), ··· 106 107 51, 57, TLV_DB_SCALE_ITEM(290, 50, 0), 107 108 58, 58, TLV_DB_SCALE_ITEM(650, 0, 0), 108 109 59, 62, TLV_DB_SCALE_ITEM(700, 60, 0), 109 - 63, 63, TLV_DB_SCALE_ITEM(950, 0, 0), 110 - }; 110 + 63, 63, TLV_DB_SCALE_ITEM(950, 0, 0) 111 + ); 111 112 112 113 static const struct snd_kcontrol_new max9768_volume[] = { 113 114 SOC_SINGLE_TLV("Playback Volume", MAX9768_VOL, 0, 63, 0, volume_tlv),