aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dynamic_debug.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-08-11 14:36:33 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-08-22 21:23:05 -0400
commit4ad275e5cb576fa4e3e12597cb81eed0d500416d (patch)
tree4f7ac61db1914a8e5c9e8063aca806e137897fc8 /lib/dynamic_debug.c
parent5b2ebce4821c66dd33d15d076ee264b4eb86fea3 (diff)
dynamic_debug: Convert printks to pr_<level>
Add pr_fmt(fmt) with __func__. Converts "ddebug:" prefix to "dynamic_debug:". Most likely the if (verbose) outputs could also be converted from pr_info to pr_debug. 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/dynamic_debug.c')
-rw-r--r--lib/dynamic_debug.c59
1 files changed, 26 insertions, 33 deletions
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index a3eb6ab074a6..4fc03ddb05f2 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -10,6 +10,8 @@
10 * Copyright (C) 2011 Bart Van Assche. All Rights Reserved. 10 * Copyright (C) 2011 Bart Van Assche. All Rights Reserved.
11 */ 11 */
12 12
13#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
14
13#include <linux/kernel.h> 15#include <linux/kernel.h>
14#include <linux/module.h> 16#include <linux/module.h>
15#include <linux/moduleparam.h> 17#include <linux/moduleparam.h>
@@ -160,8 +162,7 @@ static void ddebug_change(const struct ddebug_query *query,
160 else 162 else
161 dp->enabled = 0; 163 dp->enabled = 0;
162 if (verbose) 164 if (verbose)
163 printk(KERN_INFO 165 pr_info("changed %s:%d [%s]%s %s\n",
164 "ddebug: changed %s:%d [%s]%s %s\n",
165 dp->filename, dp->lineno, 166 dp->filename, dp->lineno,
166 dt->mod_name, dp->function, 167 dt->mod_name, dp->function,
167 ddebug_describe_flags(dp, flagbuf, 168 ddebug_describe_flags(dp, flagbuf,
@@ -171,7 +172,7 @@ static void ddebug_change(const struct ddebug_query *query,
171 mutex_unlock(&ddebug_lock); 172 mutex_unlock(&ddebug_lock);
172 173
173 if (!nfound && verbose) 174 if (!nfound && verbose)
174 printk(KERN_INFO "ddebug: no matches for query\n"); 175 pr_info("no matches for query\n");
175} 176}
176 177
177/* 178/*
@@ -216,10 +217,10 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords)
216 217
217 if (verbose) { 218 if (verbose) {
218 int i; 219 int i;
219 printk(KERN_INFO "%s: split into words:", __func__); 220 pr_info("split into words:");
220 for (i = 0 ; i < nwords ; i++) 221 for (i = 0 ; i < nwords ; i++)
221 printk(" \"%s\"", words[i]); 222 pr_cont(" \"%s\"", words[i]);
222 printk("\n"); 223 pr_cont("\n");
223 } 224 }
224 225
225 return nwords; 226 return nwords;
@@ -331,16 +332,15 @@ static int ddebug_parse_query(char *words[], int nwords,
331 } 332 }
332 } else { 333 } else {
333 if (verbose) 334 if (verbose)
334 printk(KERN_ERR "%s: unknown keyword \"%s\"\n", 335 pr_err("unknown keyword \"%s\"\n", words[i]);
335 __func__, words[i]);
336 return -EINVAL; 336 return -EINVAL;
337 } 337 }
338 } 338 }
339 339
340 if (verbose) 340 if (verbose)
341 printk(KERN_INFO "%s: q->function=\"%s\" q->filename=\"%s\" " 341 pr_info("q->function=\"%s\" q->filename=\"%s\" "
342 "q->module=\"%s\" q->format=\"%s\" q->lineno=%u-%u\n", 342 "q->module=\"%s\" q->format=\"%s\" q->lineno=%u-%u\n",
343 __func__, query->function, query->filename, 343 query->function, query->filename,
344 query->module, query->format, query->first_lineno, 344 query->module, query->format, query->first_lineno,
345 query->last_lineno); 345 query->last_lineno);
346 346
@@ -369,7 +369,7 @@ static int ddebug_parse_flags(const char *str, unsigned int *flagsp,
369 return -EINVAL; 369 return -EINVAL;
370 } 370 }
371 if (verbose) 371 if (verbose)
372 printk(KERN_INFO "%s: op='%c'\n", __func__, op); 372 pr_info("op='%c'\n", op);
373 373
374 for ( ; *str ; ++str) { 374 for ( ; *str ; ++str) {
375 for (i = ARRAY_SIZE(opt_array) - 1; i >= 0; i--) { 375 for (i = ARRAY_SIZE(opt_array) - 1; i >= 0; i--) {
@@ -384,7 +384,7 @@ static int ddebug_parse_flags(const char *str, unsigned int *flagsp,
384 if (flags == 0) 384 if (flags == 0)
385 return -EINVAL; 385 return -EINVAL;
386 if (verbose) 386 if (verbose)
387 printk(KERN_INFO "%s: flags=0x%x\n", __func__, flags); 387 pr_info("flags=0x%x\n", flags);
388 388
389 /* calculate final *flagsp, *maskp according to mask and op */ 389 /* calculate final *flagsp, *maskp according to mask and op */
390 switch (op) { 390 switch (op) {
@@ -402,8 +402,7 @@ static int ddebug_parse_flags(const char *str, unsigned int *flagsp,
402 break; 402 break;
403 } 403 }
404 if (verbose) 404 if (verbose)
405 printk(KERN_INFO "%s: *flagsp=0x%x *maskp=0x%x\n", 405 pr_info("*flagsp=0x%x *maskp=0x%x\n", *flagsp, *maskp);
406 __func__, *flagsp, *maskp);
407 return 0; 406 return 0;
408} 407}
409 408
@@ -508,7 +507,7 @@ static __initdata char ddebug_setup_string[1024];
508static __init int ddebug_setup_query(char *str) 507static __init int ddebug_setup_query(char *str)
509{ 508{
510 if (strlen(str) >= 1024) { 509 if (strlen(str) >= 1024) {
511 pr_warning("ddebug boot param string too large\n"); 510 pr_warn("ddebug boot param string too large\n");
512 return 0; 511 return 0;
513 } 512 }
514 strcpy(ddebug_setup_string, str); 513 strcpy(ddebug_setup_string, str);
@@ -536,8 +535,7 @@ static ssize_t ddebug_proc_write(struct file *file, const char __user *ubuf,
536 return -EFAULT; 535 return -EFAULT;
537 tmpbuf[len] = '\0'; 536 tmpbuf[len] = '\0';
538 if (verbose) 537 if (verbose)
539 printk(KERN_INFO "%s: read %d bytes from userspace\n", 538 pr_info("read %d bytes from userspace\n", (int)len);
540 __func__, (int)len);
541 539
542 ret = ddebug_exec_query(tmpbuf); 540 ret = ddebug_exec_query(tmpbuf);
543 if (ret) 541 if (ret)
@@ -600,8 +598,7 @@ static void *ddebug_proc_start(struct seq_file *m, loff_t *pos)
600 int n = *pos; 598 int n = *pos;
601 599
602 if (verbose) 600 if (verbose)
603 printk(KERN_INFO "%s: called m=%p *pos=%lld\n", 601 pr_info("called m=%p *pos=%lld\n", m, (unsigned long long)*pos);
604 __func__, m, (unsigned long long)*pos);
605 602
606 mutex_lock(&ddebug_lock); 603 mutex_lock(&ddebug_lock);
607 604
@@ -626,8 +623,8 @@ static void *ddebug_proc_next(struct seq_file *m, void *p, loff_t *pos)
626 struct _ddebug *dp; 623 struct _ddebug *dp;
627 624
628 if (verbose) 625 if (verbose)
629 printk(KERN_INFO "%s: called m=%p p=%p *pos=%lld\n", 626 pr_info("called m=%p p=%p *pos=%lld\n",
630 __func__, m, p, (unsigned long long)*pos); 627 m, p, (unsigned long long)*pos);
631 628
632 if (p == SEQ_START_TOKEN) 629 if (p == SEQ_START_TOKEN)
633 dp = ddebug_iter_first(iter); 630 dp = ddebug_iter_first(iter);
@@ -650,8 +647,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p)
650 char flagsbuf[8]; 647 char flagsbuf[8];
651 648
652 if (verbose) 649 if (verbose)
653 printk(KERN_INFO "%s: called m=%p p=%p\n", 650 pr_info("called m=%p p=%p\n", m, p);
654 __func__, m, p);
655 651
656 if (p == SEQ_START_TOKEN) { 652 if (p == SEQ_START_TOKEN) {
657 seq_puts(m, 653 seq_puts(m,
@@ -676,8 +672,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p)
676static void ddebug_proc_stop(struct seq_file *m, void *p) 672static void ddebug_proc_stop(struct seq_file *m, void *p)
677{ 673{
678 if (verbose) 674 if (verbose)
679 printk(KERN_INFO "%s: called m=%p p=%p\n", 675 pr_info("called m=%p p=%p\n", m, p);
680 __func__, m, p);
681 mutex_unlock(&ddebug_lock); 676 mutex_unlock(&ddebug_lock);
682} 677}
683 678
@@ -700,7 +695,7 @@ static int ddebug_proc_open(struct inode *inode, struct file *file)
700 int err; 695 int err;
701 696
702 if (verbose) 697 if (verbose)
703 printk(KERN_INFO "%s: called\n", __func__); 698 pr_info("called\n");
704 699
705 iter = kzalloc(sizeof(*iter), GFP_KERNEL); 700 iter = kzalloc(sizeof(*iter), GFP_KERNEL);
706 if (iter == NULL) 701 if (iter == NULL)
@@ -752,8 +747,7 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
752 mutex_unlock(&ddebug_lock); 747 mutex_unlock(&ddebug_lock);
753 748
754 if (verbose) 749 if (verbose)
755 printk(KERN_INFO "%u debug prints in module %s\n", 750 pr_info("%u debug prints in module %s\n", n, dt->mod_name);
756 n, dt->mod_name);
757 return 0; 751 return 0;
758} 752}
759EXPORT_SYMBOL_GPL(ddebug_add_module); 753EXPORT_SYMBOL_GPL(ddebug_add_module);
@@ -775,8 +769,7 @@ int ddebug_remove_module(const char *mod_name)
775 int ret = -ENOENT; 769 int ret = -ENOENT;
776 770
777 if (verbose) 771 if (verbose)
778 printk(KERN_INFO "%s: removing module \"%s\"\n", 772 pr_info("removing module \"%s\"\n", mod_name);
779 __func__, mod_name);
780 773
781 mutex_lock(&ddebug_lock); 774 mutex_lock(&ddebug_lock);
782 list_for_each_entry_safe(dt, nextdt, &ddebug_tables, link) { 775 list_for_each_entry_safe(dt, nextdt, &ddebug_tables, link) {
@@ -852,8 +845,8 @@ static int __init dynamic_debug_init(void)
852 if (ddebug_setup_string[0] != '\0') { 845 if (ddebug_setup_string[0] != '\0') {
853 ret = ddebug_exec_query(ddebug_setup_string); 846 ret = ddebug_exec_query(ddebug_setup_string);
854 if (ret) 847 if (ret)
855 pr_warning("Invalid ddebug boot param %s", 848 pr_warn("Invalid ddebug boot param %s",
856 ddebug_setup_string); 849 ddebug_setup_string);
857 else 850 else
858 pr_info("ddebug initialized with string %s", 851 pr_info("ddebug initialized with string %s",
859 ddebug_setup_string); 852 ddebug_setup_string);