Skip to content

Commit

Permalink
ASoC: twl6040: Simplify custom put_volsw callback
Browse files Browse the repository at this point in the history
Return -EINVAL in the unlikely event, if the function has been called
for unhandled control. This way we can remove one check in the code.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Peter Ujfalusi authored and Mark Brown committed Oct 4, 2011
1 parent cdffa77 commit bfd3d4e
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions sound/soc/codecs/twl6040.c
Original file line number Diff line number Diff line change
Expand Up @@ -759,15 +759,13 @@ static int twl6040_put_volsw(struct snd_kcontrol *kcontrol,
out = &twl6040_priv->handsfree;
break;
default:
break;
return -EINVAL;
}

if (out) {
out->left_vol = ucontrol->value.integer.value[0];
out->right_vol = ucontrol->value.integer.value[1];
if (!out->active)
return 1;
}
out->left_vol = ucontrol->value.integer.value[0];
out->right_vol = ucontrol->value.integer.value[1];
if (!out->active)
return 1;

/* call the appropriate handler depending on the rreg */
if (mc->rreg)
Expand Down

0 comments on commit bfd3d4e

Please sign in to comment.