aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/mixer.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/usb/mixer.c')
-rw-r--r--sound/usb/mixer.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index c22fa76e363a..c04d7c71ac88 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -1191,6 +1191,11 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void
1191 1191
1192 if (state->mixer->protocol == UAC_VERSION_1) { 1192 if (state->mixer->protocol == UAC_VERSION_1) {
1193 csize = hdr->bControlSize; 1193 csize = hdr->bControlSize;
1194 if (!csize) {
1195 snd_printdd(KERN_ERR "usbaudio: unit %u: "
1196 "invalid bControlSize == 0\n", unitid);
1197 return -EINVAL;
1198 }
1194 channels = (hdr->bLength - 7) / csize - 1; 1199 channels = (hdr->bLength - 7) / csize - 1;
1195 bmaControls = hdr->bmaControls; 1200 bmaControls = hdr->bmaControls;
1196 } else { 1201 } else {
@@ -1934,15 +1939,13 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
1934 struct mixer_build state; 1939 struct mixer_build state;
1935 int err; 1940 int err;
1936 const struct usbmix_ctl_map *map; 1941 const struct usbmix_ctl_map *map;
1937 struct usb_host_interface *hostif;
1938 void *p; 1942 void *p;
1939 1943
1940 hostif = mixer->chip->ctrl_intf;
1941 memset(&state, 0, sizeof(state)); 1944 memset(&state, 0, sizeof(state));
1942 state.chip = mixer->chip; 1945 state.chip = mixer->chip;
1943 state.mixer = mixer; 1946 state.mixer = mixer;
1944 state.buffer = hostif->extra; 1947 state.buffer = mixer->hostif->extra;
1945 state.buflen = hostif->extralen; 1948 state.buflen = mixer->hostif->extralen;
1946 1949
1947 /* check the mapping table */ 1950 /* check the mapping table */
1948 for (map = usbmix_ctl_maps; map->id; map++) { 1951 for (map = usbmix_ctl_maps; map->id; map++) {
@@ -1955,7 +1958,8 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
1955 } 1958 }
1956 1959
1957 p = NULL; 1960 p = NULL;
1958 while ((p = snd_usb_find_csint_desc(hostif->extra, hostif->extralen, p, UAC_OUTPUT_TERMINAL)) != NULL) { 1961 while ((p = snd_usb_find_csint_desc(mixer->hostif->extra, mixer->hostif->extralen,
1962 p, UAC_OUTPUT_TERMINAL)) != NULL) {
1959 if (mixer->protocol == UAC_VERSION_1) { 1963 if (mixer->protocol == UAC_VERSION_1) {
1960 struct uac1_output_terminal_descriptor *desc = p; 1964 struct uac1_output_terminal_descriptor *desc = p;
1961 1965
@@ -2162,17 +2166,15 @@ int snd_usb_mixer_activate(struct usb_mixer_interface *mixer)
2162/* create the handler for the optional status interrupt endpoint */ 2166/* create the handler for the optional status interrupt endpoint */
2163static int snd_usb_mixer_status_create(struct usb_mixer_interface *mixer) 2167static int snd_usb_mixer_status_create(struct usb_mixer_interface *mixer)
2164{ 2168{
2165 struct usb_host_interface *hostif;
2166 struct usb_endpoint_descriptor *ep; 2169 struct usb_endpoint_descriptor *ep;
2167 void *transfer_buffer; 2170 void *transfer_buffer;
2168 int buffer_length; 2171 int buffer_length;
2169 unsigned int epnum; 2172 unsigned int epnum;
2170 2173
2171 hostif = mixer->chip->ctrl_intf;
2172 /* we need one interrupt input endpoint */ 2174 /* we need one interrupt input endpoint */
2173 if (get_iface_desc(hostif)->bNumEndpoints < 1) 2175 if (get_iface_desc(mixer->hostif)->bNumEndpoints < 1)
2174 return 0; 2176 return 0;
2175 ep = get_endpoint(hostif, 0); 2177 ep = get_endpoint(mixer->hostif, 0);
2176 if (!usb_endpoint_dir_in(ep) || !usb_endpoint_xfer_int(ep)) 2178 if (!usb_endpoint_dir_in(ep) || !usb_endpoint_xfer_int(ep))
2177 return 0; 2179 return 0;
2178 2180
@@ -2202,7 +2204,6 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
2202 }; 2204 };
2203 struct usb_mixer_interface *mixer; 2205 struct usb_mixer_interface *mixer;
2204 struct snd_info_entry *entry; 2206 struct snd_info_entry *entry;
2205 struct usb_host_interface *host_iface;
2206 int err; 2207 int err;
2207 2208
2208 strcpy(chip->card->mixername, "USB Mixer"); 2209 strcpy(chip->card->mixername, "USB Mixer");
@@ -2219,8 +2220,8 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
2219 return -ENOMEM; 2220 return -ENOMEM;
2220 } 2221 }
2221 2222
2222 host_iface = &usb_ifnum_to_if(chip->dev, ctrlif)->altsetting[0]; 2223 mixer->hostif = &usb_ifnum_to_if(chip->dev, ctrlif)->altsetting[0];
2223 switch (get_iface_desc(host_iface)->bInterfaceProtocol) { 2224 switch (get_iface_desc(mixer->hostif)->bInterfaceProtocol) {
2224 case UAC_VERSION_1: 2225 case UAC_VERSION_1:
2225 default: 2226 default:
2226 mixer->protocol = UAC_VERSION_1; 2227 mixer->protocol = UAC_VERSION_1;