From: Peter Ujfalusi Date: Wed, 5 Oct 2011 07:29:20 +0000 (+0300) Subject: ASoC: twl6040: Simplify custom get_volsw callback X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e49b68339ebc7d2e67dc1ae16a4ac6a35fcfc9d5;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git ASoC: twl6040: Simplify custom get_volsw callback The custom get_volsw does not need to call any core get_volsw calls, since we are returning the shadow values for the gains. 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 Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index 11f681b15dec..4ad04e3d5c40 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c @@ -796,20 +796,14 @@ static int twl6040_get_volsw(struct snd_kcontrol *kcontrol, out = &twl6040_priv->handsfree; break; default: - break; - } - - if (out) { - ucontrol->value.integer.value[0] = out->left_vol; - ucontrol->value.integer.value[1] = out->right_vol; - return 0; + dev_warn(codec->dev, "%s: Unexpected register: 0x%02x\n", + __func__, mc->reg); + return -EINVAL; } - /* call the appropriate handler depending on the rreg */ - if (mc->rreg) - return snd_soc_get_volsw_2r(kcontrol, ucontrol); - else - return snd_soc_get_volsw(kcontrol, ucontrol); + ucontrol->value.integer.value[0] = out->left_vol; + ucontrol->value.integer.value[1] = out->right_vol; + return 0; } /*