]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: control: use counting semaphore as write lock for TLV write/command operations
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Thu, 3 Aug 2017 11:20:41 +0000 (20:20 +0900)
committerTakashi Iwai <tiwai@suse.de>
Fri, 4 Aug 2017 14:50:55 +0000 (16:50 +0200)
commitf60e47af8a6ada0a39d4cdba92eac17042948922
tree402921d409b70e188d7b4b2d2bc89f0b52280dd8
parent308b2ac2ec4b509eae831189a9e18f95e6a7397f
ALSA: control: use counting semaphore as write lock for TLV write/command operations

In ALSA control interface, applications can execute three types of request
for Type-Length-Value (TLV) data to a set of elements; read, write and
command. In ALSA control core, all of the requests are handled within read
lock to a counting semaphore, therefore several processes can run to access
to the data at the same time for any purposes. This has an issue because
write and command requests have side effect to change state of a set of
elements for the TLV data. Concurrent access should be controlled for each
of reference/change case.

This commit uses the counting semaphore as read lock for TLV read requests,
while use it as write lock for TLV write/command requests. The state of a
set of elements for the TLV data is maintained exclusively between read
requests and write/command requests, or between write and command requests.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/control.c