ALSA: hda/tas2781: Use standard clamp() macro
Instead of the home-made clamp() function, use the standard macro().
Fixes: 5be27f1e3e
("ALSA: hda/tas2781: Add tas2781 HDA driver")
Link: https://lore.kernel.org/r/20230831123620.23064-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
358040e380
commit
da42bcb30e
@ -173,16 +173,6 @@ static int tasdevice_get_profile_id(struct snd_kcontrol *kcontrol,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tasdevice_hda_clamp(int val, int max)
|
||||
{
|
||||
if (val > max)
|
||||
val = max;
|
||||
|
||||
if (val < 0)
|
||||
val = 0;
|
||||
return val;
|
||||
}
|
||||
|
||||
static int tasdevice_set_profile_id(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
@ -191,7 +181,7 @@ static int tasdevice_set_profile_id(struct snd_kcontrol *kcontrol,
|
||||
int max = tas_priv->rcabin.ncfgs - 1;
|
||||
int val, ret = 0;
|
||||
|
||||
val = tasdevice_hda_clamp(nr_profile, max);
|
||||
val = clamp(nr_profile, 0, max);
|
||||
|
||||
if (tas_priv->rcabin.profile_cfg_id != val) {
|
||||
tas_priv->rcabin.profile_cfg_id = val;
|
||||
@ -248,7 +238,7 @@ static int tasdevice_program_put(struct snd_kcontrol *kcontrol,
|
||||
int max = tas_fw->nr_programs - 1;
|
||||
int val, ret = 0;
|
||||
|
||||
val = tasdevice_hda_clamp(nr_program, max);
|
||||
val = clamp(nr_program, 0, max);
|
||||
|
||||
if (tas_priv->cur_prog != val) {
|
||||
tas_priv->cur_prog = val;
|
||||
@ -277,7 +267,7 @@ static int tasdevice_config_put(struct snd_kcontrol *kcontrol,
|
||||
int max = tas_fw->nr_configurations - 1;
|
||||
int val, ret = 0;
|
||||
|
||||
val = tasdevice_hda_clamp(nr_config, max);
|
||||
val = clamp(nr_config, 0, max);
|
||||
|
||||
if (tas_priv->cur_conf != val) {
|
||||
tas_priv->cur_conf = val;
|
||||
|
Loading…
Reference in New Issue
Block a user