@@ -173,16 +173,6 @@ static int tasdevice_get_profile_id(struct snd_kcontrol *kcontrol,
173
173
return 0 ;
174
174
}
175
175
176
- static int tasdevice_hda_clamp (int val , int max )
177
- {
178
- if (val > max )
179
- val = max ;
180
-
181
- if (val < 0 )
182
- val = 0 ;
183
- return val ;
184
- }
185
-
186
176
static int tasdevice_set_profile_id (struct snd_kcontrol * kcontrol ,
187
177
struct snd_ctl_elem_value * ucontrol )
188
178
{
@@ -191,7 +181,7 @@ static int tasdevice_set_profile_id(struct snd_kcontrol *kcontrol,
191
181
int max = tas_priv -> rcabin .ncfgs - 1 ;
192
182
int val , ret = 0 ;
193
183
194
- val = tasdevice_hda_clamp (nr_profile , max );
184
+ val = clamp (nr_profile , 0 , max );
195
185
196
186
if (tas_priv -> rcabin .profile_cfg_id != val ) {
197
187
tas_priv -> rcabin .profile_cfg_id = val ;
@@ -248,7 +238,7 @@ static int tasdevice_program_put(struct snd_kcontrol *kcontrol,
248
238
int max = tas_fw -> nr_programs - 1 ;
249
239
int val , ret = 0 ;
250
240
251
- val = tasdevice_hda_clamp (nr_program , max );
241
+ val = clamp (nr_program , 0 , max );
252
242
253
243
if (tas_priv -> cur_prog != val ) {
254
244
tas_priv -> cur_prog = val ;
@@ -277,7 +267,7 @@ static int tasdevice_config_put(struct snd_kcontrol *kcontrol,
277
267
int max = tas_fw -> nr_configurations - 1 ;
278
268
int val , ret = 0 ;
279
269
280
- val = tasdevice_hda_clamp (nr_config , max );
270
+ val = clamp (nr_config , 0 , max );
281
271
282
272
if (tas_priv -> cur_conf != val ) {
283
273
tas_priv -> cur_conf = val ;
0 commit comments