if (err < 0)
goto end;
+ mutex_lock(&efw->mutex);
atomic_inc(&efw->capture_substreams);
err = snd_efw_stream_start_duplex(efw, 0);
+ mutex_unlock(&efw->mutex);
if (err < 0)
snd_efw_stream_lock_release(efw);
if (err < 0)
goto end;
+ mutex_lock(&efw->mutex);
atomic_inc(&efw->playback_substreams);
err = snd_efw_stream_start_duplex(efw, 0);
+ mutex_unlock(&efw->mutex);
if (err < 0)
snd_efw_stream_lock_release(efw);
end:
{
struct snd_efw *efw = substream->rmidi->private_data;
+ mutex_lock(&efw->mutex);
atomic_dec(&efw->capture_substreams);
snd_efw_stream_stop_duplex(efw);
+ mutex_unlock(&efw->mutex);
snd_efw_stream_lock_release(efw);
return 0;
{
struct snd_efw *efw = substream->rmidi->private_data;
+ mutex_lock(&efw->mutex);
atomic_dec(&efw->playback_substreams);
snd_efw_stream_stop_duplex(efw);
+ mutex_unlock(&efw->mutex);
snd_efw_stream_lock_release(efw);
return 0;
if (err < 0)
return err;
- if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN)
+ if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN) {
+ mutex_lock(&efw->mutex);
atomic_inc(&efw->capture_substreams);
+ mutex_unlock(&efw->mutex);
+ }
amdtp_am824_set_pcm_format(&efw->tx_stream, params_format(hw_params));
if (err < 0)
return err;
- if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN)
+ if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN) {
+ mutex_lock(&efw->mutex);
atomic_inc(&efw->playback_substreams);
+ mutex_unlock(&efw->mutex);
+ }
amdtp_am824_set_pcm_format(&efw->rx_stream, params_format(hw_params));
{
struct snd_efw *efw = substream->private_data;
- if (substream->runtime->status->state != SNDRV_PCM_STATE_OPEN)
+ if (substream->runtime->status->state != SNDRV_PCM_STATE_OPEN) {
+ mutex_lock(&efw->mutex);
atomic_dec(&efw->capture_substreams);
+ mutex_unlock(&efw->mutex);
+ }
snd_efw_stream_stop_duplex(efw);
{
struct snd_efw *efw = substream->private_data;
- if (substream->runtime->status->state != SNDRV_PCM_STATE_OPEN)
+ if (substream->runtime->status->state != SNDRV_PCM_STATE_OPEN) {
+ mutex_lock(&efw->mutex);
atomic_dec(&efw->playback_substreams);
+ mutex_unlock(&efw->mutex);
+ }
snd_efw_stream_stop_duplex(efw);
unsigned int curr_rate;
int err = 0;
- mutex_lock(&efw->mutex);
-
/* Need no substreams */
if ((atomic_read(&efw->playback_substreams) == 0) &&
(atomic_read(&efw->capture_substreams) == 0))
}
}
end:
- mutex_unlock(&efw->mutex);
return err;
}
master_substreams = &efw->capture_substreams;
}
- mutex_lock(&efw->mutex);
-
if (atomic_read(slave_substreams) == 0) {
stop_stream(efw, slave);
if (atomic_read(master_substreams) == 0)
stop_stream(efw, master);
}
-
- mutex_unlock(&efw->mutex);
}
void snd_efw_stream_update_duplex(struct snd_efw *efw)