]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.36.2/alsa-fix-sndctl_dsp_reset-ioctl-for-oss-emulation.patch
Fixes for 5.10
[thirdparty/kernel/stable-queue.git] / releases / 2.6.36.2 / alsa-fix-sndctl_dsp_reset-ioctl-for-oss-emulation.patch
CommitLineData
d86d85d9
GKH
1From 60686aa0086a14f8b15c83a09f3df1eebe3aab3c Mon Sep 17 00:00:00 2001
2From: Takashi Iwai <tiwai@suse.de>
3Date: Tue, 30 Nov 2010 08:14:21 +0100
4Subject: ALSA: Fix SNDCTL_DSP_RESET ioctl for OSS emulation
5
6From: Takashi Iwai <tiwai@suse.de>
7
8commit 60686aa0086a14f8b15c83a09f3df1eebe3aab3c upstream.
9
10In OSS emulation, SNDCTL_DSP_RESET ioctl needs the reset of the internal
11buffer state in addition to drop of the running streams. Otherwise the
12succeeding access becomes inconsistent.
13
14Tested-by: Amit Nagal <helloin.amit@gmail.com>
15Signed-off-by: Takashi Iwai <tiwai@suse.de>
16Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17
18---
19 sound/core/oss/pcm_oss.c | 19 +++++++++++--------
20 1 file changed, 11 insertions(+), 8 deletions(-)
21
22--- a/sound/core/oss/pcm_oss.c
23+++ b/sound/core/oss/pcm_oss.c
24@@ -1510,16 +1510,19 @@ static ssize_t snd_pcm_oss_read1(struct
25 static int snd_pcm_oss_reset(struct snd_pcm_oss_file *pcm_oss_file)
26 {
27 struct snd_pcm_substream *substream;
28+ struct snd_pcm_runtime *runtime;
29+ int i;
30
31- substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK];
32- if (substream != NULL) {
33+ for (i = 0; i < 2; i++) {
34+ substream = pcm_oss_file->streams[i];
35+ if (!substream)
36+ continue;
37+ runtime = substream->runtime;
38 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL);
39- substream->runtime->oss.prepare = 1;
40- }
41- substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE];
42- if (substream != NULL) {
43- snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL);
44- substream->runtime->oss.prepare = 1;
45+ runtime->oss.prepare = 1;
46+ runtime->oss.buffer_used = 0;
47+ runtime->oss.prev_hw_ptr_period = 0;
48+ runtime->oss.period_ptr = 0;
49 }
50 return 0;
51 }