diff options
author | Daniel Mack <zonque@gmail.com> | 2011-08-04 09:56:28 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-08-04 10:24:10 -0400 |
commit | 1faa5d07a93fc5b0a4a5254fc940a79e20b55540 (patch) | |
tree | 4b80fc6a93f5a626d5c45e4163a26f97c0a20171 /sound | |
parent | 60c961a9e1ed879a4d151df6076bf1203f595f73 (diff) |
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>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/usb/mixer.c | 20 | ||||
-rw-r--r-- | sound/usb/mixer.h | 1 |
2 files changed, 9 insertions, 12 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index ee9aa087d8b5..c04d7c71ac88 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c | |||
@@ -1939,15 +1939,13 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) | |||
1939 | struct mixer_build state; | 1939 | struct mixer_build state; |
1940 | int err; | 1940 | int err; |
1941 | const struct usbmix_ctl_map *map; | 1941 | const struct usbmix_ctl_map *map; |
1942 | struct usb_host_interface *hostif; | ||
1943 | void *p; | 1942 | void *p; |
1944 | 1943 | ||
1945 | hostif = mixer->chip->ctrl_intf; | ||
1946 | memset(&state, 0, sizeof(state)); | 1944 | memset(&state, 0, sizeof(state)); |
1947 | state.chip = mixer->chip; | 1945 | state.chip = mixer->chip; |
1948 | state.mixer = mixer; | 1946 | state.mixer = mixer; |
1949 | state.buffer = hostif->extra; | 1947 | state.buffer = mixer->hostif->extra; |
1950 | state.buflen = hostif->extralen; | 1948 | state.buflen = mixer->hostif->extralen; |
1951 | 1949 | ||
1952 | /* check the mapping table */ | 1950 | /* check the mapping table */ |
1953 | for (map = usbmix_ctl_maps; map->id; map++) { | 1951 | for (map = usbmix_ctl_maps; map->id; map++) { |
@@ -1960,7 +1958,8 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) | |||
1960 | } | 1958 | } |
1961 | 1959 | ||
1962 | p = NULL; | 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 | if (mixer->protocol == UAC_VERSION_1) { | 1963 | if (mixer->protocol == UAC_VERSION_1) { |
1965 | struct uac1_output_terminal_descriptor *desc = p; | 1964 | struct uac1_output_terminal_descriptor *desc = p; |
1966 | 1965 | ||
@@ -2167,17 +2166,15 @@ int snd_usb_mixer_activate(struct usb_mixer_interface *mixer) | |||
2167 | /* create the handler for the optional status interrupt endpoint */ | 2166 | /* create the handler for the optional status interrupt endpoint */ |
2168 | static int snd_usb_mixer_status_create(struct usb_mixer_interface *mixer) | 2167 | static int snd_usb_mixer_status_create(struct usb_mixer_interface *mixer) |
2169 | { | 2168 | { |
2170 | struct usb_host_interface *hostif; | ||
2171 | struct usb_endpoint_descriptor *ep; | 2169 | struct usb_endpoint_descriptor *ep; |
2172 | void *transfer_buffer; | 2170 | void *transfer_buffer; |
2173 | int buffer_length; | 2171 | int buffer_length; |
2174 | unsigned int epnum; | 2172 | unsigned int epnum; |
2175 | 2173 | ||
2176 | hostif = mixer->chip->ctrl_intf; | ||
2177 | /* we need one interrupt input endpoint */ | 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 | return 0; | 2176 | return 0; |
2180 | ep = get_endpoint(hostif, 0); | 2177 | ep = get_endpoint(mixer->hostif, 0); |
2181 | if (!usb_endpoint_dir_in(ep) || !usb_endpoint_xfer_int(ep)) | 2178 | if (!usb_endpoint_dir_in(ep) || !usb_endpoint_xfer_int(ep)) |
2182 | return 0; | 2179 | return 0; |
2183 | 2180 | ||
@@ -2207,7 +2204,6 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif, | |||
2207 | }; | 2204 | }; |
2208 | struct usb_mixer_interface *mixer; | 2205 | struct usb_mixer_interface *mixer; |
2209 | struct snd_info_entry *entry; | 2206 | struct snd_info_entry *entry; |
2210 | struct usb_host_interface *host_iface; | ||
2211 | int err; | 2207 | int err; |
2212 | 2208 | ||
2213 | strcpy(chip->card->mixername, "USB Mixer"); | 2209 | strcpy(chip->card->mixername, "USB Mixer"); |
@@ -2224,8 +2220,8 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif, | |||
2224 | return -ENOMEM; | 2220 | return -ENOMEM; |
2225 | } | 2221 | } |
2226 | 2222 | ||
2227 | host_iface = &usb_ifnum_to_if(chip->dev, ctrlif)->altsetting[0]; | 2223 | mixer->hostif = &usb_ifnum_to_if(chip->dev, ctrlif)->altsetting[0]; |
2228 | switch (get_iface_desc(host_iface)->bInterfaceProtocol) { | 2224 | switch (get_iface_desc(mixer->hostif)->bInterfaceProtocol) { |
2229 | case UAC_VERSION_1: | 2225 | case UAC_VERSION_1: |
2230 | default: | 2226 | default: |
2231 | mixer->protocol = UAC_VERSION_1; | 2227 | mixer->protocol = UAC_VERSION_1; |
diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h index ae1a14dcfe82..81b2d8a32fb0 100644 --- a/sound/usb/mixer.h +++ b/sound/usb/mixer.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | struct usb_mixer_interface { | 4 | struct usb_mixer_interface { |
5 | struct snd_usb_audio *chip; | 5 | struct snd_usb_audio *chip; |
6 | struct usb_host_interface *hostif; | ||
6 | struct list_head list; | 7 | struct list_head list; |
7 | unsigned int ignore_ctl_error; | 8 | unsigned int ignore_ctl_error; |
8 | struct urb *urb; | 9 | struct urb *urb; |