From: Takashi Iwai Signed-off-by: Andrew Morton --- include/sound/pcm.h | 4 ++++ include/sound/pcm_oss.h | 2 ++ sound/core/Kconfig | 2 +- sound/core/oss/pcm_oss.c | 6 +++--- sound/core/pcm.c | 6 +++--- sound/core/pcm_lib.c | 6 +++--- sound/core/pcm_memory.c | 8 +++++--- 7 files changed, 21 insertions(+), 13 deletions(-) diff -puN include/sound/pcm.h~alsa-rmmod-oops-fix include/sound/pcm.h --- 25/include/sound/pcm.h~alsa-rmmod-oops-fix Mon Apr 24 16:00:33 2006 +++ 25-akpm/include/sound/pcm.h Mon Apr 24 16:00:33 2006 @@ -374,12 +374,14 @@ struct snd_pcm_substream { /* -- OSS things -- */ struct snd_pcm_oss_substream oss; #endif +#ifdef CONFIG_SND_VERBOSE_PROCFS struct snd_info_entry *proc_root; struct snd_info_entry *proc_info_entry; struct snd_info_entry *proc_hw_params_entry; struct snd_info_entry *proc_sw_params_entry; struct snd_info_entry *proc_status_entry; struct snd_info_entry *proc_prealloc_entry; +#endif /* misc flags */ unsigned int no_mmap_ctrl: 1; unsigned int hw_opened: 1; @@ -400,12 +402,14 @@ struct snd_pcm_str { struct snd_pcm_oss_stream oss; #endif struct snd_pcm_file *files; +#ifdef CONFIG_SND_VERBOSE_PROCFS struct snd_info_entry *proc_root; struct snd_info_entry *proc_info_entry; #ifdef CONFIG_SND_DEBUG unsigned int xrun_debug; /* 0 = disabled, 1 = verbose, 2 = stacktrace */ struct snd_info_entry *proc_xrun_debug_entry; #endif +#endif }; struct snd_pcm { diff -puN include/sound/pcm_oss.h~alsa-rmmod-oops-fix include/sound/pcm_oss.h --- 25/include/sound/pcm_oss.h~alsa-rmmod-oops-fix Mon Apr 24 16:00:33 2006 +++ 25-akpm/include/sound/pcm_oss.h Mon Apr 24 16:00:33 2006 @@ -75,7 +75,9 @@ struct snd_pcm_oss_substream { struct snd_pcm_oss_stream { struct snd_pcm_oss_setup *setup_list; /* setup list */ struct mutex setup_mutex; +#ifdef CONFIG_SND_VERBOSE_PROCFS struct snd_info_entry *proc_entry; +#endif }; struct snd_pcm_oss { diff -puN sound/core/Kconfig~alsa-rmmod-oops-fix sound/core/Kconfig --- 25/sound/core/Kconfig~alsa-rmmod-oops-fix Mon Apr 24 16:00:33 2006 +++ 25-akpm/sound/core/Kconfig Mon Apr 24 16:00:33 2006 @@ -142,7 +142,7 @@ config SND_SUPPORT_OLD_API config SND_VERBOSE_PROCFS bool "Verbose procfs contents" - depends on SND + depends on SND && PROC_FS default y help Say Y here to include code for verbose procfs contents (provides diff -puN sound/core/oss/pcm_oss.c~alsa-rmmod-oops-fix sound/core/oss/pcm_oss.c --- 25/sound/core/oss/pcm_oss.c~alsa-rmmod-oops-fix Mon Apr 24 16:00:33 2006 +++ 25-akpm/sound/core/oss/pcm_oss.c Mon Apr 24 16:00:33 2006 @@ -2212,7 +2212,7 @@ static int snd_pcm_oss_mmap(struct file return 0; } -#ifdef CONFIG_PROC_FS +#ifdef CONFIG_SND_VERBOSE_PROCFS /* * /proc interface */ @@ -2366,10 +2366,10 @@ static void snd_pcm_oss_proc_done(struct } } } -#else /* !CONFIG_PROC_FS */ +#else /* !CONFIG_SND_VERBOSE_PROCFS */ #define snd_pcm_oss_proc_init(pcm) #define snd_pcm_oss_proc_done(pcm) -#endif /* CONFIG_PROC_FS */ +#endif /* CONFIG_SND_VERBOSE_PROCFS */ /* * ENTRY functions diff -puN sound/core/pcm.c~alsa-rmmod-oops-fix sound/core/pcm.c --- 25/sound/core/pcm.c~alsa-rmmod-oops-fix Mon Apr 24 16:00:33 2006 +++ 25-akpm/sound/core/pcm.c Mon Apr 24 16:00:33 2006 @@ -142,7 +142,7 @@ static int snd_pcm_control_ioctl(struct return -ENOIOCTLCMD; } -#if defined(CONFIG_PROC_FS) && defined(CONFIG_SND_VERBOSE_PROCFS) +#ifdef CONFIG_SND_VERBOSE_PROCFS #define STATE(v) [SNDRV_PCM_STATE_##v] = #v #define STREAM(v) [SNDRV_PCM_STREAM_##v] = #v @@ -599,12 +599,12 @@ static int snd_pcm_substream_proc_done(s } return 0; } -#else /* !CONFIG_PROC_FS */ +#else /* !CONFIG_SND_VERBOSE_PROCFS */ static inline int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr) { return 0; } static inline int snd_pcm_stream_proc_done(struct snd_pcm_str *pstr) { return 0; } static inline int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream) { return 0; } static inline int snd_pcm_substream_proc_done(struct snd_pcm_substream *substream) { return 0; } -#endif /* CONFIG_PROC_FS */ +#endif /* CONFIG_SND_VERBOSE_PROCFS */ /** * snd_pcm_new_stream - create a new PCM stream diff -puN sound/core/pcm_lib.c~alsa-rmmod-oops-fix sound/core/pcm_lib.c --- 25/sound/core/pcm_lib.c~alsa-rmmod-oops-fix Mon Apr 24 16:00:33 2006 +++ 25-akpm/sound/core/pcm_lib.c Mon Apr 24 16:00:33 2006 @@ -130,7 +130,7 @@ void snd_pcm_playback_silence(struct snd static void xrun(struct snd_pcm_substream *substream) { snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); -#ifdef CONFIG_SND_DEBUG +#if defined(CONFIG_SND_DEBUG) && defined(CONFIG_SND_VERBOSE_PROCFS) if (substream->pstr->xrun_debug) { snd_printd(KERN_DEBUG "XRUN: pcmC%dD%d%c\n", substream->pcm->card->number, @@ -204,7 +204,7 @@ static inline int snd_pcm_update_hw_ptr_ delta = hw_ptr_interrupt - new_hw_ptr; if (delta > 0) { if ((snd_pcm_uframes_t)delta < runtime->buffer_size / 2) { -#ifdef CONFIG_SND_DEBUG +#if defined(CONFIG_SND_DEBUG) && defined(CONFIG_SND_VERBOSE_PROCFS) if (runtime->periods > 1 && substream->pstr->xrun_debug) { snd_printd(KERN_ERR "Unexpected hw_pointer value [1] (stream = %i, delta: -%ld, max jitter = %ld): wrong interrupt acknowledge?\n", substream->stream, (long) delta, runtime->buffer_size / 2); if (substream->pstr->xrun_debug > 1) @@ -249,7 +249,7 @@ int snd_pcm_update_hw_ptr(struct snd_pcm delta = old_hw_ptr - new_hw_ptr; if (delta > 0) { if ((snd_pcm_uframes_t)delta < runtime->buffer_size / 2) { -#ifdef CONFIG_SND_DEBUG +#if defined(CONFIG_SND_DEBUG) && defined(CONFIG_SND_VERBOSE_PROCFS) if (runtime->periods > 2 && substream->pstr->xrun_debug) { snd_printd(KERN_ERR "Unexpected hw_pointer value [2] (stream = %i, delta: -%ld, max jitter = %ld): wrong interrupt acknowledge?\n", substream->stream, (long) delta, runtime->buffer_size / 2); if (substream->pstr->xrun_debug > 1) diff -puN sound/core/pcm_memory.c~alsa-rmmod-oops-fix sound/core/pcm_memory.c --- 25/sound/core/pcm_memory.c~alsa-rmmod-oops-fix Mon Apr 24 16:00:33 2006 +++ 25-akpm/sound/core/pcm_memory.c Mon Apr 24 16:00:33 2006 @@ -100,8 +100,10 @@ static void snd_pcm_lib_preallocate_dma_ int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream) { snd_pcm_lib_preallocate_dma_free(substream); +#ifdef CONFIG_SND_VERBOSE_PROCFS snd_info_unregister(substream->proc_prealloc_entry); substream->proc_prealloc_entry = NULL; +#endif return 0; } @@ -124,7 +126,7 @@ int snd_pcm_lib_preallocate_free_for_all return 0; } -#ifdef CONFIG_PROC_FS +#ifdef CONFIG_SND_VERBOSE_PROCFS /* * read callback for prealloc proc file * @@ -203,9 +205,9 @@ static inline void preallocate_info_init substream->proc_prealloc_entry = entry; } -#else /* !CONFIG_PROC_FS */ +#else /* !CONFIG_SND_VERBOSE_PROCFS */ #define preallocate_info_init(s) -#endif +#endif /* CONFIG_SND_VERBOSE_PROCFS */ /* * pre-allocate the buffer and create a proc file for the substream _