Skip to content

Commit

Permalink
ALSA: usb-audio: Remove redundant workaround for Roland quirk
Browse files Browse the repository at this point in the history
The recent fix for the delayed card registration made the current
workaround for QUIRK_AUTODETECT superfluous, since the card
registration itself is delayed until the last interface probe.

This patch drops the redundant workaround in
create_autodetect_quirks() for simplification.

Fixes: 39efc9c ("ALSA: usb-audio: Fix last interface check for registration")
Link: https://bugzilla.suse.com/show_bug.cgi?id=1205111
Link: https://lore.kernel.org/r/20221108065824.14418-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed Nov 8, 2022
1 parent 971cb60 commit ea83ec5
Showing 1 changed file with 3 additions and 41 deletions.
44 changes: 3 additions & 41 deletions sound/usb/quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,8 @@ static int create_auto_midi_quirk(struct snd_usb_audio *chip,

static int create_autodetect_quirk(struct snd_usb_audio *chip,
struct usb_interface *iface,
struct usb_driver *driver)
struct usb_driver *driver,
const struct snd_usb_audio_quirk *quirk)
{
int err;

Expand All @@ -386,45 +387,6 @@ static int create_autodetect_quirk(struct snd_usb_audio *chip,
return err;
}

static int create_autodetect_quirks(struct snd_usb_audio *chip,
struct usb_interface *iface,
struct usb_driver *driver,
const struct snd_usb_audio_quirk *quirk)
{
int probed_ifnum = get_iface_desc(iface->altsetting)->bInterfaceNumber;
int ifcount, ifnum, err;

err = create_autodetect_quirk(chip, iface, driver);
if (err < 0)
return err;

/*
* ALSA PCM playback/capture devices cannot be registered in two steps,
* so we have to claim the other corresponding interface here.
*/
ifcount = chip->dev->actconfig->desc.bNumInterfaces;
for (ifnum = 0; ifnum < ifcount; ifnum++) {
if (ifnum == probed_ifnum || quirk->ifnum >= 0)
continue;
iface = usb_ifnum_to_if(chip->dev, ifnum);
if (!iface ||
usb_interface_claimed(iface) ||
get_iface_desc(iface->altsetting)->bInterfaceClass !=
USB_CLASS_VENDOR_SPEC)
continue;

err = create_autodetect_quirk(chip, iface, driver);
if (err >= 0) {
err = usb_driver_claim_interface(driver, iface,
USB_AUDIO_IFACE_UNUSED);
if (err < 0)
return err;
}
}

return 0;
}

/*
* Create a stream for an Edirol UA-700/UA-25/UA-4FX interface.
* The only way to detect the sample rate is by looking at wMaxPacketSize.
Expand Down Expand Up @@ -554,7 +516,7 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip,
static const quirk_func_t quirk_funcs[] = {
[QUIRK_IGNORE_INTERFACE] = ignore_interface_quirk,
[QUIRK_COMPOSITE] = create_composite_quirk,
[QUIRK_AUTODETECT] = create_autodetect_quirks,
[QUIRK_AUTODETECT] = create_autodetect_quirk,
[QUIRK_MIDI_STANDARD_INTERFACE] = create_any_midi_quirk,
[QUIRK_MIDI_FIXED_ENDPOINT] = create_any_midi_quirk,
[QUIRK_MIDI_YAMAHA] = create_any_midi_quirk,
Expand Down

0 comments on commit ea83ec5

Please sign in to comment.