Skip to content

Commit b778b3f

Browse files
JoePerchestorvalds
authored andcommitted
sound: use printk_get_level and printk_skip_level
Make the output logging routine independent of the KERN_<LEVEL> style. Signed-off-by: Joe Perches <[email protected]> Cc: Kay Sievers <[email protected]> Cc: Takashi Iwai <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 533574c commit b778b3f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

sound/core/misc.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ void __snd_printk(unsigned int level, const char *path, int line,
6868
{
6969
va_list args;
7070
#ifdef CONFIG_SND_VERBOSE_PRINTK
71+
int kern_level;
7172
struct va_format vaf;
7273
char verbose_fmt[] = KERN_DEFAULT "ALSA %s:%d %pV";
7374
#endif
@@ -81,12 +82,16 @@ void __snd_printk(unsigned int level, const char *path, int line,
8182
#ifdef CONFIG_SND_VERBOSE_PRINTK
8283
vaf.fmt = format;
8384
vaf.va = &args;
84-
if (format[0] == '<' && format[2] == '>') {
85-
memcpy(verbose_fmt, format, 3);
86-
vaf.fmt = format + 3;
85+
86+
kern_level = printk_get_level(format);
87+
if (kern_level) {
88+
const char *end_of_header = printk_skip_level(format);
89+
memcpy(verbose_fmt, format, end_of_header - format);
90+
vaf.fmt = end_of_header;
8791
} else if (level)
88-
memcpy(verbose_fmt, KERN_DEBUG, 3);
92+
memcpy(verbose_fmt, KERN_DEBUG, sizeof(KERN_DEBUG) - 1);
8993
printk(verbose_fmt, sanity_file_name(path), line, &vaf);
94+
9095
#else
9196
vprintk(format, args);
9297
#endif

0 commit comments

Comments
 (0)