]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: usb-audio: Use atomic_t for endpoint use_count
authorTakashi Iwai <tiwai@suse.de>
Mon, 23 Nov 2020 08:53:34 +0000 (09:53 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 23 Nov 2020 14:15:48 +0000 (15:15 +0100)
commit5c36c1251340c5dcae6bb7ab4a7b7cd61d9e15a1
treece23f626a7cdc49a67a539c6e2080e10279bce0b
parent5ebf5d41c4581fe6242dd37a673c53b6bb0cad9c
ALSA: usb-audio: Use atomic_t for endpoint use_count

The endpoint objects may be started/stopped concurrently by different
substreams in the case of implicit feedback mode, while the current
code handles the reference counter without any protection.

This patch changes the refcount to atomic_t for avoiding the
inconsistency.  We need no reference_t here as the refcount goes only
up to 2.

Also the name "use_count" is renamed to "running" since this is about
actually the running status, not the open refcount.

Tested-by: Keith Milner <kamilner@superlative.org>
Tested-by: Dylan Robinson <dylan_robinson@motu.com>
Link: https://lore.kernel.org/r/20201123085347.19667-29-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/card.h
sound/usb/endpoint.c