Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org, Liam Girdwood <lgirdwood@gmail.com>
Subject: [PATCH 002/102] ASoC: twl4030: Clean up duplicated code
Date: Tue, 18 Feb 2014 12:29:26 +0100	[thread overview]
Message-ID: <1392722967-12472-3-git-send-email-tiwai@suse.de> (raw)
In-Reply-To: <1392722967-12472-1-git-send-email-tiwai@suse.de>

Remove the open code in snd_soc_put_twl4030_opmode_enum_double() but
just call snd_soc_put_enum_double() instead, which does the very same
thing (even correctly with a lock).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/soc/codecs/twl4030.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 1eb13d586309..682e4ac88939 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -965,9 +965,6 @@ static int snd_soc_put_twl4030_opmode_enum_double(struct snd_kcontrol *kcontrol,
 {
 	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
 	struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
-	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
-	unsigned short val;
-	unsigned short mask;
 
 	if (twl4030->configured) {
 		dev_err(codec->dev,
@@ -975,19 +972,7 @@ static int snd_soc_put_twl4030_opmode_enum_double(struct snd_kcontrol *kcontrol,
 		return -EBUSY;
 	}
 
-	if (ucontrol->value.enumerated.item[0] >= e->items)
-		return -EINVAL;
-
-	val = ucontrol->value.enumerated.item[0] << e->shift_l;
-	mask = e->mask << e->shift_l;
-	if (e->shift_l != e->shift_r) {
-		if (ucontrol->value.enumerated.item[1] >= e->items)
-			return -EINVAL;
-		val |= ucontrol->value.enumerated.item[1] << e->shift_r;
-		mask |= e->mask << e->shift_r;
-	}
-
-	return snd_soc_update_bits(codec, e->reg, mask, val);
+	return snd_soc_put_enum_double(kcontrol, ucontrol);
 }
 
 /*
-- 
1.8.5.2

  parent reply	other threads:[~2014-02-18 11:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-18 11:29 [PATCH 000/105] Rename soc_enum.max field Takashi Iwai
2014-02-18 11:29 ` [PATCH 001/102] ASoC: Rename soc_enum.max field with items Takashi Iwai
2014-02-20  1:44   ` Mark Brown
2014-02-18 11:29 ` Takashi Iwai [this message]
2014-02-20  1:45   ` [PATCH 002/102] ASoC: twl4030: Clean up duplicated code Mark Brown
2014-02-18 11:29 ` [PATCH 003/102] ALSA: da732x: Remove superfluous DA732X_SOC_ENUM_DOUBLE_R() Takashi Iwai
2014-02-19 16:44   ` Mark Brown
2014-02-18 11:42 ` [PATCH 000/105] Rename soc_enum.max field Takashi Iwai
2014-02-18 13:25 ` Liam Girdwood
2014-02-18 15:58 ` Charles Keepax
2014-02-18 16:11   ` Lars-Peter Clausen
2014-02-18 16:46 ` Brian Austin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1392722967-12472-3-git-send-email-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox