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

ASoC: uda1380: 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
5ee0b8f8 2524911e

+6 -8
+6 -8
sound/soc/codecs/uda1380.c
··· 269 269 * from -66 dB in 0.5 dB steps (2 dB steps, really) and 270 270 * from -52 dB in 0.25 dB steps 271 271 */ 272 - static const unsigned int mvol_tlv[] = { 273 - TLV_DB_RANGE_HEAD(3), 272 + static const DECLARE_TLV_DB_RANGE(mvol_tlv, 274 273 0, 15, TLV_DB_SCALE_ITEM(-8200, 100, 1), 275 274 16, 43, TLV_DB_SCALE_ITEM(-6600, 50, 0), 276 - 44, 252, TLV_DB_SCALE_ITEM(-5200, 25, 0), 277 - }; 275 + 44, 252, TLV_DB_SCALE_ITEM(-5200, 25, 0) 276 + ); 278 277 279 278 /* 280 279 * from -72 dB in 1.5 dB steps (6 dB steps really), ··· 281 282 * from -60 dB in 0.5 dB steps (2 dB steps really) and 282 283 * from -46 dB in 0.25 dB steps 283 284 */ 284 - static const unsigned int vc_tlv[] = { 285 - TLV_DB_RANGE_HEAD(4), 285 + static const DECLARE_TLV_DB_RANGE(vc_tlv, 286 286 0, 7, TLV_DB_SCALE_ITEM(-7800, 150, 1), 287 287 8, 15, TLV_DB_SCALE_ITEM(-6600, 75, 0), 288 288 16, 43, TLV_DB_SCALE_ITEM(-6000, 50, 0), 289 - 44, 228, TLV_DB_SCALE_ITEM(-4600, 25, 0), 290 - }; 289 + 44, 228, TLV_DB_SCALE_ITEM(-4600, 25, 0) 290 + ); 291 291 292 292 /* from 0 to 6 dB in 2 dB steps if SPF mode != flat */ 293 293 static DECLARE_TLV_DB_SCALE(tr_tlv, 0, 200, 0);