From: Takashi Sakamoto Date: Thu, 3 Aug 2017 11:20:40 +0000 (+0900) Subject: ALSA: control: queue events within locking of controls_rwsem for TLV operation X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=28a0989c995087129b11ca3e00eb37ab77c29bce;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git ALSA: control: queue events within locking of controls_rwsem for TLV 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 TLV request handler, 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 Signed-off-by: Takashi Iwai --- diff --git a/sound/core/control.c b/sound/core/control.c index 3c6be1452e35..d2e1edbf843a 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -1450,9 +1450,8 @@ static int snd_ctl_tlv_ioctl(struct snd_ctl_file *file, err = kctl->tlv.c(kctl, op_flag, tlv.length, _tlv->tlv); if (err > 0) { struct snd_ctl_elem_id id = kctl->id; - up_read(&card->controls_rwsem); snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_TLV, &id); - return 0; + err = 0; } } else { if (op_flag != SNDRV_CTL_TLV_OP_READ) {