ALSA: Use %pV for snd_printk()
Clean up snd_printk() helper using the %pV prefix for recursive printks. This also automagically fixes an Oops with RO/NX-enabled modules. Tested-by: Maarten Lankhorst <m.b.lankhorst@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
c0a20263db
commit
890ee02ac1
@ -58,26 +58,6 @@ static const char *sanity_file_name(const char *path)
|
|||||||
else
|
else
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* print file and line with a certain printk prefix */
|
|
||||||
static int print_snd_pfx(unsigned int level, const char *path, int line,
|
|
||||||
const char *format)
|
|
||||||
{
|
|
||||||
const char *file = sanity_file_name(path);
|
|
||||||
char tmp[] = "<0>";
|
|
||||||
const char *pfx = level ? KERN_DEBUG : KERN_DEFAULT;
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
if (format[0] == '<' && format[2] == '>') {
|
|
||||||
tmp[1] = format[1];
|
|
||||||
pfx = tmp;
|
|
||||||
ret = 1;
|
|
||||||
}
|
|
||||||
printk("%sALSA %s:%d: ", pfx, file, line);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define print_snd_pfx(level, path, line, format) 0
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SND_DEBUG) || defined(CONFIG_SND_VERBOSE_PRINTK)
|
#if defined(CONFIG_SND_DEBUG) || defined(CONFIG_SND_VERBOSE_PRINTK)
|
||||||
@ -85,15 +65,29 @@ void __snd_printk(unsigned int level, const char *path, int line,
|
|||||||
const char *format, ...)
|
const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
#ifdef CONFIG_SND_VERBOSE_PRINTK
|
||||||
|
struct va_format vaf;
|
||||||
|
char verbose_fmt[] = KERN_DEFAULT "ALSA %s:%d %pV";
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SND_DEBUG
|
#ifdef CONFIG_SND_DEBUG
|
||||||
if (debug < level)
|
if (debug < level)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
if (print_snd_pfx(level, path, line, format))
|
#ifdef CONFIG_SND_VERBOSE_PRINTK
|
||||||
format += 3; /* skip the printk level-prefix */
|
vaf.fmt = format;
|
||||||
|
vaf.va = &args;
|
||||||
|
if (format[0] == '<' && format[2] == '>') {
|
||||||
|
memcpy(verbose_fmt, format, 3);
|
||||||
|
vaf.fmt = format + 3;
|
||||||
|
} else if (level)
|
||||||
|
memcpy(verbose_fmt, KERN_DEBUG, 3);
|
||||||
|
printk(verbose_fmt, sanity_file_name(path), line, &vaf);
|
||||||
|
#else
|
||||||
vprintk(format, args);
|
vprintk(format, args);
|
||||||
|
#endif
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(__snd_printk);
|
EXPORT_SYMBOL_GPL(__snd_printk);
|
||||||
|
Loading…
Reference in New Issue
Block a user