aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/misc.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-06-21 15:02:57 -0400
committerKeith Packard <keithp@keithp.com>2011-06-21 15:02:57 -0400
commit2cd1176bd9e92924242e779dcc5c8fc922f96659 (patch)
treee9daa254647af2e7d9f99694e19976df0ea2a14d /sound/core/misc.c
parenta18711120764dd96ed2ee6a4d436c448542bad77 (diff)
parente92d03bff9a0d0bcbb812c9b1290ca96c9338d45 (diff)
Merge branch 'drm-intel-fixes' into drm-intel-next
Diffstat (limited to 'sound/core/misc.c')
-rw-r--r--sound/core/misc.c40
1 files changed, 17 insertions, 23 deletions
diff --git a/sound/core/misc.c b/sound/core/misc.c
index 2c41825c836e..eb9fe2e1d291 100644
--- a/sound/core/misc.c
+++ b/sound/core/misc.c
@@ -58,26 +58,6 @@ static const char *sanity_file_name(const char *path)
58 else 58 else
59 return path; 59 return path;
60} 60}
61
62/* print file and line with a certain printk prefix */
63static int print_snd_pfx(unsigned int level, const char *path, int line,
64 const char *format)
65{
66 const char *file = sanity_file_name(path);
67 char tmp[] = "<0>";
68 const char *pfx = level ? KERN_DEBUG : KERN_DEFAULT;
69 int ret = 0;
70
71 if (format[0] == '<' && format[2] == '>') {
72 tmp[1] = format[1];
73 pfx = tmp;
74 ret = 1;
75 }
76 printk("%sALSA %s:%d: ", pfx, file, line);
77 return ret;
78}
79#else
80#define print_snd_pfx(level, path, line, format) 0
81#endif 61#endif
82 62
83#if defined(CONFIG_SND_DEBUG) || defined(CONFIG_SND_VERBOSE_PRINTK) 63#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,
85 const char *format, ...) 65 const char *format, ...)
86{ 66{
87 va_list args; 67 va_list args;
88 68#ifdef CONFIG_SND_VERBOSE_PRINTK
69 struct va_format vaf;
70 char verbose_fmt[] = KERN_DEFAULT "ALSA %s:%d %pV";
71#endif
72
89#ifdef CONFIG_SND_DEBUG 73#ifdef CONFIG_SND_DEBUG
90 if (debug < level) 74 if (debug < level)
91 return; 75 return;
92#endif 76#endif
77
93 va_start(args, format); 78 va_start(args, format);
94 if (print_snd_pfx(level, path, line, format)) 79#ifdef CONFIG_SND_VERBOSE_PRINTK
95 format += 3; /* skip the printk level-prefix */ 80 vaf.fmt = format;
81 vaf.va = &args;
82 if (format[0] == '<' && format[2] == '>') {
83 memcpy(verbose_fmt, format, 3);
84 vaf.fmt = format + 3;
85 } else if (level)
86 memcpy(verbose_fmt, KERN_DEBUG, 3);
87 printk(verbose_fmt, sanity_file_name(path), line, &vaf);
88#else
96 vprintk(format, args); 89 vprintk(format, args);
90#endif
97 va_end(args); 91 va_end(args);
98} 92}
99EXPORT_SYMBOL_GPL(__snd_printk); 93EXPORT_SYMBOL_GPL(__snd_printk);