lkml.org 
[lkml]   [2014]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 1/3] ASoC: twl4030: don't report EBUSY if no change requested.
On Sat, 8 Nov 2014 09:22:42 +0000 Mark Brown <broonie@kernel.org> wrote:

> On Sat, Nov 08, 2014 at 11:38:03AM +1100, NeilBrown wrote:
>
> > + int val = ucontrol->value.integer.value[0];
> > +
> > + if (!!(twl4030_read(codec, TWL4030_REG_CODEC_MODE)
> > + & TWL4030_OPTION_1) == !!val)
> > + /* No change */
> > + return 0;
>
> We shouldn't be accepting attempts to set out of range values so there
> should be no need for the !! on val (which confused me when I was
> reading this).

True, the '!!' on val isn't necessary.

I took the opportunity to look around a bit more and discovered there was a
snd_soc_get_enum_double, which I really should use in preference to
twl4030_read.

So here is the new version. Can it be taken out of the email, or should I
resend stand-alone?

Thanks,
NeilBrown


From: NeilBrown <neilb@suse.de>
Date: Wed, 2 Oct 2013 14:45:52 +1000
Subject: [PATCH] ASoC: twl4030: don't report EBUSY if no change requested.

"mode" must not be changed when active.
However if a request is received to set the mode to what it currently
is, that is also rejected when active, which causes confusing
error messages.

So check first and if no change is actually requested, don't report
an error.

Signed-off-by: NeilBrown <neilb@suse.de>

diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index b6b0cb399599..613b61cee081 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -957,6 +957,16 @@ static int snd_soc_put_twl4030_opmode_enum_double(struct snd_kcontrol *kcontrol,
{
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
+ struct snd_ctl_elem_value currentval;
+ int ret;
+
+ ret = snd_soc_get_enum_double(kcontrol, &currentval);
+ if (ret)
+ return ret;
+ if (ucontrol->value.enumerated.item[0] ==
+ currentval.value.enumerated.item[0])
+ /* No change */
+ return 0;

if (twl4030->configured) {
dev_err(codec->dev,[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2014-11-10 02:21    [W:0.076 / U:0.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site