All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RFC - add prealloc_max proc file
@ 2006-10-06  8:27 Jaroslav Kysela
  2006-10-06  9:15 ` Clemens Ladisch
  0 siblings, 1 reply; 11+ messages in thread
From: Jaroslav Kysela @ 2006-10-06  8:27 UTC (permalink / raw)
  To: ALSA development

Hi,

	I would like to propose to add prealloc_max proc file to give a 
hint, what's the maximum allowed DMA buffer size in bytes:

diff -r 1551b696524c core/pcm_memory.c
--- a/core/pcm_memory.c	Fri Oct 06 09:34:20 2006 +0200
+++ b/core/pcm_memory.c	Fri Oct 06 10:26:15 2006 +0200
@@ -101,6 +101,8 @@ int snd_pcm_lib_preallocate_free(struct 
 {
 	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
@@ -139,6 +141,18 @@ static void snd_pcm_lib_preallocate_proc
 {
 	struct snd_pcm_substream *substream = entry->private_data;
 	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);
 }
 
 /*
@@ -203,6 +217,15 @@ static inline void preallocate_info_init
 		}
 	}
 	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 */
diff -r 1551b696524c include/pcm.h
--- a/include/pcm.h	Fri Oct 06 09:34:20 2006 +0200
+++ b/include/pcm.h	Fri Oct 06 10:26:15 2006 +0200
@@ -383,6 +383,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;

						Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SUSE Labs

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2006-10-06 17:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-06  8:27 [PATCH] RFC - add prealloc_max proc file Jaroslav Kysela
2006-10-06  9:15 ` Clemens Ladisch
2006-10-06 11:28   ` Takashi Iwai
2006-10-06 11:36     ` Jaroslav Kysela
2006-10-06 12:45       ` Takashi Iwai
2006-10-06 13:19         ` SYSFS, was " Jaroslav Kysela
2006-10-06 13:27           ` Takashi Iwai
2006-10-06 13:34             ` Jaroslav Kysela
2006-10-06 13:44               ` Takashi Iwai
2006-10-06 17:30                 ` Jaroslav Kysela
2006-10-06 17:32                   ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.