ALSA: pcm: Simplify proc file destruction
PATCH 1/1 ALSA: pcm: Simplify proc file destruction
The proc files are recursively freed by calling with the root snd_info_entry object, so we don't have to keep each object for releasing one by one. Move the release of the PCM stream proc root at the beginning, so that we can remove the redundant code and resource.
Signed-off-by Takashi Iwai <[email protected]>
--- include/sound/pcm.h | 11 --------- sound/core/pcm.c | 66 +++++++++---------------------------------------- sound/core/pcm_memory.c | 16 ++---------- 3 files changed, 13 insertions(+), 80 deletions(-)
include/sound/pcm.h +0 -11
@@ -481,15 +481,6 @@ struct snd_pcm_substream {#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; -struct snd_info_entry *proc_prealloc_max_entry; -#ifdef CONFIG_SND_PCM_XRUN_DEBUG -struct snd_info_entry *proc_xrun_injection_entry; -#endif #endif /* CONFIG_SND_VERBOSE_PROCFS */ /* misc flags */ unsigned int hw_opened: 1;
@@ -511,10 +502,8 @@ struct snd_pcm_str {#endif #ifdef CONFIG_SND_VERBOSE_PROCFS struct snd_info_entry *proc_root; -struct snd_info_entry *proc_info_entry;#ifdef CONFIG_SND_PCM_XRUN_DEBUG unsigned int xrun_debug;/* 0 = disabled, 1 = verbose, 2 = stacktrace */ -struct snd_info_entry *proc_xrun_debug_entry;#endif #endif struct snd_kcontrol *chmap_kctl;/* channel-mapping controls */
sound/core/pcm.c +11 -55
147 lines not on this page · raw message
sound/core/pcm_memory.c +2 -14
@@ -93,12 +93,6 @@ static void snd_pcm_lib_preallocate_dma_free(struct snd_pcm_substream *substreamint snd_pcm_lib_preallocate_free (struct snd_pcm_substream *substream) {snd_pcm_lib_preallocate_dma_free (substream); -#ifdef CONFIG_SND_VERBOSE_PROCFS -snd_info_free_entry (substream->proc_prealloc_max_entry); - substream->proc_prealloc_max_entry =NULL ; -snd_info_free_entry (substream->proc_prealloc_entry); - substream->proc_prealloc_entry =NULL ; -#endif return 0 ; }
@@ -203,21 +197,15 @@ static inline void preallocate_info_init(struct snd_pcm_substream *substream) entry->c.text.write = snd_pcm_lib_preallocate_proc_write; entry->mode |=0200 ; entry->private_data = substream; -if (snd_info_register (entry) <0 ) { +if (snd_info_register (entry) <0 ) snd_info_free_entry(entry); - entry =NULL ; - } } - substream->proc_prealloc_entry = entry;if ((entry =snd_info_create_card_entry (substream->pcm->card,"prealloc_max" , substream->proc_root)) !=NULL ) { entry->c.text.read = snd_pcm_lib_preallocate_max_proc_read; entry->private_data = substream; -if (snd_info_register (entry) <0 ) { +if (snd_info_register (entry) <0 )snd_info_free_entry (entry); - entry =NULL ; - } } - substream->proc_prealloc_max_entry = entry; }#else /* !CONFIG_SND_VERBOSE_PROCFS */
Signature · 1 line
2.16.4