summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-08-11 14:36:25 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-08-22 18:23:04 -0700
commit6c2140ee0ebf91258f93d3019922b5f520a18d88 (patch)
tree69355a873ffa0632e192fafea92158d5259738c5 /lib
parentcbc4663552ee476f57933920d782222d94878e7e (diff)
downloadlinux-6c2140ee0ebf91258f93d3019922b5f520a18d88.tar.gz
linux-6c2140ee0ebf91258f93d3019922b5f520a18d88.tar.bz2
linux-6c2140ee0ebf91258f93d3019922b5f520a18d88.zip
dynamic_debug: Consolidate prefix output to single routine
Adding dynamic_dev_dbg duplicated prefix output. Consolidate that output to a single routine. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jason Baron <jbaron@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/dynamic_debug.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 63b6f95ac552..37217090aacf 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -428,15 +428,10 @@ static int ddebug_exec_query(char *query_string)
return 0;
}
-int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
+static int dynamic_emit_prefix(const struct _ddebug *descriptor)
{
- va_list args;
int res;
- BUG_ON(!descriptor);
- BUG_ON(!fmt);
-
- va_start(args, fmt);
res = printk(KERN_DEBUG);
if (descriptor->flags & _DPRINTK_FLAGS_INCL_TID) {
if (in_interrupt())
@@ -450,7 +445,23 @@ int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
res += printk(KERN_CONT "%s:", descriptor->function);
if (descriptor->flags & _DPRINTK_FLAGS_INCL_LINENO)
res += printk(KERN_CONT "%d ", descriptor->lineno);
+
+ return res;
+}
+
+int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
+{
+ va_list args;
+ int res;
+
+ BUG_ON(!descriptor);
+ BUG_ON(!fmt);
+
+ va_start(args, fmt);
+
+ res = dynamic_emit_prefix(descriptor);
res += vprintk(fmt, args);
+
va_end(args);
return res;
@@ -472,20 +483,7 @@ int __dynamic_dev_dbg(struct _ddebug *descriptor,
vaf.fmt = fmt;
vaf.va = &args;
- res = printk(KERN_DEBUG);
- if (descriptor->flags & _DPRINTK_FLAGS_INCL_TID) {
- if (in_interrupt())
- res += printk(KERN_CONT "<intr> ");
- else
- res += printk(KERN_CONT "[%d] ", task_pid_vnr(current));
- }
- if (descriptor->flags & _DPRINTK_FLAGS_INCL_MODNAME)
- res += printk(KERN_CONT "%s:", descriptor->modname);
- if (descriptor->flags & _DPRINTK_FLAGS_INCL_FUNCNAME)
- res += printk(KERN_CONT "%s:", descriptor->function);
- if (descriptor->flags & _DPRINTK_FLAGS_INCL_LINENO)
- res += printk(KERN_CONT "%d ", descriptor->lineno);
-
+ res = dynamic_emit_prefix(descriptor);
res += __dev_printk(KERN_CONT, dev, &vaf);
va_end(args);