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

ASoC: wm9090: 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
0894e2b3 5d9a5e60

+9 -12
+9 -12
sound/soc/codecs/wm9090.c
··· 162 162 dev_err(codec->dev, "Timed out waiting for DC Servo\n"); 163 163 } 164 164 165 - static const unsigned int in_tlv[] = { 166 - TLV_DB_RANGE_HEAD(3), 165 + static const DECLARE_TLV_DB_RANGE(in_tlv, 167 166 0, 0, TLV_DB_SCALE_ITEM(-600, 0, 0), 168 167 1, 3, TLV_DB_SCALE_ITEM(-350, 350, 0), 169 - 4, 6, TLV_DB_SCALE_ITEM(600, 600, 0), 170 - }; 171 - static const unsigned int mix_tlv[] = { 172 - TLV_DB_RANGE_HEAD(2), 168 + 4, 6, TLV_DB_SCALE_ITEM(600, 600, 0) 169 + ); 170 + static const DECLARE_TLV_DB_RANGE(mix_tlv, 173 171 0, 2, TLV_DB_SCALE_ITEM(-1200, 300, 0), 174 - 3, 3, TLV_DB_SCALE_ITEM(0, 0, 0), 175 - }; 172 + 3, 3, TLV_DB_SCALE_ITEM(0, 0, 0) 173 + ); 176 174 static const DECLARE_TLV_DB_SCALE(out_tlv, -5700, 100, 0); 177 - static const unsigned int spkboost_tlv[] = { 178 - TLV_DB_RANGE_HEAD(2), 175 + static const DECLARE_TLV_DB_RANGE(spkboost_tlv, 179 176 0, 6, TLV_DB_SCALE_ITEM(0, 150, 0), 180 - 7, 7, TLV_DB_SCALE_ITEM(1200, 0, 0), 181 - }; 177 + 7, 7, TLV_DB_SCALE_ITEM(1200, 0, 0) 178 + ); 182 179 183 180 static const struct snd_kcontrol_new wm9090_controls[] = { 184 181 SOC_SINGLE_TLV("IN1A Volume", WM9090_IN1_LINE_INPUT_A_VOLUME, 0, 6, 0,