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

ASoC: tpa6130a2: 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>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Lars-Peter Clausen and committed by
Mark Brown
4e0e5f80 f9d54802

+6 -8
+6 -8
sound/soc/codecs/tpa6130a2.c
··· 259 259 * TPA6130 volume. From -59.5 to 4 dB with increasing step size when going 260 260 * down in gain. 261 261 */ 262 - static const unsigned int tpa6130_tlv[] = { 263 - TLV_DB_RANGE_HEAD(10), 262 + static const DECLARE_TLV_DB_RANGE(tpa6130_tlv, 264 263 0, 1, TLV_DB_SCALE_ITEM(-5950, 600, 0), 265 264 2, 3, TLV_DB_SCALE_ITEM(-5000, 250, 0), 266 265 4, 5, TLV_DB_SCALE_ITEM(-4550, 160, 0), ··· 269 270 12, 13, TLV_DB_SCALE_ITEM(-3040, 180, 0), 270 271 14, 20, TLV_DB_SCALE_ITEM(-2710, 110, 0), 271 272 21, 37, TLV_DB_SCALE_ITEM(-1960, 74, 0), 272 - 38, 63, TLV_DB_SCALE_ITEM(-720, 45, 0), 273 - }; 273 + 38, 63, TLV_DB_SCALE_ITEM(-720, 45, 0) 274 + ); 274 275 275 276 static const struct snd_kcontrol_new tpa6130a2_controls[] = { 276 277 SOC_SINGLE_EXT_TLV("TPA6130A2 Headphone Playback Volume", ··· 279 280 tpa6130_tlv), 280 281 }; 281 282 282 - static const unsigned int tpa6140_tlv[] = { 283 - TLV_DB_RANGE_HEAD(3), 283 + static const DECLARE_TLV_DB_RANGE(tpa6140_tlv, 284 284 0, 8, TLV_DB_SCALE_ITEM(-5900, 400, 0), 285 285 9, 16, TLV_DB_SCALE_ITEM(-2500, 200, 0), 286 - 17, 31, TLV_DB_SCALE_ITEM(-1000, 100, 0), 287 - }; 286 + 17, 31, TLV_DB_SCALE_ITEM(-1000, 100, 0) 287 + ); 288 288 289 289 static const struct snd_kcontrol_new tpa6140a2_controls[] = { 290 290 SOC_SINGLE_EXT_TLV("TPA6140A2 Headphone Playback Volume",