]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ALSA: caiaq: Use snd_card_free_when_closed() at disconnection
authorTakashi Iwai <tiwai@suse.de>
Wed, 13 Nov 2024 11:10:38 +0000 (12:10 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 13 Nov 2024 12:33:47 +0000 (13:33 +0100)
commitb04dcbb7f7b1908806b7dc22671cdbe78ff2b82c
treeeb1eb63feb57b6a262980400829c3ef7c9b58929
parentf86af06306a7c36451b0174e3c64bc935d04f5e5
ALSA: caiaq: Use snd_card_free_when_closed() at disconnection

The USB disconnect callback is supposed to be short and not too-long
waiting.  OTOH, the current code uses snd_card_free() at
disconnection, but this waits for the close of all used fds, hence it
can take long.  It eventually blocks the upper layer USB ioctls, which
may trigger a soft lockup.

An easy workaround is to replace snd_card_free() with
snd_card_free_when_closed().  This variant returns immediately while
the release of resources is done asynchronously by the card device
release at the last close.

This patch also splits the code to the disconnect and the free phases;
the former is called immediately at the USB disconnect callback while
the latter is called from the card destructor.

Fixes: 523f1dce3743 ("[ALSA] Add Native Instrument usb audio device support")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20241113111042.15058-5-tiwai@suse.de
sound/usb/caiaq/audio.c
sound/usb/caiaq/audio.h
sound/usb/caiaq/device.c
sound/usb/caiaq/input.c
sound/usb/caiaq/input.h