From: Takashi Sakamoto Date: Sat, 20 Feb 2016 07:18:58 +0000 (+0900) Subject: ALSA: bebob: change type of substream counter from atomic_t to unsigned int X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4fd6c6c7295a50aa9390a3131623456e0c05d8f9;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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: Takashi Sakamoto Signed-off-by: Takashi Iwai --- diff --git a/sound/firewire/bebob/bebob.h b/sound/firewire/bebob/bebob.h index c2e885c06473..4fe58e422133 100644 --- a/sound/firewire/bebob/bebob.h +++ b/sound/firewire/bebob/bebob.h @@ -95,7 +95,7 @@ struct snd_bebob { struct amdtp_stream rx_stream; struct cmp_connection out_conn; struct cmp_connection in_conn; - atomic_t substreams_counter; + unsigned int substreams_counter; struct snd_bebob_stream_formation tx_stream_formations[SND_BEBOB_STRM_FMT_ENTRIES]; diff --git a/sound/firewire/bebob/bebob_midi.c b/sound/firewire/bebob/bebob_midi.c index cb1b385b3551..868eb0decbec 100644 --- a/sound/firewire/bebob/bebob_midi.c +++ b/sound/firewire/bebob/bebob_midi.c @@ -18,7 +18,7 @@ static int midi_capture_open(struct snd_rawmidi_substream *substream) goto end; mutex_lock(&bebob->mutex); - atomic_inc(&bebob->substreams_counter); + bebob->substreams_counter++; err = snd_bebob_stream_start_duplex(bebob, 0); mutex_unlock(&bebob->mutex); if (err < 0) @@ -37,7 +37,7 @@ static int midi_playback_open(struct snd_rawmidi_substream *substream) goto end; mutex_lock(&bebob->mutex); - atomic_inc(&bebob->substreams_counter); + bebob->substreams_counter++; err = snd_bebob_stream_start_duplex(bebob, 0); mutex_unlock(&bebob->mutex); if (err < 0) @@ -51,7 +51,7 @@ static int midi_capture_close(struct snd_rawmidi_substream *substream) struct snd_bebob *bebob = substream->rmidi->private_data; mutex_lock(&bebob->mutex); - atomic_dec(&bebob->substreams_counter); + bebob->substreams_counter--; snd_bebob_stream_stop_duplex(bebob); mutex_unlock(&bebob->mutex); @@ -64,7 +64,7 @@ static int midi_playback_close(struct snd_rawmidi_substream *substream) struct snd_bebob *bebob = substream->rmidi->private_data; mutex_lock(&bebob->mutex); - atomic_dec(&bebob->substreams_counter); + bebob->substreams_counter--; snd_bebob_stream_stop_duplex(bebob); mutex_unlock(&bebob->mutex); diff --git a/sound/firewire/bebob/bebob_pcm.c b/sound/firewire/bebob/bebob_pcm.c index 2053d31376df..5d7b9343fa85 100644 --- a/sound/firewire/bebob/bebob_pcm.c +++ b/sound/firewire/bebob/bebob_pcm.c @@ -220,7 +220,7 @@ pcm_capture_hw_params(struct snd_pcm_substream *substream, if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN) { mutex_lock(&bebob->mutex); - atomic_inc(&bebob->substreams_counter); + bebob->substreams_counter++; mutex_unlock(&bebob->mutex); } @@ -242,7 +242,7 @@ pcm_playback_hw_params(struct snd_pcm_substream *substream, if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN) { mutex_lock(&bebob->mutex); - atomic_inc(&bebob->substreams_counter); + bebob->substreams_counter++; mutex_unlock(&bebob->mutex); } @@ -258,7 +258,7 @@ pcm_capture_hw_free(struct snd_pcm_substream *substream) if (substream->runtime->status->state != SNDRV_PCM_STATE_OPEN) { mutex_lock(&bebob->mutex); - atomic_dec(&bebob->substreams_counter); + bebob->substreams_counter--; mutex_unlock(&bebob->mutex); } @@ -273,7 +273,7 @@ pcm_playback_hw_free(struct snd_pcm_substream *substream) if (substream->runtime->status->state != SNDRV_PCM_STATE_OPEN) { mutex_lock(&bebob->mutex); - atomic_dec(&bebob->substreams_counter); + bebob->substreams_counter--; mutex_unlock(&bebob->mutex); } diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c index 6809913110f4..8c687456a0e6 100644 --- a/sound/firewire/bebob/bebob_stream.c +++ b/sound/firewire/bebob/bebob_stream.c @@ -590,7 +590,7 @@ int snd_bebob_stream_start_duplex(struct snd_bebob *bebob, unsigned int rate) int err = 0; /* Need no substreams */ - if (atomic_read(&bebob->substreams_counter) == 0) + if (bebob->substreams_counter == 0) goto end; err = get_sync_mode(bebob, &sync_mode); @@ -735,7 +735,7 @@ void snd_bebob_stream_stop_duplex(struct snd_bebob *bebob) master = &bebob->tx_stream; } - if (atomic_read(&bebob->substreams_counter) == 0) { + if (bebob->substreams_counter == 0) { amdtp_stream_pcm_abort(master); amdtp_stream_stop(master);