From 3c548fd75656f57a8744a8e6708d88bcae052046 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 6 Oct 2006 15:12:29 +0200 Subject: [PATCH] --- yaml --- r: 47041 b: refs/heads/master c: c7132aeb72ad1106dc76279de4d005f9e1c5815c h: refs/heads/master i: 47039: 46b0915e5271293ec17535593bcf41379882029b v: v3 --- [refs] | 2 +- trunk/include/sound/pcm.h | 1 + trunk/sound/core/pcm_memory.c | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 18895f0cc152..31bdf100eafc 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b66b3cfe6c2f6560f351278883a325b6ebc478f5 +refs/heads/master: c7132aeb72ad1106dc76279de4d005f9e1c5815c diff --git a/trunk/include/sound/pcm.h b/trunk/include/sound/pcm.h index 016c41893b06..ec006ed8cd59 100644 --- a/trunk/include/sound/pcm.h +++ b/trunk/include/sound/pcm.h @@ -384,6 +384,7 @@ struct snd_pcm_substream { 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; #endif /* misc flags */ unsigned int hw_opened: 1; diff --git a/trunk/sound/core/pcm_memory.c b/trunk/sound/core/pcm_memory.c index be030cb4d373..95b1b2f0b1e2 100644 --- a/trunk/sound/core/pcm_memory.c +++ b/trunk/sound/core/pcm_memory.c @@ -101,6 +101,8 @@ 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_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 @@ -141,6 +143,18 @@ static void snd_pcm_lib_preallocate_proc_read(struct snd_info_entry *entry, snd_iprintf(buffer, "%lu\n", (unsigned long) substream->dma_buffer.bytes / 1024); } +/* + * read callback for prealloc_max proc file + * + * prints the maximum allowed size in kB. + */ +static void snd_pcm_lib_preallocate_max_proc_read(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) +{ + struct snd_pcm_substream *substream = entry->private_data; + snd_iprintf(buffer, "%lu\n", (unsigned long) substream->dma_max / 1024); +} + /* * write callback for prealloc proc file * @@ -203,6 +217,15 @@ static inline void preallocate_info_init(struct snd_pcm_substream *substream) } } 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) { + snd_info_free_entry(entry); + entry = NULL; + } + } + substream->proc_prealloc_max_entry = entry; } #else /* !CONFIG_SND_VERBOSE_PROCFS */