lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 10 Nov 2014 11:45:18 +1100
From:	NeilBrown <neilb@...e.de>
To:	Mark Brown <broonie@...nel.org>
Cc:	Mark Rutland <mark.rutland@....com>,
	Pawel Moll <pawel.moll@....com>,
	Ian Campbell <ijc+devicetree@...lion.org.uk>,
	Liam Girdwood <lgirdwood@...il.com>,
	Rob Herring <robh+dt@...nel.org>,
	Peter Ujfalusi <peter.ujfalusi@...com>,
	GTA04 owners <gta04-owner@...delico.com>,
	devicetree@...r.kernel.org, alsa-devel@...a-project.org,
	linux-kernel@...r.kernel.org
Subject: Re: [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@...nel.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@...e.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@...e.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,

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ