diff options
author | Takashi Iwai <tiwai@suse.de> | 2006-04-06 13:47:42 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-04-12 05:34:04 -0400 |
commit | 1576274d30286dd048967176dc8e75e192051ff5 (patch) | |
tree | 5b8304905185ec023106afc4d53c3d77f736cd76 | |
parent | bbdc1b7dbe41578da7c9a6266cf450abe97e4ca7 (diff) |
[ALSA] Fix Oops of PCM OSS emulation
Modules: PCM Midlevel,ALSA<-OSS emulation
Fix Oops of PCM OSS emulation occuring when multiple playback is used.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | include/sound/pcm.h | 2 | ||||
-rw-r--r-- | sound/core/oss/pcm_oss.c | 5 | ||||
-rw-r--r-- | sound/core/pcm_native.c | 6 |
3 files changed, 8 insertions, 5 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 66b1f08b42b9..e9ab45556afa 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h | |||
@@ -367,7 +367,7 @@ struct snd_pcm_substream { | |||
367 | struct snd_pcm_group self_group; /* fake group for non linked substream (with substream lock inside) */ | 367 | struct snd_pcm_group self_group; /* fake group for non linked substream (with substream lock inside) */ |
368 | struct snd_pcm_group *group; /* pointer to current group */ | 368 | struct snd_pcm_group *group; /* pointer to current group */ |
369 | /* -- assigned files -- */ | 369 | /* -- assigned files -- */ |
370 | struct snd_pcm_file *file; | 370 | void *file; |
371 | struct file *ffile; | 371 | struct file *ffile; |
372 | void (*pcm_release)(struct snd_pcm_substream *); | 372 | void (*pcm_release)(struct snd_pcm_substream *); |
373 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) | 373 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) |
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 7c0c4e1d6943..c5978d6c6080 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c | |||
@@ -1682,7 +1682,7 @@ static void snd_pcm_oss_init_substream(struct snd_pcm_substream *substream, | |||
1682 | substream->oss.setup = *setup; | 1682 | substream->oss.setup = *setup; |
1683 | if (setup->nonblock) | 1683 | if (setup->nonblock) |
1684 | substream->ffile->f_flags |= O_NONBLOCK; | 1684 | substream->ffile->f_flags |= O_NONBLOCK; |
1685 | else | 1685 | else if (setup->block) |
1686 | substream->ffile->f_flags &= ~O_NONBLOCK; | 1686 | substream->ffile->f_flags &= ~O_NONBLOCK; |
1687 | runtime = substream->runtime; | 1687 | runtime = substream->runtime; |
1688 | runtime->oss.params = 1; | 1688 | runtime->oss.params = 1; |
@@ -1757,6 +1757,7 @@ static int snd_pcm_oss_open_file(struct file *file, | |||
1757 | } | 1757 | } |
1758 | 1758 | ||
1759 | pcm_oss_file->streams[idx] = substream; | 1759 | pcm_oss_file->streams[idx] = substream; |
1760 | substream->file = pcm_oss_file; | ||
1760 | snd_pcm_oss_init_substream(substream, &setup[idx], minor); | 1761 | snd_pcm_oss_init_substream(substream, &setup[idx], minor); |
1761 | } | 1762 | } |
1762 | 1763 | ||
@@ -1809,7 +1810,7 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file) | |||
1809 | err = -EFAULT; | 1810 | err = -EFAULT; |
1810 | goto __error; | 1811 | goto __error; |
1811 | } | 1812 | } |
1812 | memset(setup, 0, sizeof(*setup)); | 1813 | memset(setup, 0, sizeof(setup)); |
1813 | if (file->f_mode & FMODE_WRITE) | 1814 | if (file->f_mode & FMODE_WRITE) |
1814 | snd_pcm_oss_look_for_setup(pcm, SNDRV_PCM_STREAM_PLAYBACK, | 1815 | snd_pcm_oss_look_for_setup(pcm, SNDRV_PCM_STREAM_PLAYBACK, |
1815 | task_name, &setup[0]); | 1816 | task_name, &setup[0]); |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 964e4c47a7f1..0860c5a84502 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -2007,14 +2007,16 @@ static void pcm_release_private(struct snd_pcm_substream *substream) | |||
2007 | void snd_pcm_release_substream(struct snd_pcm_substream *substream) | 2007 | void snd_pcm_release_substream(struct snd_pcm_substream *substream) |
2008 | { | 2008 | { |
2009 | snd_pcm_drop(substream); | 2009 | snd_pcm_drop(substream); |
2010 | if (substream->pcm_release) | ||
2011 | substream->pcm_release(substream); | ||
2012 | if (substream->hw_opened) { | 2010 | if (substream->hw_opened) { |
2013 | if (substream->ops->hw_free != NULL) | 2011 | if (substream->ops->hw_free != NULL) |
2014 | substream->ops->hw_free(substream); | 2012 | substream->ops->hw_free(substream); |
2015 | substream->ops->close(substream); | 2013 | substream->ops->close(substream); |
2016 | substream->hw_opened = 0; | 2014 | substream->hw_opened = 0; |
2017 | } | 2015 | } |
2016 | if (substream->pcm_release) { | ||
2017 | substream->pcm_release(substream); | ||
2018 | substream->pcm_release = NULL; | ||
2019 | } | ||
2018 | snd_pcm_detach_substream(substream); | 2020 | snd_pcm_detach_substream(substream); |
2019 | } | 2021 | } |
2020 | 2022 | ||