Skip to content

Commit 7e1afce

Browse files
committed
ALSA: usb-audio: Inform the delayed registration more properly
The info message that was added in the commit a4aad56 ("ALSA: usb-audio: Inform devices that need delayed registration") is actually useful to know the need for the delayed registration. However, it turned out that this doesn't catch the all cases; namely, this warned only when a PCM stream is attached onto the existing PCM instance, but it doesn't count for a newly created PCM instance. This made confusion as if there were no further delayed registration. This patch moves the check to the code path for either adding a stream or creating a PCM instance. Also, make it simpler by checking the card->registered flag instead of querying each snd_device state. Fixes: a4aad56 ("ALSA: usb-audio: Inform devices that need delayed registration") Link: https://bugzilla.kernel.org/show_bug.cgi?id=216082 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 5f3d9e8 commit 7e1afce

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sound/usb/stream.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,16 +495,17 @@ static int __snd_usb_add_audio_stream(struct snd_usb_audio *chip,
495495
return 0;
496496
}
497497
}
498+
499+
if (chip->card->registered)
500+
chip->need_delayed_register = true;
501+
498502
/* look for an empty stream */
499503
list_for_each_entry(as, &chip->pcm_list, list) {
500504
if (as->fmt_type != fp->fmt_type)
501505
continue;
502506
subs = &as->substream[stream];
503507
if (subs->ep_num)
504508
continue;
505-
if (snd_device_get_state(chip->card, as->pcm) !=
506-
SNDRV_DEV_BUILD)
507-
chip->need_delayed_register = true;
508509
err = snd_pcm_new_stream(as->pcm, stream, 1);
509510
if (err < 0)
510511
return err;

0 commit comments

Comments
 (0)