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

ASoC: adau1373: 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
31581f3c 69dae09f

+9 -12
+9 -12
sound/soc/codecs/adau1373.c
··· 320 320 { ADAU1373_DIGEN, 0x00 }, 321 321 }; 322 322 323 - static const unsigned int adau1373_out_tlv[] = { 324 - TLV_DB_RANGE_HEAD(4), 323 + static const DECLARE_TLV_DB_RANGE(adau1373_out_tlv, 325 324 0, 7, TLV_DB_SCALE_ITEM(-7900, 400, 1), 326 325 8, 15, TLV_DB_SCALE_ITEM(-4700, 300, 0), 327 326 16, 23, TLV_DB_SCALE_ITEM(-2300, 200, 0), 328 - 24, 31, TLV_DB_SCALE_ITEM(-700, 100, 0), 329 - }; 327 + 24, 31, TLV_DB_SCALE_ITEM(-700, 100, 0) 328 + ); 330 329 331 330 static const DECLARE_TLV_DB_MINMAX(adau1373_digital_tlv, -9563, 0); 332 331 static const DECLARE_TLV_DB_SCALE(adau1373_in_pga_tlv, -1300, 100, 1); ··· 380 381 "158Hz", "232Hz", "347Hz", "520Hz", 381 382 }; 382 383 383 - static const unsigned int adau1373_bass_tlv[] = { 384 - TLV_DB_RANGE_HEAD(3), 384 + static const DECLARE_TLV_DB_RANGE(adau1373_bass_tlv, 385 385 0, 2, TLV_DB_SCALE_ITEM(-600, 600, 1), 386 386 3, 4, TLV_DB_SCALE_ITEM(950, 250, 0), 387 - 5, 7, TLV_DB_SCALE_ITEM(1400, 150, 0), 388 - }; 387 + 5, 7, TLV_DB_SCALE_ITEM(1400, 150, 0) 388 + ); 389 389 390 390 static SOC_ENUM_SINGLE_DECL(adau1373_bass_lpf_cutoff_enum, 391 391 ADAU1373_BASS1, 5, adau1373_bass_lpf_cutoff_text); ··· 412 414 static SOC_ENUM_SINGLE_DECL(adau1373_3d_cutoff_enum, 413 415 ADAU1373_3D_CTRL1, 0, adau1373_3d_cutoff_text); 414 416 415 - static const unsigned int adau1373_3d_tlv[] = { 416 - TLV_DB_RANGE_HEAD(2), 417 + static const DECLARE_TLV_DB_RANGE(adau1373_3d_tlv, 417 418 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0), 418 - 1, 7, TLV_DB_LINEAR_ITEM(-1800, -120), 419 - }; 419 + 1, 7, TLV_DB_LINEAR_ITEM(-1800, -120) 420 + ); 420 421 421 422 static const char *adau1373_lr_mux_text[] = { 422 423 "Mute",