aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-10-22 06:19:57 -0400
committerTakashi Iwai <tiwai@suse.de>2014-10-22 06:19:57 -0400
commit930352862e9533fecc42c7ed20798a7c9e3aa874 (patch)
treef234d6eb69c077f898e375aef30c9550dcf069d7 /sound/usb
parentb46882b6eb713245916100ac5b58664cd242a08d (diff)
parent7bbd03e0143b562ff7d96f7e71c016104020b550 (diff)
Merge branch 'topic/enum-info-cleanup' into for-next
this is a series of patches to just convert the plain info callback for enum ctl elements to snd_ctl_elem_info(). Also, it includes the extension of snd_ctl_elem_info(), for catching the unexpected string cut-off and handling the zero items.
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/6fire/control.c22
-rw-r--r--sound/usb/midi.c2
-rw-r--r--sound/usb/mixer_quirks.c35
3 files changed, 11 insertions, 48 deletions
diff --git a/sound/usb/6fire/control.c b/sound/usb/6fire/control.c
index 184e3987ac24..54656eed6e2e 100644
--- a/sound/usb/6fire/control.c
+++ b/sound/usb/6fire/control.c
@@ -25,8 +25,8 @@
25#include "comm.h" 25#include "comm.h"
26#include "chip.h" 26#include "chip.h"
27 27
28static char *opt_coax_texts[2] = { "Optical", "Coax" }; 28static const char * const opt_coax_texts[2] = { "Optical", "Coax" };
29static char *line_phono_texts[2] = { "Line", "Phono" }; 29static const char * const line_phono_texts[2] = { "Line", "Phono" };
30 30
31/* 31/*
32 * data that needs to be sent to device. sets up card internal stuff. 32 * data that needs to be sent to device. sets up card internal stuff.
@@ -327,14 +327,7 @@ static int usb6fire_control_input_vol_get(struct snd_kcontrol *kcontrol,
327static int usb6fire_control_line_phono_info(struct snd_kcontrol *kcontrol, 327static int usb6fire_control_line_phono_info(struct snd_kcontrol *kcontrol,
328 struct snd_ctl_elem_info *uinfo) 328 struct snd_ctl_elem_info *uinfo)
329{ 329{
330 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 330 return snd_ctl_enum_info(uinfo, 1, 2, line_phono_texts);
331 uinfo->count = 1;
332 uinfo->value.enumerated.items = 2;
333 if (uinfo->value.enumerated.item > 1)
334 uinfo->value.enumerated.item = 1;
335 strcpy(uinfo->value.enumerated.name,
336 line_phono_texts[uinfo->value.enumerated.item]);
337 return 0;
338} 331}
339 332
340static int usb6fire_control_line_phono_put(struct snd_kcontrol *kcontrol, 333static int usb6fire_control_line_phono_put(struct snd_kcontrol *kcontrol,
@@ -361,14 +354,7 @@ static int usb6fire_control_line_phono_get(struct snd_kcontrol *kcontrol,
361static int usb6fire_control_opt_coax_info(struct snd_kcontrol *kcontrol, 354static int usb6fire_control_opt_coax_info(struct snd_kcontrol *kcontrol,
362 struct snd_ctl_elem_info *uinfo) 355 struct snd_ctl_elem_info *uinfo)
363{ 356{
364 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 357 return snd_ctl_enum_info(uinfo, 1, 2, opt_coax_texts);
365 uinfo->count = 1;
366 uinfo->value.enumerated.items = 2;
367 if (uinfo->value.enumerated.item > 1)
368 uinfo->value.enumerated.item = 1;
369 strcpy(uinfo->value.enumerated.name,
370 opt_coax_texts[uinfo->value.enumerated.item]);
371 return 0;
372} 358}
373 359
374static int usb6fire_control_opt_coax_put(struct snd_kcontrol *kcontrol, 360static int usb6fire_control_opt_coax_put(struct snd_kcontrol *kcontrol,
diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index 69e93a9d486a..d3d49525a16b 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -64,7 +64,7 @@
64/* #define DUMP_PACKETS */ 64/* #define DUMP_PACKETS */
65 65
66/* 66/*
67 * how long to wait after some USB errors, so that khubd can disconnect() us 67 * how long to wait after some USB errors, so that hub_wq can disconnect() us
68 * without too many spurious errors 68 * without too many spurious errors
69 */ 69 */
70#define ERROR_DELAY_JIFFIES (HZ / 10) 70#define ERROR_DELAY_JIFFIES (HZ / 10)
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index f119a41ed9a9..3980bf554c83 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -437,19 +437,9 @@ static void snd_audigy2nx_proc_read(struct snd_info_entry *entry,
437static int snd_emu0204_ch_switch_info(struct snd_kcontrol *kcontrol, 437static int snd_emu0204_ch_switch_info(struct snd_kcontrol *kcontrol,
438 struct snd_ctl_elem_info *uinfo) 438 struct snd_ctl_elem_info *uinfo)
439{ 439{
440 static const char *texts[2] = {"1/2", 440 static const char * const texts[2] = {"1/2", "3/4"};
441 "3/4"
442 };
443
444 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
445 uinfo->count = 1;
446 uinfo->value.enumerated.items = 2;
447 if (uinfo->value.enumerated.item > 1)
448 uinfo->value.enumerated.item = 1;
449 strcpy(uinfo->value.enumerated.name,
450 texts[uinfo->value.enumerated.item]);
451 441
452 return 0; 442 return snd_ctl_enum_info(uinfo, 1, ARRAY_SIZE(texts), texts);
453} 443}
454 444
455static int snd_emu0204_ch_switch_get(struct snd_kcontrol *kcontrol, 445static int snd_emu0204_ch_switch_get(struct snd_kcontrol *kcontrol,
@@ -735,25 +725,12 @@ struct snd_ftu_eff_switch_priv_val {
735static int snd_ftu_eff_switch_info(struct snd_kcontrol *kcontrol, 725static int snd_ftu_eff_switch_info(struct snd_kcontrol *kcontrol,
736 struct snd_ctl_elem_info *uinfo) 726 struct snd_ctl_elem_info *uinfo)
737{ 727{
738 static const char *texts[8] = {"Room 1", 728 static const char *const texts[8] = {
739 "Room 2", 729 "Room 1", "Room 2", "Room 3", "Hall 1",
740 "Room 3", 730 "Hall 2", "Plate", "Delay", "Echo"
741 "Hall 1",
742 "Hall 2",
743 "Plate",
744 "Delay",
745 "Echo"
746 }; 731 };
747 732
748 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 733 return snd_ctl_enum_info(uinfo, 1, ARRAY_SIZE(texts), texts);
749 uinfo->count = 1;
750 uinfo->value.enumerated.items = 8;
751 if (uinfo->value.enumerated.item > 7)
752 uinfo->value.enumerated.item = 7;
753 strcpy(uinfo->value.enumerated.name,
754 texts[uinfo->value.enumerated.item]);
755
756 return 0;
757} 734}
758 735
759static int snd_ftu_eff_switch_get(struct snd_kcontrol *kctl, 736static int snd_ftu_eff_switch_get(struct snd_kcontrol *kctl,