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>
This commit is contained in:
committed by
Takashi Iwai
parent
8f398ae72f
commit
acb03d440b
@@ -507,6 +507,18 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream);
|
|||||||
void snd_pcm_vma_notify_data(void *client, void *data);
|
void snd_pcm_vma_notify_data(void *client, void *data);
|
||||||
int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area);
|
int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CONFIG_SND_DEBUG
|
||||||
|
void snd_pcm_debug_name(struct snd_pcm_substream *substream,
|
||||||
|
char *name, size_t len);
|
||||||
|
#else
|
||||||
|
static inline void
|
||||||
|
snd_pcm_debug_name(struct snd_pcm_substream *substream, char *buf, size_t size)
|
||||||
|
{
|
||||||
|
*buf = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PCM library
|
* PCM library
|
||||||
*/
|
*/
|
||||||
|
@@ -128,7 +128,8 @@ void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_ufram
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pcm_debug_name(struct snd_pcm_substream *substream,
|
#ifdef CONFIG_SND_DEBUG
|
||||||
|
void snd_pcm_debug_name(struct snd_pcm_substream *substream,
|
||||||
char *name, size_t len)
|
char *name, size_t len)
|
||||||
{
|
{
|
||||||
snprintf(name, len, "pcmC%dD%d%c:%d",
|
snprintf(name, len, "pcmC%dD%d%c:%d",
|
||||||
@@ -137,6 +138,8 @@ static void pcm_debug_name(struct snd_pcm_substream *substream,
|
|||||||
substream->stream ? 'c' : 'p',
|
substream->stream ? 'c' : 'p',
|
||||||
substream->number);
|
substream->number);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(snd_pcm_debug_name);
|
||||||
|
#endif
|
||||||
|
|
||||||
#define XRUN_DEBUG_BASIC (1<<0)
|
#define XRUN_DEBUG_BASIC (1<<0)
|
||||||
#define XRUN_DEBUG_STACK (1<<1) /* dump also stack */
|
#define XRUN_DEBUG_STACK (1<<1) /* dump also stack */
|
||||||
@@ -168,7 +171,7 @@ static void xrun(struct snd_pcm_substream *substream)
|
|||||||
snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
|
snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
|
||||||
if (xrun_debug(substream, XRUN_DEBUG_BASIC)) {
|
if (xrun_debug(substream, XRUN_DEBUG_BASIC)) {
|
||||||
char name[16];
|
char name[16];
|
||||||
pcm_debug_name(substream, name, sizeof(name));
|
snd_pcm_debug_name(substream, name, sizeof(name));
|
||||||
snd_printd(KERN_DEBUG "XRUN: %s\n", name);
|
snd_printd(KERN_DEBUG "XRUN: %s\n", name);
|
||||||
dump_stack_on_xrun(substream);
|
dump_stack_on_xrun(substream);
|
||||||
}
|
}
|
||||||
@@ -243,7 +246,7 @@ static void xrun_log_show(struct snd_pcm_substream *substream)
|
|||||||
return;
|
return;
|
||||||
if (xrun_debug(substream, XRUN_DEBUG_LOGONCE) && log->hit)
|
if (xrun_debug(substream, XRUN_DEBUG_LOGONCE) && log->hit)
|
||||||
return;
|
return;
|
||||||
pcm_debug_name(substream, name, sizeof(name));
|
snd_pcm_debug_name(substream, name, sizeof(name));
|
||||||
for (cnt = 0, idx = log->idx; cnt < XRUN_LOG_CNT; cnt++) {
|
for (cnt = 0, idx = log->idx; cnt < XRUN_LOG_CNT; cnt++) {
|
||||||
entry = &log->entries[idx];
|
entry = &log->entries[idx];
|
||||||
if (entry->period_size == 0)
|
if (entry->period_size == 0)
|
||||||
@@ -319,7 +322,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
|
|||||||
if (pos >= runtime->buffer_size) {
|
if (pos >= runtime->buffer_size) {
|
||||||
if (printk_ratelimit()) {
|
if (printk_ratelimit()) {
|
||||||
char name[16];
|
char name[16];
|
||||||
pcm_debug_name(substream, name, sizeof(name));
|
snd_pcm_debug_name(substream, name, sizeof(name));
|
||||||
xrun_log_show(substream);
|
xrun_log_show(substream);
|
||||||
snd_printd(KERN_ERR "BUG: %s, pos = %ld, "
|
snd_printd(KERN_ERR "BUG: %s, pos = %ld, "
|
||||||
"buffer size = %ld, period size = %ld\n",
|
"buffer size = %ld, period size = %ld\n",
|
||||||
@@ -364,7 +367,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
|
|||||||
if (xrun_debug(substream, in_interrupt ?
|
if (xrun_debug(substream, in_interrupt ?
|
||||||
XRUN_DEBUG_PERIODUPDATE : XRUN_DEBUG_HWPTRUPDATE)) {
|
XRUN_DEBUG_PERIODUPDATE : XRUN_DEBUG_HWPTRUPDATE)) {
|
||||||
char name[16];
|
char name[16];
|
||||||
pcm_debug_name(substream, name, sizeof(name));
|
snd_pcm_debug_name(substream, name, sizeof(name));
|
||||||
snd_printd("%s_update: %s: pos=%u/%u/%u, "
|
snd_printd("%s_update: %s: pos=%u/%u/%u, "
|
||||||
"hwptr=%ld/%ld/%ld/%ld\n",
|
"hwptr=%ld/%ld/%ld/%ld\n",
|
||||||
in_interrupt ? "period" : "hwptr",
|
in_interrupt ? "period" : "hwptr",
|
||||||
|
@@ -41,31 +41,10 @@
|
|||||||
#include <sound/tlv.h>
|
#include <sound/tlv.h>
|
||||||
#include <sound/hwdep.h>
|
#include <sound/hwdep.h>
|
||||||
|
|
||||||
|
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
MODULE_AUTHOR("AudioScience inc. <support@audioscience.com>");
|
MODULE_AUTHOR("AudioScience inc. <support@audioscience.com>");
|
||||||
MODULE_DESCRIPTION("AudioScience ALSA ASI5000 ASI6000 ASI87xx ASI89xx");
|
MODULE_DESCRIPTION("AudioScience ALSA ASI5000 ASI6000 ASI87xx ASI89xx");
|
||||||
|
|
||||||
#if defined CONFIG_SND_DEBUG
|
|
||||||
/* copied from pcm_lib.c, hope later patch will make that version public
|
|
||||||
and this copy can be removed */
|
|
||||||
static inline void
|
|
||||||
snd_pcm_debug_name(struct snd_pcm_substream *substream, char *buf, size_t size)
|
|
||||||
{
|
|
||||||
snprintf(buf, size, "pcmC%dD%d%c:%d",
|
|
||||||
substream->pcm->card->number,
|
|
||||||
substream->pcm->device,
|
|
||||||
substream->stream ? 'c' : 'p',
|
|
||||||
substream->number);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
static inline void
|
|
||||||
snd_pcm_debug_name(struct snd_pcm_substream *substream, char *buf, size_t size)
|
|
||||||
{
|
|
||||||
*buf = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined CONFIG_SND_DEBUG_VERBOSE
|
#if defined CONFIG_SND_DEBUG_VERBOSE
|
||||||
/**
|
/**
|
||||||
* snd_printddd - very verbose debug printk
|
* snd_printddd - very verbose debug printk
|
||||||
|
Reference in New Issue
Block a user