[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170613180001.uh6mfhr55vgquvps@sirena.org.uk>
Date: Tue, 13 Jun 2017 19:00:01 +0100
From: Mark Brown <broonie@...nel.org>
To: Richard Leitner <richard.leitner@...data.com>
Cc: lgirdwood@...il.com, perex@...ex.cz, tiwai@...e.com,
alsa-devel@...a-project.org, linux-kernel@...r.kernel.org,
clemens.gruber@...ruber.com, eric@...int.com,
fabio.estevam@....com, kalle.kankare@...cit.fi, dev@...l1n.net
Subject: Re: [PATCH v3] ASoC: sgtl5000: add avc support
On Tue, Jun 13, 2017 at 08:57:34AM +0200, Richard Leitner wrote:
> +static int avc_put_threshold(struct snd_kcontrol *kcontrol,
> + struct snd_ctl_elem_value *ucontrol)
> +{
> + struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
> + int db;
> + u16 reg;
> +
> + db = clamp((int)ucontrol->value.integer.value[0], 0, 96);
> + reg = avc_thr_db2reg[db];
> + snd_soc_write(codec, SGTL5000_DAP_AVC_THRESHOLD, reg);
This should reject rather than silently accept out of bounds values,
otherwise this looks good.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists