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

ASoC: ab8500: 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
69dae09f f17cbcfe

+3 -4
+3 -4
sound/soc/codecs/ab8500-codec.c
··· 1335 1335 static DECLARE_TLV_DB_SCALE(hs_ear_dig_gain_tlv, -100, 100, 1); 1336 1336 /* -1dB = Mute */ 1337 1337 1338 - static const unsigned int hs_gain_tlv[] = { 1339 - TLV_DB_RANGE_HEAD(2), 1338 + static const DECLARE_TLV_DB_RANGE(hs_gain_tlv, 1340 1339 0, 3, TLV_DB_SCALE_ITEM(-3200, 400, 0), 1341 - 4, 15, TLV_DB_SCALE_ITEM(-1800, 200, 0), 1342 - }; 1340 + 4, 15, TLV_DB_SCALE_ITEM(-1800, 200, 0) 1341 + ); 1343 1342 1344 1343 static DECLARE_TLV_DB_SCALE(mic_gain_tlv, 0, 100, 0); 1345 1344