diff mbox

[1/6] fireworks/bebob: Shorten critical section for stream_stop_duplex()

Message ID 1401863137-15103-2-git-send-email-o-takashi@sakamocchi.jp (mailing list archive)
State Accepted
Commit c6e5e741c6dc8e13a47721f419e26e6ac19ecaf4
Headers show

Commit Message

Takashi Sakamoto June 4, 2014, 6:25 a.m. UTC
All assignment for local variables in these functions are not related to
critical section.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/bebob/bebob_stream.c         | 4 ++--
 sound/firewire/fireworks/fireworks_stream.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Takashi Iwai June 4, 2014, 12:39 p.m. UTC | #1
At Wed,  4 Jun 2014 15:25:32 +0900,
Takashi Sakamoto wrote:
> 
> All assignment for local variables in these functions are not related to
> critical section.
> 
> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

Applied, thanks.


Takashi

> ---
>  sound/firewire/bebob/bebob_stream.c         | 4 ++--
>  sound/firewire/fireworks/fireworks_stream.c | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c
> index bc4f827..ef4d0c9 100644
> --- a/sound/firewire/bebob/bebob_stream.c
> +++ b/sound/firewire/bebob/bebob_stream.c
> @@ -655,8 +655,6 @@ void snd_bebob_stream_stop_duplex(struct snd_bebob *bebob)
>  	struct amdtp_stream *master, *slave;
>  	atomic_t *master_substreams, *slave_substreams;
>  
> -	mutex_lock(&bebob->mutex);
> -
>  	if (bebob->master == &bebob->rx_stream) {
>  		slave  = &bebob->tx_stream;
>  		master = &bebob->rx_stream;
> @@ -669,6 +667,8 @@ void snd_bebob_stream_stop_duplex(struct snd_bebob *bebob)
>  		master_substreams = &bebob->capture_substreams;
>  	}
>  
> +	mutex_lock(&bebob->mutex);
> +
>  	if (atomic_read(slave_substreams) == 0) {
>  		amdtp_stream_pcm_abort(slave);
>  		amdtp_stream_stop(slave);
> diff --git a/sound/firewire/fireworks/fireworks_stream.c b/sound/firewire/fireworks/fireworks_stream.c
> index 5415690..b985fc5 100644
> --- a/sound/firewire/fireworks/fireworks_stream.c
> +++ b/sound/firewire/fireworks/fireworks_stream.c
> @@ -284,8 +284,6 @@ void snd_efw_stream_stop_duplex(struct snd_efw *efw)
>  	struct amdtp_stream *master, *slave;
>  	atomic_t *master_substreams, *slave_substreams;
>  
> -	mutex_lock(&efw->mutex);
> -
>  	if (efw->master == &efw->rx_stream) {
>  		slave  = &efw->tx_stream;
>  		master = &efw->rx_stream;
> @@ -298,6 +296,8 @@ void snd_efw_stream_stop_duplex(struct snd_efw *efw)
>  		master_substreams = &efw->capture_substreams;
>  	}
>  
> +	mutex_lock(&efw->mutex);
> +
>  	if (atomic_read(slave_substreams) == 0) {
>  		stop_stream(efw, slave);
>  
> -- 
> 1.8.3.2
>
diff mbox

Patch

diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c
index bc4f827..ef4d0c9 100644
--- a/sound/firewire/bebob/bebob_stream.c
+++ b/sound/firewire/bebob/bebob_stream.c
@@ -655,8 +655,6 @@  void snd_bebob_stream_stop_duplex(struct snd_bebob *bebob)
 	struct amdtp_stream *master, *slave;
 	atomic_t *master_substreams, *slave_substreams;
 
-	mutex_lock(&bebob->mutex);
-
 	if (bebob->master == &bebob->rx_stream) {
 		slave  = &bebob->tx_stream;
 		master = &bebob->rx_stream;
@@ -669,6 +667,8 @@  void snd_bebob_stream_stop_duplex(struct snd_bebob *bebob)
 		master_substreams = &bebob->capture_substreams;
 	}
 
+	mutex_lock(&bebob->mutex);
+
 	if (atomic_read(slave_substreams) == 0) {
 		amdtp_stream_pcm_abort(slave);
 		amdtp_stream_stop(slave);
diff --git a/sound/firewire/fireworks/fireworks_stream.c b/sound/firewire/fireworks/fireworks_stream.c
index 5415690..b985fc5 100644
--- a/sound/firewire/fireworks/fireworks_stream.c
+++ b/sound/firewire/fireworks/fireworks_stream.c
@@ -284,8 +284,6 @@  void snd_efw_stream_stop_duplex(struct snd_efw *efw)
 	struct amdtp_stream *master, *slave;
 	atomic_t *master_substreams, *slave_substreams;
 
-	mutex_lock(&efw->mutex);
-
 	if (efw->master == &efw->rx_stream) {
 		slave  = &efw->tx_stream;
 		master = &efw->rx_stream;
@@ -298,6 +296,8 @@  void snd_efw_stream_stop_duplex(struct snd_efw *efw)
 		master_substreams = &efw->capture_substreams;
 	}
 
+	mutex_lock(&efw->mutex);
+
 	if (atomic_read(slave_substreams) == 0) {
 		stop_stream(efw, slave);