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

ASoC: sn95031: Replace direct snd_soc_codec dapm field access

The dapm field of the snd_soc_codec struct is eventually going to be
removed, in preparation for this replace all manual access to
codec->dapm.bias_level with snd_soc_codec_get_bias_level().

While we are at it also replace the if(x == A) ... else if(x == B) ...
construct with a switch-case.

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
22310d32 45a110a1

+8 -3
+8 -3
sound/soc/codecs/sn95031.c
··· 194 194 break; 195 195 196 196 case SND_SOC_BIAS_PREPARE: 197 - if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) { 197 + if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_STANDBY) { 198 198 pr_debug("vaud_bias powering up pll\n"); 199 199 /* power up the pll */ 200 200 snd_soc_write(codec, SN95031_AUDPLLCTRL, BIT(5)); ··· 205 205 break; 206 206 207 207 case SND_SOC_BIAS_STANDBY: 208 - if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { 208 + switch (snd_soc_codec_get_bias_level(codec)) { 209 + case SND_SOC_BIAS_OFF: 209 210 pr_debug("vaud_bias power up rail\n"); 210 211 /* power up the rail */ 211 212 snd_soc_write(codec, SN95031_VAUD, 212 213 BIT(2)|BIT(1)|BIT(0)); 213 214 msleep(1); 214 - } else if (codec->dapm.bias_level == SND_SOC_BIAS_PREPARE) { 215 + break; 216 + case SND_SOC_BIAS_PREPARE: 215 217 /* turn off pcm */ 216 218 pr_debug("vaud_bias power dn pcm\n"); 217 219 snd_soc_update_bits(codec, SN95031_PCM2C2, BIT(0), 0); 218 220 snd_soc_write(codec, SN95031_AUDPLLCTRL, 0); 221 + break; 222 + default: 223 + break; 219 224 } 220 225 break; 221 226