Commit 4fd6c6c7 authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Takashi Iwai

ALSA: bebob: change type of substream counter from atomic_t to unsigned int

The counter is incremented/decremented in critical section protected with
mutex. Therefore, no need to use atomic_t.

This commit changes the type to unsigned int.
Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 2a71e701
...@@ -95,7 +95,7 @@ struct snd_bebob { ...@@ -95,7 +95,7 @@ struct snd_bebob {
struct amdtp_stream rx_stream; struct amdtp_stream rx_stream;
struct cmp_connection out_conn; struct cmp_connection out_conn;
struct cmp_connection in_conn; struct cmp_connection in_conn;
atomic_t substreams_counter; unsigned int substreams_counter;
struct snd_bebob_stream_formation struct snd_bebob_stream_formation
tx_stream_formations[SND_BEBOB_STRM_FMT_ENTRIES]; tx_stream_formations[SND_BEBOB_STRM_FMT_ENTRIES];
......
...@@ -18,7 +18,7 @@ static int midi_capture_open(struct snd_rawmidi_substream *substream) ...@@ -18,7 +18,7 @@ static int midi_capture_open(struct snd_rawmidi_substream *substream)
goto end; goto end;
mutex_lock(&bebob->mutex); mutex_lock(&bebob->mutex);
atomic_inc(&bebob->substreams_counter); bebob->substreams_counter++;
err = snd_bebob_stream_start_duplex(bebob, 0); err = snd_bebob_stream_start_duplex(bebob, 0);
mutex_unlock(&bebob->mutex); mutex_unlock(&bebob->mutex);
if (err < 0) if (err < 0)
...@@ -37,7 +37,7 @@ static int midi_playback_open(struct snd_rawmidi_substream *substream) ...@@ -37,7 +37,7 @@ static int midi_playback_open(struct snd_rawmidi_substream *substream)
goto end; goto end;
mutex_lock(&bebob->mutex); mutex_lock(&bebob->mutex);
atomic_inc(&bebob->substreams_counter); bebob->substreams_counter++;
err = snd_bebob_stream_start_duplex(bebob, 0); err = snd_bebob_stream_start_duplex(bebob, 0);
mutex_unlock(&bebob->mutex); mutex_unlock(&bebob->mutex);
if (err < 0) if (err < 0)
...@@ -51,7 +51,7 @@ static int midi_capture_close(struct snd_rawmidi_substream *substream) ...@@ -51,7 +51,7 @@ static int midi_capture_close(struct snd_rawmidi_substream *substream)
struct snd_bebob *bebob = substream->rmidi->private_data; struct snd_bebob *bebob = substream->rmidi->private_data;
mutex_lock(&bebob->mutex); mutex_lock(&bebob->mutex);
atomic_dec(&bebob->substreams_counter); bebob->substreams_counter--;
snd_bebob_stream_stop_duplex(bebob); snd_bebob_stream_stop_duplex(bebob);
mutex_unlock(&bebob->mutex); mutex_unlock(&bebob->mutex);
...@@ -64,7 +64,7 @@ static int midi_playback_close(struct snd_rawmidi_substream *substream) ...@@ -64,7 +64,7 @@ static int midi_playback_close(struct snd_rawmidi_substream *substream)
struct snd_bebob *bebob = substream->rmidi->private_data; struct snd_bebob *bebob = substream->rmidi->private_data;
mutex_lock(&bebob->mutex); mutex_lock(&bebob->mutex);
atomic_dec(&bebob->substreams_counter); bebob->substreams_counter--;
snd_bebob_stream_stop_duplex(bebob); snd_bebob_stream_stop_duplex(bebob);
mutex_unlock(&bebob->mutex); mutex_unlock(&bebob->mutex);
......
...@@ -220,7 +220,7 @@ pcm_capture_hw_params(struct snd_pcm_substream *substream, ...@@ -220,7 +220,7 @@ pcm_capture_hw_params(struct snd_pcm_substream *substream,
if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN) { if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN) {
mutex_lock(&bebob->mutex); mutex_lock(&bebob->mutex);
atomic_inc(&bebob->substreams_counter); bebob->substreams_counter++;
mutex_unlock(&bebob->mutex); mutex_unlock(&bebob->mutex);
} }
...@@ -242,7 +242,7 @@ pcm_playback_hw_params(struct snd_pcm_substream *substream, ...@@ -242,7 +242,7 @@ pcm_playback_hw_params(struct snd_pcm_substream *substream,
if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN) { if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN) {
mutex_lock(&bebob->mutex); mutex_lock(&bebob->mutex);
atomic_inc(&bebob->substreams_counter); bebob->substreams_counter++;
mutex_unlock(&bebob->mutex); mutex_unlock(&bebob->mutex);
} }
...@@ -258,7 +258,7 @@ pcm_capture_hw_free(struct snd_pcm_substream *substream) ...@@ -258,7 +258,7 @@ pcm_capture_hw_free(struct snd_pcm_substream *substream)
if (substream->runtime->status->state != SNDRV_PCM_STATE_OPEN) { if (substream->runtime->status->state != SNDRV_PCM_STATE_OPEN) {
mutex_lock(&bebob->mutex); mutex_lock(&bebob->mutex);
atomic_dec(&bebob->substreams_counter); bebob->substreams_counter--;
mutex_unlock(&bebob->mutex); mutex_unlock(&bebob->mutex);
} }
...@@ -273,7 +273,7 @@ pcm_playback_hw_free(struct snd_pcm_substream *substream) ...@@ -273,7 +273,7 @@ pcm_playback_hw_free(struct snd_pcm_substream *substream)
if (substream->runtime->status->state != SNDRV_PCM_STATE_OPEN) { if (substream->runtime->status->state != SNDRV_PCM_STATE_OPEN) {
mutex_lock(&bebob->mutex); mutex_lock(&bebob->mutex);
atomic_dec(&bebob->substreams_counter); bebob->substreams_counter--;
mutex_unlock(&bebob->mutex); mutex_unlock(&bebob->mutex);
} }
......
...@@ -590,7 +590,7 @@ int snd_bebob_stream_start_duplex(struct snd_bebob *bebob, unsigned int rate) ...@@ -590,7 +590,7 @@ int snd_bebob_stream_start_duplex(struct snd_bebob *bebob, unsigned int rate)
int err = 0; int err = 0;
/* Need no substreams */ /* Need no substreams */
if (atomic_read(&bebob->substreams_counter) == 0) if (bebob->substreams_counter == 0)
goto end; goto end;
err = get_sync_mode(bebob, &sync_mode); err = get_sync_mode(bebob, &sync_mode);
...@@ -735,7 +735,7 @@ void snd_bebob_stream_stop_duplex(struct snd_bebob *bebob) ...@@ -735,7 +735,7 @@ void snd_bebob_stream_stop_duplex(struct snd_bebob *bebob)
master = &bebob->tx_stream; master = &bebob->tx_stream;
} }
if (atomic_read(&bebob->substreams_counter) == 0) { if (bebob->substreams_counter == 0) {
amdtp_stream_pcm_abort(master); amdtp_stream_pcm_abort(master);
amdtp_stream_stop(master); amdtp_stream_stop(master);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment