[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <151c1f3fc402d2f19f95e44de07cdc04917f7278.1309967232.git.root@dhcp-100-18-164.bos.redhat.com>
Date: Wed, 6 Jul 2011 13:24:40 -0400
From: Jason Baron <jbaron@...hat.com>
To: gregkh@...e.de
Cc: joe@...ches.com, jim.cromie@...il.com, bvanassche@....org,
linux-kernel@...r.kernel.org
Subject: [PATCH 02/10] dynamic_debug: Consolidate prefix output to single
routine
From: Joe Perches <joe@...ches.com>
Adding dynamic_dev_dbg duplicated prefix output.
Consolidate that output to a single routine.
Signed-off-by: Joe Perches <joe@...ches.com>
Signed-off-by: Jason Baron <jbaron@...hat.com>
---
lib/dynamic_debug.c | 38 ++++++++++++++++++--------------------
1 files changed, 18 insertions(+), 20 deletions(-)
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 5c5f8f9..758e922 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("", dev, &vaf);
va_end(args);
--
1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists