Skip to content

Commit b7d90a3

Browse files
tiwaiJaroslav Kysela
authored andcommitted
[ALSA] Fix Oops at rmmod with CONFIG_SND_VERBOSE_PROCFS=n
Fixed Oops at rmmod with CONFIG_SND_VERBOSE_PROCFS=n. Add ifdef to struct fields for optimization and better compile checks. Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 61fb63c commit b7d90a3

6 files changed

Lines changed: 20 additions & 12 deletions

File tree

‎include/sound/pcm.h‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,12 +374,14 @@ struct snd_pcm_substream {
374374
/* -- OSS things -- */
375375
struct snd_pcm_oss_substream oss;
376376
#endif
377+
#ifdef CONFIG_SND_VERBOSE_PROCFS
377378
struct snd_info_entry *proc_root;
378379
struct snd_info_entry *proc_info_entry;
379380
struct snd_info_entry *proc_hw_params_entry;
380381
struct snd_info_entry *proc_sw_params_entry;
381382
struct snd_info_entry *proc_status_entry;
382383
struct snd_info_entry *proc_prealloc_entry;
384+
#endif
383385
/* misc flags */
384386
unsigned int no_mmap_ctrl: 1;
385387
unsigned int hw_opened: 1;
@@ -400,12 +402,14 @@ struct snd_pcm_str {
400402
struct snd_pcm_oss_stream oss;
401403
#endif
402404
struct snd_pcm_file *files;
405+
#ifdef CONFIG_SND_VERBOSE_PROCFS
403406
struct snd_info_entry *proc_root;
404407
struct snd_info_entry *proc_info_entry;
405-
#ifdef CONFIG_SND_DEBUG
408+
#ifdef CONFIG_SND_PCM_XRUN_DEBUG
406409
unsigned int xrun_debug; /* 0 = disabled, 1 = verbose, 2 = stacktrace */
407410
struct snd_info_entry *proc_xrun_debug_entry;
408411
#endif
412+
#endif
409413
};
410414

411415
struct snd_pcm {

‎include/sound/pcm_oss.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ struct snd_pcm_oss_substream {
7575
struct snd_pcm_oss_stream {
7676
struct snd_pcm_oss_setup *setup_list; /* setup list */
7777
struct mutex setup_mutex;
78+
#ifdef CONFIG_SND_VERBOSE_PROCFS
7879
struct snd_info_entry *proc_entry;
80+
#endif
7981
};
8082

8183
struct snd_pcm_oss {

‎sound/core/Kconfig‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ config SND_SUPPORT_OLD_API
142142

143143
config SND_VERBOSE_PROCFS
144144
bool "Verbose procfs contents"
145-
depends on SND
145+
depends on SND && PROC_FS
146146
default y
147147
help
148148
Say Y here to include code for verbose procfs contents (provides
@@ -175,7 +175,7 @@ config SND_DEBUG_DETECT
175175
config SND_PCM_XRUN_DEBUG
176176
bool "Enable PCM ring buffer overrun/underrun debugging"
177177
default n
178-
depends on SND_DEBUG
178+
depends on SND_DEBUG && SND_VERBOSE_PROCFS
179179
help
180180
Say Y to enable the PCM ring buffer overrun/underrun debugging.
181181
It is usually not required, but if you have trouble with

‎sound/core/oss/pcm_oss.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2214,7 +2214,7 @@ static int snd_pcm_oss_mmap(struct file *file, struct vm_area_struct *area)
22142214
return 0;
22152215
}
22162216

2217-
#ifdef CONFIG_PROC_FS
2217+
#ifdef CONFIG_SND_VERBOSE_PROCFS
22182218
/*
22192219
* /proc interface
22202220
*/
@@ -2368,10 +2368,10 @@ static void snd_pcm_oss_proc_done(struct snd_pcm *pcm)
23682368
}
23692369
}
23702370
}
2371-
#else /* !CONFIG_PROC_FS */
2371+
#else /* !CONFIG_SND_VERBOSE_PROCFS */
23722372
#define snd_pcm_oss_proc_init(pcm)
23732373
#define snd_pcm_oss_proc_done(pcm)
2374-
#endif /* CONFIG_PROC_FS */
2374+
#endif /* CONFIG_SND_VERBOSE_PROCFS */
23752375

23762376
/*
23772377
* ENTRY functions

‎sound/core/pcm.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static int snd_pcm_control_ioctl(struct snd_card *card,
142142
return -ENOIOCTLCMD;
143143
}
144144

145-
#if defined(CONFIG_PROC_FS) && defined(CONFIG_SND_VERBOSE_PROCFS)
145+
#ifdef CONFIG_SND_VERBOSE_PROCFS
146146

147147
#define STATE(v) [SNDRV_PCM_STATE_##v] = #v
148148
#define STREAM(v) [SNDRV_PCM_STREAM_##v] = #v
@@ -599,12 +599,12 @@ static int snd_pcm_substream_proc_done(struct snd_pcm_substream *substream)
599599
}
600600
return 0;
601601
}
602-
#else /* !CONFIG_PROC_FS */
602+
#else /* !CONFIG_SND_VERBOSE_PROCFS */
603603
static inline int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr) { return 0; }
604604
static inline int snd_pcm_stream_proc_done(struct snd_pcm_str *pstr) { return 0; }
605605
static inline int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream) { return 0; }
606606
static inline int snd_pcm_substream_proc_done(struct snd_pcm_substream *substream) { return 0; }
607-
#endif /* CONFIG_PROC_FS */
607+
#endif /* CONFIG_SND_VERBOSE_PROCFS */
608608

609609
/**
610610
* snd_pcm_new_stream - create a new PCM stream

‎sound/core/pcm_memory.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,10 @@ static void snd_pcm_lib_preallocate_dma_free(struct snd_pcm_substream *substream
100100
int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream)
101101
{
102102
snd_pcm_lib_preallocate_dma_free(substream);
103+
#ifdef CONFIG_SND_VERBOSE_PROCFS
103104
snd_info_unregister(substream->proc_prealloc_entry);
104105
substream->proc_prealloc_entry = NULL;
106+
#endif
105107
return 0;
106108
}
107109

@@ -124,7 +126,7 @@ int snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm)
124126
return 0;
125127
}
126128

127-
#ifdef CONFIG_PROC_FS
129+
#ifdef CONFIG_SND_VERBOSE_PROCFS
128130
/*
129131
* read callback for prealloc proc file
130132
*
@@ -203,9 +205,9 @@ static inline void preallocate_info_init(struct snd_pcm_substream *substream)
203205
substream->proc_prealloc_entry = entry;
204206
}
205207

206-
#else /* !CONFIG_PROC_FS */
208+
#else /* !CONFIG_SND_VERBOSE_PROCFS */
207209
#define preallocate_info_init(s)
208-
#endif
210+
#endif /* CONFIG_SND_VERBOSE_PROCFS */
209211

210212
/*
211213
* pre-allocate the buffer and create a proc file for the substream

0 commit comments

Comments
 (0)