summaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2017-08-20 13:49:06 +0900
committerTakashi Iwai <tiwai@suse.de>2017-08-20 09:39:53 +0200
commit7b42cfafdcbf73bd58687cbe3157b9ca4a0fd2e5 (patch)
tree7046be0c50860a09203864757869d4311a7d89d2 /sound/core
parent31cb1fb41df3b871d337544ed5199a135e606f69 (diff)
downloadlinux-7b42cfafdcbf73bd58687cbe3157b9ca4a0fd2e5.tar.bz2
ALSA: control: queue events within locking of controls_rwsem for ELEM_WRITE operation
Any control event is queued by a call of snd_ctl_notify(). This function adds the event to each queue of opened file data corresponding to ALSA control character devices. This function acquired two types of lock; a counting semaphore for a list of the opened file data and a spinlock for card data opened by the file. Typically, this function is called after acquiring a counting semaphore for a list of elements in the card data. In current implementation of a handler for ELEM_WRITE request, the function is called after releasing the semaphore for a list of elements in the card data. This release is not necessarily needed. This commit removes the release to call the function within the critical section so that later commits are simple. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/control.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sound/core/control.c b/sound/core/control.c
index 9e7a4571488b..79fdb366ac8d 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -948,9 +948,8 @@ static int snd_ctl_elem_write(struct snd_card *card, struct snd_ctl_file *file,
}
if (result > 0) {
struct snd_ctl_elem_id id = control->id;
- up_read(&card->controls_rwsem);
snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &id);
- return 0;
+ result = 0;
}
}
up_read(&card->controls_rwsem);