Commit 1faa5d07a93fc5b0a4a5254fc940a79e20b55540

Authored by Daniel Mack
Committed by Takashi Iwai
1 parent 60c961a9e1

ALSA: snd-usb: operate on given mixer interface only

When creating the mixers for an USB audio device, the current code looks
at the host interface stored in mixer->chip->ctrl_if. Change this and
rather keep a local pointer to the interface that was given when
snd_usb_create_mixer() was called.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Reported-by: Nicolai Krakowiak <nicolai.krakowiak@gmail.com>
Reported-by: Lean-Yves LENHOF <jean-yves@lenhof.eu.org>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
Cc: stable@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>

Showing 2 changed files with 9 additions and 12 deletions Side-by-side Diff

... ... @@ -1939,15 +1939,13 @@
1939 1939 struct mixer_build state;
1940 1940 int err;
1941 1941 const struct usbmix_ctl_map *map;
1942   - struct usb_host_interface *hostif;
1943 1942 void *p;
1944 1943  
1945   - hostif = mixer->chip->ctrl_intf;
1946 1944 memset(&state, 0, sizeof(state));
1947 1945 state.chip = mixer->chip;
1948 1946 state.mixer = mixer;
1949   - state.buffer = hostif->extra;
1950   - state.buflen = hostif->extralen;
  1947 + state.buffer = mixer->hostif->extra;
  1948 + state.buflen = mixer->hostif->extralen;
1951 1949  
1952 1950 /* check the mapping table */
1953 1951 for (map = usbmix_ctl_maps; map->id; map++) {
... ... @@ -1960,7 +1958,8 @@
1960 1958 }
1961 1959  
1962 1960 p = NULL;
1963   - 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) {
1964 1963 if (mixer->protocol == UAC_VERSION_1) {
1965 1964 struct uac1_output_terminal_descriptor *desc = p;
1966 1965  
1967 1966  
1968 1967  
1969 1968  
... ... @@ -2167,17 +2166,15 @@
2167 2166 /* create the handler for the optional status interrupt endpoint */
2168 2167 static int snd_usb_mixer_status_create(struct usb_mixer_interface *mixer)
2169 2168 {
2170   - struct usb_host_interface *hostif;
2171 2169 struct usb_endpoint_descriptor *ep;
2172 2170 void *transfer_buffer;
2173 2171 int buffer_length;
2174 2172 unsigned int epnum;
2175 2173  
2176   - hostif = mixer->chip->ctrl_intf;
2177 2174 /* we need one interrupt input endpoint */
2178   - if (get_iface_desc(hostif)->bNumEndpoints < 1)
  2175 + if (get_iface_desc(mixer->hostif)->bNumEndpoints < 1)
2179 2176 return 0;
2180   - ep = get_endpoint(hostif, 0);
  2177 + ep = get_endpoint(mixer->hostif, 0);
2181 2178 if (!usb_endpoint_dir_in(ep) || !usb_endpoint_xfer_int(ep))
2182 2179 return 0;
2183 2180  
... ... @@ -2207,7 +2204,6 @@
2207 2204 };
2208 2205 struct usb_mixer_interface *mixer;
2209 2206 struct snd_info_entry *entry;
2210   - struct usb_host_interface *host_iface;
2211 2207 int err;
2212 2208  
2213 2209 strcpy(chip->card->mixername, "USB Mixer");
... ... @@ -2224,8 +2220,8 @@
2224 2220 return -ENOMEM;
2225 2221 }
2226 2222  
2227   - host_iface = &usb_ifnum_to_if(chip->dev, ctrlif)->altsetting[0];
2228   - switch (get_iface_desc(host_iface)->bInterfaceProtocol) {
  2223 + mixer->hostif = &usb_ifnum_to_if(chip->dev, ctrlif)->altsetting[0];
  2224 + switch (get_iface_desc(mixer->hostif)->bInterfaceProtocol) {
2229 2225 case UAC_VERSION_1:
2230 2226 default:
2231 2227 mixer->protocol = UAC_VERSION_1;
... ... @@ -3,6 +3,7 @@
3 3  
4 4 struct usb_mixer_interface {
5 5 struct snd_usb_audio *chip;
  6 + struct usb_host_interface *hostif;
6 7 struct list_head list;
7 8 unsigned int ignore_ctl_error;
8 9 struct urb *urb;