diff options
author | Eliot Blennerhassett <eblennerhassett@audioscience.com> | 2011-07-22 20:36:25 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-07-24 07:34:32 -0400 |
commit | acb03d440b8a723181e1d45e3517e43cb0792f8a (patch) | |
tree | 19b93ccf3a036032c1d49ad6b5248c4a4dd6a480 | |
parent | 8f398ae72fc7e03356fc1ee6b54beef79ba6be6a (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>
-rw-r--r-- | include/sound/pcm.h | 12 | ||||
-rw-r--r-- | sound/core/pcm_lib.c | 13 | ||||
-rw-r--r-- | sound/pci/asihpi/asihpi.c | 21 |
3 files changed, 20 insertions, 26 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index e1bad1130616..ccf3a6e14f9f 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h | |||
@@ -507,6 +507,18 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream); | |||
507 | void snd_pcm_vma_notify_data(void *client, void *data); | 507 | void snd_pcm_vma_notify_data(void *client, void *data); |
508 | int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area); | 508 | int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area); |
509 | 509 | ||
510 | |||
511 | #ifdef CONFIG_SND_DEBUG | ||
512 | void snd_pcm_debug_name(struct snd_pcm_substream *substream, | ||
513 | char *name, size_t len); | ||
514 | #else | ||
515 | static inline void | ||
516 | snd_pcm_debug_name(struct snd_pcm_substream *substream, char *buf, size_t size) | ||
517 | { | ||
518 | *buf = 0; | ||
519 | } | ||
520 | #endif | ||
521 | |||
510 | /* | 522 | /* |
511 | * PCM library | 523 | * PCM library |
512 | */ | 524 | */ |
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 | ||
131 | static void pcm_debug_name(struct snd_pcm_substream *substream, | 131 | #ifdef CONFIG_SND_DEBUG |
132 | void 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 | } |
141 | EXPORT_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", |
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index b941d2541dda..eae62ebbd295 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c | |||
@@ -41,31 +41,10 @@ | |||
41 | #include <sound/tlv.h> | 41 | #include <sound/tlv.h> |
42 | #include <sound/hwdep.h> | 42 | #include <sound/hwdep.h> |
43 | 43 | ||
44 | |||
45 | MODULE_LICENSE("GPL"); | 44 | MODULE_LICENSE("GPL"); |
46 | MODULE_AUTHOR("AudioScience inc. <support@audioscience.com>"); | 45 | MODULE_AUTHOR("AudioScience inc. <support@audioscience.com>"); |
47 | MODULE_DESCRIPTION("AudioScience ALSA ASI5000 ASI6000 ASI87xx ASI89xx"); | 46 | MODULE_DESCRIPTION("AudioScience ALSA ASI5000 ASI6000 ASI87xx ASI89xx"); |
48 | 47 | ||
49 | #if defined CONFIG_SND_DEBUG | ||
50 | /* copied from pcm_lib.c, hope later patch will make that version public | ||
51 | and this copy can be removed */ | ||
52 | static inline void | ||
53 | snd_pcm_debug_name(struct snd_pcm_substream *substream, char *buf, size_t size) | ||
54 | { | ||
55 | snprintf(buf, size, "pcmC%dD%d%c:%d", | ||
56 | substream->pcm->card->number, | ||
57 | substream->pcm->device, | ||
58 | substream->stream ? 'c' : 'p', | ||
59 | substream->number); | ||
60 | } | ||
61 | #else | ||
62 | static inline void | ||
63 | snd_pcm_debug_name(struct snd_pcm_substream *substream, char *buf, size_t size) | ||
64 | { | ||
65 | *buf = 0; | ||
66 | } | ||
67 | #endif | ||
68 | |||
69 | #if defined CONFIG_SND_DEBUG_VERBOSE | 48 | #if defined CONFIG_SND_DEBUG_VERBOSE |
70 | /** | 49 | /** |
71 | * snd_printddd - very verbose debug printk | 50 | * snd_printddd - very verbose debug printk |