diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-12-01 04:42:42 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:30:02 -0500 |
commit | e28563cceb9f258ebe3c50fc27d8f4ff0ac4bfa4 (patch) | |
tree | b69095abb998dedc2953368ba2c75978d80f644a /sound/core/pcm_memory.c | |
parent | 7cd01dd840824e7c6023ad1dbfdb94a2183a7adb (diff) |
[ALSA] Optimize for config without PROC_FS
Modules: HWDEP Midlevel,ALSA Core,PCM Midlevel,Timer Midlevel
Optimize the code when compiled without CONFIG_PROC_FS.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/pcm_memory.c')
-rw-r--r-- | sound/core/pcm_memory.c | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c index d37bcb76188..a0119ae67dc 100644 --- a/sound/core/pcm_memory.c +++ b/sound/core/pcm_memory.c | |||
@@ -100,10 +100,8 @@ static void snd_pcm_lib_preallocate_dma_free(struct snd_pcm_substream *substream | |||
100 | int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream) | 100 | int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream) |
101 | { | 101 | { |
102 | snd_pcm_lib_preallocate_dma_free(substream); | 102 | snd_pcm_lib_preallocate_dma_free(substream); |
103 | if (substream->proc_prealloc_entry) { | 103 | snd_info_unregister(substream->proc_prealloc_entry); |
104 | snd_info_unregister(substream->proc_prealloc_entry); | 104 | substream->proc_prealloc_entry = NULL; |
105 | substream->proc_prealloc_entry = NULL; | ||
106 | } | ||
107 | return 0; | 105 | return 0; |
108 | } | 106 | } |
109 | 107 | ||
@@ -126,6 +124,7 @@ int snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm) | |||
126 | return 0; | 124 | return 0; |
127 | } | 125 | } |
128 | 126 | ||
127 | #ifdef CONFIG_PROC_FS | ||
129 | /* | 128 | /* |
130 | * read callback for prealloc proc file | 129 | * read callback for prealloc proc file |
131 | * | 130 | * |
@@ -185,20 +184,10 @@ static void snd_pcm_lib_preallocate_proc_write(struct snd_info_entry *entry, | |||
185 | } | 184 | } |
186 | } | 185 | } |
187 | 186 | ||
188 | /* | 187 | static inline void preallocate_info_init(struct snd_pcm_substream *substream) |
189 | * pre-allocate the buffer and create a proc file for the substream | ||
190 | */ | ||
191 | static int snd_pcm_lib_preallocate_pages1(struct snd_pcm_substream *substream, | ||
192 | size_t size, size_t max) | ||
193 | { | 188 | { |
194 | struct snd_info_entry *entry; | 189 | struct snd_info_entry *entry; |
195 | 190 | ||
196 | if (size > 0 && preallocate_dma && substream->number < maximum_substreams) | ||
197 | preallocate_pcm_pages(substream, size); | ||
198 | |||
199 | if (substream->dma_buffer.bytes > 0) | ||
200 | substream->buffer_bytes_max = substream->dma_buffer.bytes; | ||
201 | substream->dma_max = max; | ||
202 | if ((entry = snd_info_create_card_entry(substream->pcm->card, "prealloc", substream->proc_root)) != NULL) { | 191 | if ((entry = snd_info_create_card_entry(substream->pcm->card, "prealloc", substream->proc_root)) != NULL) { |
203 | entry->c.text.read_size = 64; | 192 | entry->c.text.read_size = 64; |
204 | entry->c.text.read = snd_pcm_lib_preallocate_proc_read; | 193 | entry->c.text.read = snd_pcm_lib_preallocate_proc_read; |
@@ -212,6 +201,26 @@ static int snd_pcm_lib_preallocate_pages1(struct snd_pcm_substream *substream, | |||
212 | } | 201 | } |
213 | } | 202 | } |
214 | substream->proc_prealloc_entry = entry; | 203 | substream->proc_prealloc_entry = entry; |
204 | } | ||
205 | |||
206 | #else /* !CONFIG_PROC_FS */ | ||
207 | #define preallocate_info_init(s) | ||
208 | #endif | ||
209 | |||
210 | /* | ||
211 | * pre-allocate the buffer and create a proc file for the substream | ||
212 | */ | ||
213 | static int snd_pcm_lib_preallocate_pages1(struct snd_pcm_substream *substream, | ||
214 | size_t size, size_t max) | ||
215 | { | ||
216 | |||
217 | if (size > 0 && preallocate_dma && substream->number < maximum_substreams) | ||
218 | preallocate_pcm_pages(substream, size); | ||
219 | |||
220 | if (substream->dma_buffer.bytes > 0) | ||
221 | substream->buffer_bytes_max = substream->dma_buffer.bytes; | ||
222 | substream->dma_max = max; | ||
223 | preallocate_info_init(substream); | ||
215 | return 0; | 224 | return 0; |
216 | } | 225 | } |
217 | 226 | ||