kernel-hacking-2024-linux-s.../sound/usb
Takashi Iwai 63e20df1e5 ALSA: line6: Reorganize PCM stream handling
The current code deals with the stream start / stop solely via
line6_pcm_acquire() and line6_pcm_release().  This was (supposedly)
intended to avoid the races, but it doesn't work as expected.  The
concurrent acquire and release calls can be performed without proper
protections, thus this might result in memory corruption.
Furthermore, we can't take a mutex to protect the whole function
because it can be called from the PCM trigger callback that is an
atomic context.  Also spinlock isn't appropriate because the function
allocates with kmalloc with GFP_KERNEL.  That is, these function just
lead to singular problems.

This is an attempt to reduce the existing races.  First off, separate
both the stream buffer management and the stream URB management.  The
former is protected via a newly introduced state_mutex while the
latter is protected via each line6_pcm_stream lock.

Secondly, the stream state are now managed in opened and running bit
flags of each line6_pcm_stream.  Not only this a bit clearer than
previous combined bit flags, this also gives a better abstraction.
These rewrites allows us to make common hw_params and hw_free
callbacks for both playback and capture directions.

For the monitor and impulse operations, still line6_pcm_acquire() and
line6_pcm_release() are used.  They call internally the corresponding
functions for both playback and capture streams with proper lock or
mutex.  Unlike the previous versions, these function don't take the
bit masks but the only single type value.  Also they are supposed to
be applied only as duplex operations.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-28 07:22:36 +01:00
..
6fire ALSA: 6fire: Convert byte_rev_table uses to bitrev8 2014-11-14 08:01:53 +01:00
bcd2000 ALSA: MIDI driver for Behringer BCD2000 USB device 2014-04-07 16:05:41 +02:00
caiaq ALSA: snd-usb-caiaq: fix stream count check 2015-01-05 08:56:19 +01:00
hiface ALSA: usb: Convert to snd_card_new() with a device pointer 2014-02-12 11:18:00 +01:00
line6 ALSA: line6: Reorganize PCM stream handling 2015-01-28 07:22:36 +01:00
misc ALSA: pcm: Add snd_pcm_stop_xrun() helper 2014-11-09 18:20:40 +01:00
usx2y ALSA: pcm: Add snd_pcm_stop_xrun() helper 2014-11-09 18:20:40 +01:00
card.c Merge branch 'for-linus' into for-next 2014-11-05 15:37:22 +01:00
card.h ALSA: usb-audio: work around corrupted TEAC UD-H01 feedback data 2014-05-02 18:21:55 +02:00
clock.c ALSA: usb-audio: Use standard printk helpers 2014-02-26 16:45:34 +01:00
clock.h ALSA: usb-audio: UAC2: do clock validity check earlier 2013-04-04 08:30:59 +02:00
debug.h
endpoint.c ALSA: pcm: Add snd_pcm_stop_xrun() helper 2014-11-09 18:20:40 +01:00
endpoint.h ALSA: usb-audio: Pass direct struct pointer instead of list_head 2014-11-04 15:09:10 +01:00
format.c ALSA: usb-audio: Use standard printk helpers 2014-02-26 16:45:34 +01:00
format.h ALSA: usb-audio: store protocol version in struct audioformat 2013-06-27 21:59:47 +02:00
helper.c ALSA: usb-audio: support wireless devices in snd_usb_parse_datainterval 2013-10-07 12:52:21 +02:00
helper.h
Kconfig ALSA: move line6 usb driver into sound/usb 2015-01-12 22:29:57 +01:00
Makefile ALSA: line6: Split to each driver 2015-01-20 08:14:17 +01:00
midi.c ALSA: usb-audio: Don't resubmit pending URBs at MIDI error recovery 2014-12-06 21:35:38 +01:00
midi.h ALSA: usb-audio: Whitespace cleanups for sound/usb/midi.* 2014-08-05 20:08:00 +02:00
mixer.c ALSA: usb-audio: Allow quirks to handle own resume and proc dump 2014-11-21 11:56:58 +01:00
mixer.h ALSA: usb-audio: Add Xonar U1 resume support 2014-11-21 11:58:01 +01:00
mixer_maps.c ALSA: usb-audio: extend KEF X300A FU 10 tweak to Arcam rPAC 2014-12-18 17:49:50 +01:00
mixer_quirks.c ALSA: usb-audio: Add resume support for MicroII SPDIF ctls 2014-11-21 11:58:52 +01:00
mixer_quirks.h
mixer_scarlett.c ALSA: usb-audio: Fix Scarlett 6i6 initialization typo 2014-12-18 08:39:17 +01:00
mixer_scarlett.h ALSA: usb-audio: Scarlett mixer interface for 6i6, 18i6, 18i8 and 18i20 2014-11-13 07:32:39 +01:00
pcm.c ALSA: usb-audio: Add mode select quirk for Denon/Marantz DACs 2014-11-28 18:02:35 +01:00
pcm.h
power.h
proc.c ALSA: usb-audio: proc: use found syncmaxsize to determine feedback format 2013-05-17 08:05:34 +02:00
proc.h
quirks-table.h sound updates for 3.19-rc1 2014-12-11 13:20:50 -08:00
quirks.c ALSA: usb-audio: add native DSD support for Matrix Audio DACs 2014-12-17 17:55:20 +01:00
quirks.h ALSA: usb-audio: Add mode select quirk for Denon/Marantz DACs 2014-11-28 18:02:35 +01:00
stream.c ALSA: usb-audio: Use standard printk helpers 2014-02-26 16:45:34 +01:00
stream.h
usbaudio.h ALSA: usb-audio: Fix deadlocks at resuming 2014-05-02 18:17:06 +02:00