diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-10-20 12:12:26 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-10-21 02:26:55 -0400 |
commit | 41be5164ea09c92d551e8007d2543418e40f847a (patch) | |
tree | cb057c46cfa58a3d2b9881b04f1eaabebd769b2f /sound/firewire | |
parent | e7ced4137d859c576130ce7605e5fdd13221793d (diff) |
ALSA: bebob: Use snd_ctl_enum_info()
... and reduce the open codes.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire')
-rw-r--r-- | sound/firewire/bebob/bebob_maudio.c | 41 |
1 files changed, 8 insertions, 33 deletions
diff --git a/sound/firewire/bebob/bebob_maudio.c b/sound/firewire/bebob/bebob_maudio.c index 34cba8037b36..a422aaa3bb0c 100644 --- a/sound/firewire/bebob/bebob_maudio.c +++ b/sound/firewire/bebob/bebob_maudio.c | |||
@@ -352,17 +352,8 @@ static int special_clk_get(struct snd_bebob *bebob, unsigned int *id) | |||
352 | static int special_clk_ctl_info(struct snd_kcontrol *kctl, | 352 | static int special_clk_ctl_info(struct snd_kcontrol *kctl, |
353 | struct snd_ctl_elem_info *einf) | 353 | struct snd_ctl_elem_info *einf) |
354 | { | 354 | { |
355 | einf->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 355 | return snd_ctl_enum_info(einf, 1, ARRAY_SIZE(special_clk_labels), |
356 | einf->count = 1; | 356 | special_clk_labels); |
357 | einf->value.enumerated.items = ARRAY_SIZE(special_clk_labels); | ||
358 | |||
359 | if (einf->value.enumerated.item >= einf->value.enumerated.items) | ||
360 | einf->value.enumerated.item = einf->value.enumerated.items - 1; | ||
361 | |||
362 | strcpy(einf->value.enumerated.name, | ||
363 | special_clk_labels[einf->value.enumerated.item]); | ||
364 | |||
365 | return 0; | ||
366 | } | 357 | } |
367 | static int special_clk_ctl_get(struct snd_kcontrol *kctl, | 358 | static int special_clk_ctl_get(struct snd_kcontrol *kctl, |
368 | struct snd_ctl_elem_value *uval) | 359 | struct snd_ctl_elem_value *uval) |
@@ -444,17 +435,9 @@ static const char *const special_dig_in_iface_labels[] = { | |||
444 | static int special_dig_in_iface_ctl_info(struct snd_kcontrol *kctl, | 435 | static int special_dig_in_iface_ctl_info(struct snd_kcontrol *kctl, |
445 | struct snd_ctl_elem_info *einf) | 436 | struct snd_ctl_elem_info *einf) |
446 | { | 437 | { |
447 | einf->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 438 | return snd_ctl_enum_info(einf, 1, |
448 | einf->count = 1; | 439 | ARRAY_SIZE(special_dig_in_iface_labels), |
449 | einf->value.enumerated.items = ARRAY_SIZE(special_dig_in_iface_labels); | 440 | special_dig_in_iface_labels); |
450 | |||
451 | if (einf->value.enumerated.item >= einf->value.enumerated.items) | ||
452 | einf->value.enumerated.item = einf->value.enumerated.items - 1; | ||
453 | |||
454 | strcpy(einf->value.enumerated.name, | ||
455 | special_dig_in_iface_labels[einf->value.enumerated.item]); | ||
456 | |||
457 | return 0; | ||
458 | } | 441 | } |
459 | static int special_dig_in_iface_ctl_get(struct snd_kcontrol *kctl, | 442 | static int special_dig_in_iface_ctl_get(struct snd_kcontrol *kctl, |
460 | struct snd_ctl_elem_value *uval) | 443 | struct snd_ctl_elem_value *uval) |
@@ -545,17 +528,9 @@ static const char *const special_dig_out_iface_labels[] = { | |||
545 | static int special_dig_out_iface_ctl_info(struct snd_kcontrol *kctl, | 528 | static int special_dig_out_iface_ctl_info(struct snd_kcontrol *kctl, |
546 | struct snd_ctl_elem_info *einf) | 529 | struct snd_ctl_elem_info *einf) |
547 | { | 530 | { |
548 | einf->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 531 | return snd_ctl_enum_info(einf, 1, |
549 | einf->count = 1; | 532 | ARRAY_SIZE(special_dig_out_iface_labels), |
550 | einf->value.enumerated.items = ARRAY_SIZE(special_dig_out_iface_labels); | 533 | special_dig_out_iface_labels); |
551 | |||
552 | if (einf->value.enumerated.item >= einf->value.enumerated.items) | ||
553 | einf->value.enumerated.item = einf->value.enumerated.items - 1; | ||
554 | |||
555 | strcpy(einf->value.enumerated.name, | ||
556 | special_dig_out_iface_labels[einf->value.enumerated.item]); | ||
557 | |||
558 | return 0; | ||
559 | } | 534 | } |
560 | static int special_dig_out_iface_ctl_get(struct snd_kcontrol *kctl, | 535 | static int special_dig_out_iface_ctl_get(struct snd_kcontrol *kctl, |
561 | struct snd_ctl_elem_value *uval) | 536 | struct snd_ctl_elem_value *uval) |