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>
This commit is contained in:
committed by
Takashi Iwai
parent
60c961a9e1
commit
1faa5d07a9
@@ -1939,15 +1939,13 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
|
|||||||
struct mixer_build state;
|
struct mixer_build state;
|
||||||
int err;
|
int err;
|
||||||
const struct usbmix_ctl_map *map;
|
const struct usbmix_ctl_map *map;
|
||||||
struct usb_host_interface *hostif;
|
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
hostif = mixer->chip->ctrl_intf;
|
|
||||||
memset(&state, 0, sizeof(state));
|
memset(&state, 0, sizeof(state));
|
||||||
state.chip = mixer->chip;
|
state.chip = mixer->chip;
|
||||||
state.mixer = mixer;
|
state.mixer = mixer;
|
||||||
state.buffer = hostif->extra;
|
state.buffer = mixer->hostif->extra;
|
||||||
state.buflen = hostif->extralen;
|
state.buflen = mixer->hostif->extralen;
|
||||||
|
|
||||||
/* check the mapping table */
|
/* check the mapping table */
|
||||||
for (map = usbmix_ctl_maps; map->id; map++) {
|
for (map = usbmix_ctl_maps; map->id; map++) {
|
||||||
@@ -1960,7 +1958,8 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
p = NULL;
|
p = NULL;
|
||||||
while ((p = snd_usb_find_csint_desc(hostif->extra, hostif->extralen, p, UAC_OUTPUT_TERMINAL)) != NULL) {
|
while ((p = snd_usb_find_csint_desc(mixer->hostif->extra, mixer->hostif->extralen,
|
||||||
|
p, UAC_OUTPUT_TERMINAL)) != NULL) {
|
||||||
if (mixer->protocol == UAC_VERSION_1) {
|
if (mixer->protocol == UAC_VERSION_1) {
|
||||||
struct uac1_output_terminal_descriptor *desc = p;
|
struct uac1_output_terminal_descriptor *desc = p;
|
||||||
|
|
||||||
@@ -2167,17 +2166,15 @@ int snd_usb_mixer_activate(struct usb_mixer_interface *mixer)
|
|||||||
/* create the handler for the optional status interrupt endpoint */
|
/* create the handler for the optional status interrupt endpoint */
|
||||||
static int snd_usb_mixer_status_create(struct usb_mixer_interface *mixer)
|
static int snd_usb_mixer_status_create(struct usb_mixer_interface *mixer)
|
||||||
{
|
{
|
||||||
struct usb_host_interface *hostif;
|
|
||||||
struct usb_endpoint_descriptor *ep;
|
struct usb_endpoint_descriptor *ep;
|
||||||
void *transfer_buffer;
|
void *transfer_buffer;
|
||||||
int buffer_length;
|
int buffer_length;
|
||||||
unsigned int epnum;
|
unsigned int epnum;
|
||||||
|
|
||||||
hostif = mixer->chip->ctrl_intf;
|
|
||||||
/* we need one interrupt input endpoint */
|
/* we need one interrupt input endpoint */
|
||||||
if (get_iface_desc(hostif)->bNumEndpoints < 1)
|
if (get_iface_desc(mixer->hostif)->bNumEndpoints < 1)
|
||||||
return 0;
|
return 0;
|
||||||
ep = get_endpoint(hostif, 0);
|
ep = get_endpoint(mixer->hostif, 0);
|
||||||
if (!usb_endpoint_dir_in(ep) || !usb_endpoint_xfer_int(ep))
|
if (!usb_endpoint_dir_in(ep) || !usb_endpoint_xfer_int(ep))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -2207,7 +2204,6 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
|
|||||||
};
|
};
|
||||||
struct usb_mixer_interface *mixer;
|
struct usb_mixer_interface *mixer;
|
||||||
struct snd_info_entry *entry;
|
struct snd_info_entry *entry;
|
||||||
struct usb_host_interface *host_iface;
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
strcpy(chip->card->mixername, "USB Mixer");
|
strcpy(chip->card->mixername, "USB Mixer");
|
||||||
@@ -2224,8 +2220,8 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
host_iface = &usb_ifnum_to_if(chip->dev, ctrlif)->altsetting[0];
|
mixer->hostif = &usb_ifnum_to_if(chip->dev, ctrlif)->altsetting[0];
|
||||||
switch (get_iface_desc(host_iface)->bInterfaceProtocol) {
|
switch (get_iface_desc(mixer->hostif)->bInterfaceProtocol) {
|
||||||
case UAC_VERSION_1:
|
case UAC_VERSION_1:
|
||||||
default:
|
default:
|
||||||
mixer->protocol = UAC_VERSION_1;
|
mixer->protocol = UAC_VERSION_1;
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
struct usb_mixer_interface {
|
struct usb_mixer_interface {
|
||||||
struct snd_usb_audio *chip;
|
struct snd_usb_audio *chip;
|
||||||
|
struct usb_host_interface *hostif;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
unsigned int ignore_ctl_error;
|
unsigned int ignore_ctl_error;
|
||||||
struct urb *urb;
|
struct urb *urb;
|
||||||
|
Reference in New Issue
Block a user