~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to sound/core/misc.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
        else
59
59
                return path;
60
60
}
61
 
 
62
 
/* print file and line with a certain printk prefix */
63
 
static 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
61
#endif
82
62
 
83
63
#if defined(CONFIG_SND_DEBUG) || defined(CONFIG_SND_VERBOSE_PRINTK)
85
65
                  const char *format, ...)
86
66
{
87
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
73
#ifdef CONFIG_SND_DEBUG 
90
74
        if (debug < level)
91
75
                return;
92
76
#endif
 
77
 
93
78
        va_start(args, format);
94
 
        if (print_snd_pfx(level, path, line, format))
95
 
                format += 3; /* skip the printk level-prefix */
 
79
#ifdef CONFIG_SND_VERBOSE_PRINTK
 
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
89
        vprintk(format, args);
 
90
#endif
97
91
        va_end(args);
98
92
}
99
93
EXPORT_SYMBOL_GPL(__snd_printk);