aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorEliot Blennerhassett <eblennerhassett@audioscience.com>2011-07-22 20:36:25 -0400
committerTakashi Iwai <tiwai@suse.de>2011-07-24 07:34:32 -0400
commitacb03d440b8a723181e1d45e3517e43cb0792f8a (patch)
tree19b93ccf3a036032c1d49ad6b5248c4a4dd6a480 /sound/core
parent8f398ae72fc7e03356fc1ee6b54beef79ba6be6a (diff)
ALSA: Make snd_pcm_debug_name usable outside pcm_lib
Formatting a PCM name is useful for module debug too. Add snd_prefix when making function public. [minor coding-style fixes by tiwai] Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/pcm_lib.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index f1341308beda..86d0caf91b35 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -128,7 +128,8 @@ void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_ufram
128 } 128 }
129} 129}
130 130
131static void pcm_debug_name(struct snd_pcm_substream *substream, 131#ifdef CONFIG_SND_DEBUG
132void snd_pcm_debug_name(struct snd_pcm_substream *substream,
132 char *name, size_t len) 133 char *name, size_t len)
133{ 134{
134 snprintf(name, len, "pcmC%dD%d%c:%d", 135 snprintf(name, len, "pcmC%dD%d%c:%d",
@@ -137,6 +138,8 @@ static void pcm_debug_name(struct snd_pcm_substream *substream,
137 substream->stream ? 'c' : 'p', 138 substream->stream ? 'c' : 'p',
138 substream->number); 139 substream->number);
139} 140}
141EXPORT_SYMBOL(snd_pcm_debug_name);
142#endif
140 143
141#define XRUN_DEBUG_BASIC (1<<0) 144#define XRUN_DEBUG_BASIC (1<<0)
142#define XRUN_DEBUG_STACK (1<<1) /* dump also stack */ 145#define XRUN_DEBUG_STACK (1<<1) /* dump also stack */
@@ -168,7 +171,7 @@ static void xrun(struct snd_pcm_substream *substream)
168 snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); 171 snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
169 if (xrun_debug(substream, XRUN_DEBUG_BASIC)) { 172 if (xrun_debug(substream, XRUN_DEBUG_BASIC)) {
170 char name[16]; 173 char name[16];
171 pcm_debug_name(substream, name, sizeof(name)); 174 snd_pcm_debug_name(substream, name, sizeof(name));
172 snd_printd(KERN_DEBUG "XRUN: %s\n", name); 175 snd_printd(KERN_DEBUG "XRUN: %s\n", name);
173 dump_stack_on_xrun(substream); 176 dump_stack_on_xrun(substream);
174 } 177 }
@@ -243,7 +246,7 @@ static void xrun_log_show(struct snd_pcm_substream *substream)
243 return; 246 return;
244 if (xrun_debug(substream, XRUN_DEBUG_LOGONCE) && log->hit) 247 if (xrun_debug(substream, XRUN_DEBUG_LOGONCE) && log->hit)
245 return; 248 return;
246 pcm_debug_name(substream, name, sizeof(name)); 249 snd_pcm_debug_name(substream, name, sizeof(name));
247 for (cnt = 0, idx = log->idx; cnt < XRUN_LOG_CNT; cnt++) { 250 for (cnt = 0, idx = log->idx; cnt < XRUN_LOG_CNT; cnt++) {
248 entry = &log->entries[idx]; 251 entry = &log->entries[idx];
249 if (entry->period_size == 0) 252 if (entry->period_size == 0)
@@ -319,7 +322,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
319 if (pos >= runtime->buffer_size) { 322 if (pos >= runtime->buffer_size) {
320 if (printk_ratelimit()) { 323 if (printk_ratelimit()) {
321 char name[16]; 324 char name[16];
322 pcm_debug_name(substream, name, sizeof(name)); 325 snd_pcm_debug_name(substream, name, sizeof(name));
323 xrun_log_show(substream); 326 xrun_log_show(substream);
324 snd_printd(KERN_ERR "BUG: %s, pos = %ld, " 327 snd_printd(KERN_ERR "BUG: %s, pos = %ld, "
325 "buffer size = %ld, period size = %ld\n", 328 "buffer size = %ld, period size = %ld\n",
@@ -364,7 +367,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
364 if (xrun_debug(substream, in_interrupt ? 367 if (xrun_debug(substream, in_interrupt ?
365 XRUN_DEBUG_PERIODUPDATE : XRUN_DEBUG_HWPTRUPDATE)) { 368 XRUN_DEBUG_PERIODUPDATE : XRUN_DEBUG_HWPTRUPDATE)) {
366 char name[16]; 369 char name[16];
367 pcm_debug_name(substream, name, sizeof(name)); 370 snd_pcm_debug_name(substream, name, sizeof(name));
368 snd_printd("%s_update: %s: pos=%u/%u/%u, " 371 snd_printd("%s_update: %s: pos=%u/%u/%u, "
369 "hwptr=%ld/%ld/%ld/%ld\n", 372 "hwptr=%ld/%ld/%ld/%ld\n",
370 in_interrupt ? "period" : "hwptr", 373 in_interrupt ? "period" : "hwptr",