diff options
Diffstat (limited to 'sound/soc/codecs/wm2000.c')
| -rw-r--r-- | sound/soc/codecs/wm2000.c | 25 | 
1 files changed, 14 insertions, 11 deletions
diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c index 7fefd766b58..a4c352cc346 100644 --- a/sound/soc/codecs/wm2000.c +++ b/sound/soc/codecs/wm2000.c @@ -137,7 +137,8 @@ static int wm2000_power_up(struct i2c_client *i2c, int analogue)  	unsigned long rate;  	int ret; -	BUG_ON(wm2000->anc_mode != ANC_OFF); +	if (WARN_ON(wm2000->anc_mode != ANC_OFF)) +		return -EINVAL;  	dev_dbg(&i2c->dev, "Beginning power up\n"); @@ -277,7 +278,8 @@ static int wm2000_enter_bypass(struct i2c_client *i2c, int analogue)  {  	struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); -	BUG_ON(wm2000->anc_mode != ANC_ACTIVE); +	if (WARN_ON(wm2000->anc_mode != ANC_ACTIVE)) +		return -EINVAL;  	if (analogue) {  		wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL, @@ -315,7 +317,8 @@ static int wm2000_exit_bypass(struct i2c_client *i2c, int analogue)  {  	struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); -	BUG_ON(wm2000->anc_mode != ANC_BYPASS); +	if (WARN_ON(wm2000->anc_mode != ANC_BYPASS)) +		return -EINVAL;  	wm2000_write(i2c, WM2000_REG_SYS_CTL1, 0); @@ -349,7 +352,8 @@ static int wm2000_enter_standby(struct i2c_client *i2c, int analogue)  {  	struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); -	BUG_ON(wm2000->anc_mode != ANC_ACTIVE); +	if (WARN_ON(wm2000->anc_mode != ANC_ACTIVE)) +		return -EINVAL;  	if (analogue) {  		wm2000_write(i2c, WM2000_REG_ANA_VMID_PD_TIME, 248 / 4); @@ -392,7 +396,8 @@ static int wm2000_exit_standby(struct i2c_client *i2c, int analogue)  {  	struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); -	BUG_ON(wm2000->anc_mode != ANC_STANDBY); +	if (WARN_ON(wm2000->anc_mode != ANC_STANDBY)) +		return -EINVAL;  	wm2000_write(i2c, WM2000_REG_SYS_CTL1, 0); @@ -602,7 +607,7 @@ static int wm2000_anc_set_mode(struct wm2000_priv *wm2000)  static int wm2000_anc_mode_get(struct snd_kcontrol *kcontrol,  			       struct snd_ctl_elem_value *ucontrol)  { -	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); +	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);  	struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);  	ucontrol->value.enumerated.item[0] = wm2000->anc_active; @@ -613,7 +618,7 @@ static int wm2000_anc_mode_get(struct snd_kcontrol *kcontrol,  static int wm2000_anc_mode_put(struct snd_kcontrol *kcontrol,  			       struct snd_ctl_elem_value *ucontrol)  { -	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); +	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);  	struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);  	int anc_active = ucontrol->value.enumerated.item[0];  	int ret; @@ -635,7 +640,7 @@ static int wm2000_anc_mode_put(struct snd_kcontrol *kcontrol,  static int wm2000_speaker_get(struct snd_kcontrol *kcontrol,  			      struct snd_ctl_elem_value *ucontrol)  { -	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); +	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);  	struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);  	ucontrol->value.enumerated.item[0] = wm2000->spk_ena; @@ -646,7 +651,7 @@ static int wm2000_speaker_get(struct snd_kcontrol *kcontrol,  static int wm2000_speaker_put(struct snd_kcontrol *kcontrol,  			      struct snd_ctl_elem_value *ucontrol)  { -	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); +	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);  	struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);  	int val = ucontrol->value.enumerated.item[0];  	int ret; @@ -781,8 +786,6 @@ static int wm2000_probe(struct snd_soc_codec *codec)  {  	struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); -	snd_soc_codec_set_cache_io(codec, 16, 8, SND_SOC_REGMAP); -  	/* This will trigger a transition to standby mode by default */  	wm2000_anc_set_mode(wm2000);  | 
