summaryrefslogtreecommitdiffstats
path: root/sound/usb/card.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2020-11-23 09:53:34 +0100
committerTakashi Iwai <tiwai@suse.de>2020-11-23 15:15:48 +0100
commit43b81e84068d26d630b63fa877e682909a0102fe (patch)
treece23f626a7cdc49a67a539c6e2080e10279bce0b /sound/usb/card.h
parentcab941b7e5cf054502b01f776db724400ee5c1b6 (diff)
downloadlinux-43b81e84068d26d630b63fa877e682909a0102fe.tar.bz2
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>
Diffstat (limited to 'sound/usb/card.h')
-rw-r--r--sound/usb/card.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/usb/card.h b/sound/usb/card.h
index 53f0ce61f858..f58c3769b058 100644
--- a/sound/usb/card.h
+++ b/sound/usb/card.h
@@ -60,7 +60,7 @@ struct snd_usb_endpoint {
struct snd_usb_audio *chip;
int opened; /* open refcount; protect with chip->mutex */
- int use_count;
+ atomic_t running; /* running status */
int ep_num; /* the referenced endpoint number */
int type; /* SND_USB_ENDPOINT_TYPE_* */
unsigned long flags;