summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-08-27 12:34:54 +0200
committerTakashi Iwai <tiwai@suse.de>2009-08-27 12:39:35 +0200
commit1b0053a0f0893e6bbaaee0d28f5f6269459d8d14 (patch)
treec2cb5aeacb480992b4c92ea7a08283672cada6bb /sound
parent422bef879e84104fee6dc68ded0e371dbeb5f88e (diff)
ALSA: core - strip too long file names in snd_print*()
When modules are built with M= option, they pass long file paths to __FILE__. This results in ugly outputs of snd_print*() when CONFIG_SND_VERBOSE_PRINTK is set. This patch adds a check of the path and strips the leading path dirs if the file name is an absolute path to improve the readability of logs. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/core/misc.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sound/core/misc.c b/sound/core/misc.c
index a9710e0c97a..1d29e678369 100644
--- a/sound/core/misc.c
+++ b/sound/core/misc.c
@@ -35,8 +35,17 @@ void release_and_free_resource(struct resource *res)
EXPORT_SYMBOL(release_and_free_resource);
#ifdef CONFIG_SND_VERBOSE_PRINTK
-void snd_verbose_printk(const char *file, int line, const char *format, ...)
+static const char *sanity_file_name(const char *path)
{
+ if (*path == '/')
+ return strrchr(path, '/') + 1;
+ else
+ return path;
+}
+
+void snd_verbose_printk(const char *path, int line, const char *format, ...)
+{
+ const char *file = sanity_file_name(path);
va_list args;
if (format[0] == '<' && format[1] >= '0' && format[1] <= '7' && format[2] == '>') {
@@ -56,8 +65,9 @@ EXPORT_SYMBOL(snd_verbose_printk);
#endif
#if defined(CONFIG_SND_DEBUG) && defined(CONFIG_SND_VERBOSE_PRINTK)
-void snd_verbose_printd(const char *file, int line, const char *format, ...)
+void snd_verbose_printd(const char *path, int line, const char *format, ...)
{
+ const char *file = sanity_file_name(path);
va_list args;
if (format[0] == '<' && format[1] >= '0' && format[1] <= '7' && format[2] == '>') {