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

ASoC: rt5670: 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
dea6d32e 8e3648e1

+3 -4
+3 -4
sound/soc/codecs/rt5670.c
··· 592 592 static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0); 593 593 594 594 /* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */ 595 - static unsigned int bst_tlv[] = { 596 - TLV_DB_RANGE_HEAD(7), 595 + static const DECLARE_TLV_DB_RANGE(bst_tlv, 597 596 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0), 598 597 1, 1, TLV_DB_SCALE_ITEM(2000, 0, 0), 599 598 2, 2, TLV_DB_SCALE_ITEM(2400, 0, 0), 600 599 3, 5, TLV_DB_SCALE_ITEM(3000, 500, 0), 601 600 6, 6, TLV_DB_SCALE_ITEM(4400, 0, 0), 602 601 7, 7, TLV_DB_SCALE_ITEM(5000, 0, 0), 603 - 8, 8, TLV_DB_SCALE_ITEM(5200, 0, 0), 604 - }; 602 + 8, 8, TLV_DB_SCALE_ITEM(5200, 0, 0) 603 + ); 605 604 606 605 /* Interface data select */ 607 606 static const char * const rt5670_data_select[] = {