Re: [PATCH v4 0/5] ALSA: hda: Wait for PCM files on codec teardown

From: Takashi Iwai

Date: Fri Nov 06 2026 - 09:20:08 EST


On Sat, 31 Oct 2026 06:14:25 +0100,
Cen Zhang wrote:
>
> When an HD-audio codec is unbound while the card stays registered, the
> codec remove frees its PCMs while files can still use them, and the
> probe and remove of codecs on one bus can run at the same time.
>
> Following Takashi's suggestion on v2, this version fixes both in the
> HD-audio layer: patch 1 serializes the codec probe and remove and the
> card registration on a bus, and patch 5 makes the codec teardown wait
> until the files opened on its PCMs are closed.
>
> Patches 2 and 3 add the file to the card while the PCM minor is looked
> up, so that the wait does not miss an open between the lookup and
> snd_card_file_add(), and record the device a file was opened for. The
> teardown waits only for the files of its own PCMs, because the card
> files also include the control device, which a sound server keeps open
> for as long as it runs. Patch 4 makes an open fail once its PCM is
> disconnected, so that a late open does not get a working stream and
> hold off the teardown.
>
> Cen Zhang (5):
> ALSA: hda: Serialize codec probe and remove on the same bus
> ALSA: core: Add the card file while looking up a minor
> ALSA: pcm: Add the file to the card while looking up the minor
> ALSA: pcm: Refuse to open a disconnected PCM
> ALSA: hda: Wait for the files of the codec PCMs before freeing them

Since it's slightly intensive change, I applied to for-next branch
(i.e. for 7.5).


thanks,

Takashi