lkml.org 
[lkml]   [2017]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2017-06-13 20:02    [W:0.189 / U:0.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site