summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-11-09 18:21:23 +0100
committerTakashi Iwai <tiwai@suse.de>2014-11-09 18:21:23 +0100
commitd4b8fc66f770e9b79830cfe6c342846293b99fda (patch)
treeed2526b8e02bf0c0b8f5e8558c3839b54a7801fe
parent1fb8510cdb5b7befe8a59f533c7fc12ef0dac73e (diff)
ALSA: usb-audio: Allow multiple entries for the same iface in composite quirk
Currently the composite quirk doesn't work when multiple entries are assigned to the same interface because it marks the interface as claimed then checks whether the interface has been already claimed for the secondary entry. But, if you look at the code, you'll notice that multiple entries are allowed if the entry is the current interface; i.e. the current behavior is anyway inconsistent, and this is an unintended shortcoming. This patch fixes the problem by marking the relevant interfaces as claimed after applying the all composite entries. This fix will be needed for the upcoming enhancements for Digidesign Mbox 1 quirks. Reviewed-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/usb/quirks.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index d2aa45a8d895..e9ff3a6c60e4 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -58,9 +58,17 @@ static int create_composite_quirk(struct snd_usb_audio *chip,
err = snd_usb_create_quirk(chip, iface, driver, quirk);
if (err < 0)
return err;
- if (quirk->ifnum != probed_ifnum)
+ }
+
+ for (quirk = quirk->data; quirk->ifnum >= 0; ++quirk) {
+ iface = usb_ifnum_to_if(chip->dev, quirk->ifnum);
+ if (!iface)
+ continue;
+ if (quirk->ifnum != probed_ifnum &&
+ !usb_interface_claimed(iface))
usb_driver_claim_interface(driver, iface, (void *)-1L);
}
+
return 0;
}