diff options
Diffstat (limited to 'sound/core/pcm_native.c')
-rw-r--r-- | sound/core/pcm_native.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 10c2c9832649..03c17159dd8e 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -1025,7 +1025,7 @@ static void snd_pcm_post_suspend(snd_pcm_substream_t *substream, int state) | |||
1025 | snd_pcm_runtime_t *runtime = substream->runtime; | 1025 | snd_pcm_runtime_t *runtime = substream->runtime; |
1026 | snd_pcm_trigger_tstamp(substream); | 1026 | snd_pcm_trigger_tstamp(substream); |
1027 | if (substream->timer) | 1027 | if (substream->timer) |
1028 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MPAUSE, &runtime->trigger_tstamp); | 1028 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSUSPEND, &runtime->trigger_tstamp); |
1029 | runtime->status->suspended_state = runtime->status->state; | 1029 | runtime->status->suspended_state = runtime->status->state; |
1030 | runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; | 1030 | runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; |
1031 | snd_pcm_tick_set(substream, 0); | 1031 | snd_pcm_tick_set(substream, 0); |
@@ -1115,7 +1115,7 @@ static void snd_pcm_post_resume(snd_pcm_substream_t *substream, int state) | |||
1115 | snd_pcm_runtime_t *runtime = substream->runtime; | 1115 | snd_pcm_runtime_t *runtime = substream->runtime; |
1116 | snd_pcm_trigger_tstamp(substream); | 1116 | snd_pcm_trigger_tstamp(substream); |
1117 | if (substream->timer) | 1117 | if (substream->timer) |
1118 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MCONTINUE, &runtime->trigger_tstamp); | 1118 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MRESUME, &runtime->trigger_tstamp); |
1119 | runtime->status->state = runtime->status->suspended_state; | 1119 | runtime->status->state = runtime->status->suspended_state; |
1120 | if (runtime->sleep_min) | 1120 | if (runtime->sleep_min) |
1121 | snd_pcm_tick_prepare(substream); | 1121 | snd_pcm_tick_prepare(substream); |
@@ -1967,13 +1967,12 @@ static int snd_pcm_release_file(snd_pcm_file_t * pcm_file) | |||
1967 | runtime = substream->runtime; | 1967 | runtime = substream->runtime; |
1968 | str = substream->pstr; | 1968 | str = substream->pstr; |
1969 | snd_pcm_unlink(substream); | 1969 | snd_pcm_unlink(substream); |
1970 | if (substream->open_flag) { | 1970 | if (substream->ffile != NULL) { |
1971 | if (substream->ops->hw_free != NULL) | 1971 | if (substream->ops->hw_free != NULL) |
1972 | substream->ops->hw_free(substream); | 1972 | substream->ops->hw_free(substream); |
1973 | substream->ops->close(substream); | 1973 | substream->ops->close(substream); |
1974 | substream->open_flag = 0; | 1974 | substream->ffile = NULL; |
1975 | } | 1975 | } |
1976 | substream->ffile = NULL; | ||
1977 | snd_pcm_remove_file(str, pcm_file); | 1976 | snd_pcm_remove_file(str, pcm_file); |
1978 | snd_pcm_release_substream(substream); | 1977 | snd_pcm_release_substream(substream); |
1979 | kfree(pcm_file); | 1978 | kfree(pcm_file); |
@@ -2022,18 +2021,15 @@ static int snd_pcm_open_file(struct file *file, | |||
2022 | snd_pcm_release_file(pcm_file); | 2021 | snd_pcm_release_file(pcm_file); |
2023 | return err; | 2022 | return err; |
2024 | } | 2023 | } |
2025 | substream->open_flag = 1; | 2024 | substream->ffile = file; |
2026 | 2025 | ||
2027 | err = snd_pcm_hw_constraints_complete(substream); | 2026 | err = snd_pcm_hw_constraints_complete(substream); |
2028 | if (err < 0) { | 2027 | if (err < 0) { |
2029 | snd_printd("snd_pcm_hw_constraints_complete failed\n"); | 2028 | snd_printd("snd_pcm_hw_constraints_complete failed\n"); |
2030 | substream->ops->close(substream); | ||
2031 | snd_pcm_release_file(pcm_file); | 2029 | snd_pcm_release_file(pcm_file); |
2032 | return err; | 2030 | return err; |
2033 | } | 2031 | } |
2034 | 2032 | ||
2035 | substream->ffile = file; | ||
2036 | |||
2037 | file->private_data = pcm_file; | 2033 | file->private_data = pcm_file; |
2038 | *rpcm_file = pcm_file; | 2034 | *rpcm_file = pcm_file; |
2039 | return 0; | 2035 | return 0; |