All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: bebob: remove an unnecessary condition in hwdep_read()
@ 2021-01-25 14:02 Takashi Sakamoto
  2021-01-26  6:31 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Takashi Sakamoto @ 2021-01-25 14:02 UTC (permalink / raw)
  To: tiwai, perex; +Cc: alsa-devel, Christophe JAILLET, Dan Carpenter

Drivers in ALSA firewire stack supports eventing to userspace
applications via ALSA hwdep interface. All of the drivers supports stream
lock events. Some of them supports their unique events according to
specification of target device.

ALSA bebob driver supports the stream lock event only. In the case, it's
enough to check condition only in loop with process blocking. However,
current implementation check it again after breaking the loop.

This commit removes the redundant check.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/bebob/bebob_hwdep.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sound/firewire/bebob/bebob_hwdep.c b/sound/firewire/bebob/bebob_hwdep.c
index 8677e3ec8d14..6f9331655d43 100644
--- a/sound/firewire/bebob/bebob_hwdep.c
+++ b/sound/firewire/bebob/bebob_hwdep.c
@@ -37,11 +37,9 @@ hwdep_read(struct snd_hwdep *hwdep, char __user *buf,  long count,
 
 	memset(&event, 0, sizeof(event));
 	count = min_t(long, count, sizeof(event.lock_status));
-	if (bebob->dev_lock_changed) {
-		event.lock_status.type = SNDRV_FIREWIRE_EVENT_LOCK_STATUS;
-		event.lock_status.status = (bebob->dev_lock_count > 0);
-		bebob->dev_lock_changed = false;
-	}
+	event.lock_status.type = SNDRV_FIREWIRE_EVENT_LOCK_STATUS;
+	event.lock_status.status = (bebob->dev_lock_count > 0);
+	bebob->dev_lock_changed = false;
 
 	spin_unlock_irq(&bebob->lock);
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ALSA: bebob: remove an unnecessary condition in hwdep_read()
  2021-01-25 14:02 [PATCH] ALSA: bebob: remove an unnecessary condition in hwdep_read() Takashi Sakamoto
@ 2021-01-26  6:31 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2021-01-26  6:31 UTC (permalink / raw)
  To: Takashi Sakamoto; +Cc: alsa-devel, Christophe JAILLET, Dan Carpenter

On Mon, 25 Jan 2021 15:02:08 +0100,
Takashi Sakamoto wrote:
> 
> Drivers in ALSA firewire stack supports eventing to userspace
> applications via ALSA hwdep interface. All of the drivers supports stream
> lock events. Some of them supports their unique events according to
> specification of target device.
> 
> ALSA bebob driver supports the stream lock event only. In the case, it's
> enough to check condition only in loop with process blocking. However,
> current implementation check it again after breaking the loop.
> 
> This commit removes the redundant check.
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

Thanks, applied now.


Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-26  6:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-25 14:02 [PATCH] ALSA: bebob: remove an unnecessary condition in hwdep_read() Takashi Sakamoto
2021-01-26  6:31 ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.