Commit b8ccd5dee776d85e29cf139c77595b7369e294bc
Committed by
Greg Kroah-Hartman
1 parent
c0a6720977
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
dynamic_debug: replace if (verbose) pr_info with macro vpr_info
Use vpr_info to declutter code, reduce indenting, and change one additional pr_info call in ddebug_exec_queries. Signed-off-by: Jim Cromie <jim.cromie@gmail.com> Acked-by: Jason Baron <jbaron@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 1 changed file with 35 additions and 46 deletions Side-by-side Diff
lib/dynamic_debug.c
... | ... | @@ -107,20 +107,22 @@ |
107 | 107 | return buf; |
108 | 108 | } |
109 | 109 | |
110 | -#define vpr_info_dq(q, msg) \ | |
111 | -do { \ | |
112 | - if (verbose) \ | |
113 | - /* trim last char off format print */ \ | |
114 | - pr_info("%s: func=\"%s\" file=\"%s\" " \ | |
115 | - "module=\"%s\" format=\"%.*s\" " \ | |
116 | - "lineno=%u-%u", \ | |
117 | - msg, \ | |
118 | - q->function ? q->function : "", \ | |
119 | - q->filename ? q->filename : "", \ | |
120 | - q->module ? q->module : "", \ | |
121 | - (int)(q->format ? strlen(q->format) - 1 : 0), \ | |
122 | - q->format ? q->format : "", \ | |
123 | - q->first_lineno, q->last_lineno); \ | |
110 | +#define vpr_info(fmt, ...) \ | |
111 | + if (verbose) do { pr_info(fmt, ##__VA_ARGS__); } while (0) | |
112 | + | |
113 | +#define vpr_info_dq(q, msg) \ | |
114 | +do { \ | |
115 | + /* trim last char off format print */ \ | |
116 | + vpr_info("%s: func=\"%s\" file=\"%s\" " \ | |
117 | + "module=\"%s\" format=\"%.*s\" " \ | |
118 | + "lineno=%u-%u", \ | |
119 | + msg, \ | |
120 | + q->function ? q->function : "", \ | |
121 | + q->filename ? q->filename : "", \ | |
122 | + q->module ? q->module : "", \ | |
123 | + (int)(q->format ? strlen(q->format) - 1 : 0), \ | |
124 | + q->format ? q->format : "", \ | |
125 | + q->first_lineno, q->last_lineno); \ | |
124 | 126 | } while (0) |
125 | 127 | |
126 | 128 | /* |
... | ... | @@ -180,12 +182,11 @@ |
180 | 182 | if (newflags == dp->flags) |
181 | 183 | continue; |
182 | 184 | dp->flags = newflags; |
183 | - if (verbose) | |
184 | - pr_info("changed %s:%d [%s]%s =%s\n", | |
185 | - trim_prefix(dp->filename), dp->lineno, | |
186 | - dt->mod_name, dp->function, | |
187 | - ddebug_describe_flags(dp, flagbuf, | |
188 | - sizeof(flagbuf))); | |
185 | + vpr_info("changed %s:%d [%s]%s =%s\n", | |
186 | + trim_prefix(dp->filename), dp->lineno, | |
187 | + dt->mod_name, dp->function, | |
188 | + ddebug_describe_flags(dp, flagbuf, | |
189 | + sizeof(flagbuf))); | |
189 | 190 | } |
190 | 191 | } |
191 | 192 | mutex_unlock(&ddebug_lock); |
... | ... | @@ -410,8 +411,7 @@ |
410 | 411 | default: |
411 | 412 | return -EINVAL; |
412 | 413 | } |
413 | - if (verbose) | |
414 | - pr_info("op='%c'\n", op); | |
414 | + vpr_info("op='%c'\n", op); | |
415 | 415 | |
416 | 416 | for ( ; *str ; ++str) { |
417 | 417 | for (i = ARRAY_SIZE(opt_array) - 1; i >= 0; i--) { |
... | ... | @@ -423,8 +423,7 @@ |
423 | 423 | if (i < 0) |
424 | 424 | return -EINVAL; |
425 | 425 | } |
426 | - if (verbose) | |
427 | - pr_info("flags=0x%x\n", flags); | |
426 | + vpr_info("flags=0x%x\n", flags); | |
428 | 427 | |
429 | 428 | /* calculate final *flagsp, *maskp according to mask and op */ |
430 | 429 | switch (op) { |
... | ... | @@ -441,8 +440,7 @@ |
441 | 440 | *flagsp = 0; |
442 | 441 | break; |
443 | 442 | } |
444 | - if (verbose) | |
445 | - pr_info("*flagsp=0x%x *maskp=0x%x\n", *flagsp, *maskp); | |
443 | + vpr_info("*flagsp=0x%x *maskp=0x%x\n", *flagsp, *maskp); | |
446 | 444 | return 0; |
447 | 445 | } |
448 | 446 | |
... | ... | @@ -487,8 +485,7 @@ |
487 | 485 | if (!query || !*query || *query == '#') |
488 | 486 | continue; |
489 | 487 | |
490 | - if (verbose) | |
491 | - pr_info("query %d: \"%s\"\n", i, query); | |
488 | + vpr_info("query %d: \"%s\"\n", i, query); | |
492 | 489 | |
493 | 490 | rc = ddebug_exec_query(query); |
494 | 491 | if (rc < 0) { |
... | ... | @@ -498,7 +495,7 @@ |
498 | 495 | nfound += rc; |
499 | 496 | i++; |
500 | 497 | } |
501 | - pr_info("processed %d queries, with %d matches, %d errs\n", | |
498 | + vpr_info("processed %d queries, with %d matches, %d errs\n", | |
502 | 499 | i, nfound, errs); |
503 | 500 | |
504 | 501 | if (exitcode) |
... | ... | @@ -653,8 +650,7 @@ |
653 | 650 | return -EFAULT; |
654 | 651 | } |
655 | 652 | tmpbuf[len] = '\0'; |
656 | - if (verbose) | |
657 | - pr_info("read %d bytes from userspace\n", (int)len); | |
653 | + vpr_info("read %d bytes from userspace\n", (int)len); | |
658 | 654 | |
659 | 655 | ret = ddebug_exec_queries(tmpbuf); |
660 | 656 | kfree(tmpbuf); |
... | ... | @@ -717,8 +713,7 @@ |
717 | 713 | struct _ddebug *dp; |
718 | 714 | int n = *pos; |
719 | 715 | |
720 | - if (verbose) | |
721 | - pr_info("called m=%p *pos=%lld\n", m, (unsigned long long)*pos); | |
716 | + vpr_info("called m=%p *pos=%lld\n", m, (unsigned long long)*pos); | |
722 | 717 | |
723 | 718 | mutex_lock(&ddebug_lock); |
724 | 719 | |
... | ... | @@ -742,9 +737,8 @@ |
742 | 737 | struct ddebug_iter *iter = m->private; |
743 | 738 | struct _ddebug *dp; |
744 | 739 | |
745 | - if (verbose) | |
746 | - pr_info("called m=%p p=%p *pos=%lld\n", | |
747 | - m, p, (unsigned long long)*pos); | |
740 | + vpr_info("called m=%p p=%p *pos=%lld\n", | |
741 | + m, p, (unsigned long long)*pos); | |
748 | 742 | |
749 | 743 | if (p == SEQ_START_TOKEN) |
750 | 744 | dp = ddebug_iter_first(iter); |
... | ... | @@ -766,8 +760,7 @@ |
766 | 760 | struct _ddebug *dp = p; |
767 | 761 | char flagsbuf[10]; |
768 | 762 | |
769 | - if (verbose) | |
770 | - pr_info("called m=%p p=%p\n", m, p); | |
763 | + vpr_info("called m=%p p=%p\n", m, p); | |
771 | 764 | |
772 | 765 | if (p == SEQ_START_TOKEN) { |
773 | 766 | seq_puts(m, |
... | ... | @@ -791,8 +784,7 @@ |
791 | 784 | */ |
792 | 785 | static void ddebug_proc_stop(struct seq_file *m, void *p) |
793 | 786 | { |
794 | - if (verbose) | |
795 | - pr_info("called m=%p p=%p\n", m, p); | |
787 | + vpr_info("called m=%p p=%p\n", m, p); | |
796 | 788 | mutex_unlock(&ddebug_lock); |
797 | 789 | } |
798 | 790 | |
... | ... | @@ -815,8 +807,7 @@ |
815 | 807 | struct ddebug_iter *iter; |
816 | 808 | int err; |
817 | 809 | |
818 | - if (verbose) | |
819 | - pr_info("called\n"); | |
810 | + vpr_info("called\n"); | |
820 | 811 | |
821 | 812 | iter = kzalloc(sizeof(*iter), GFP_KERNEL); |
822 | 813 | if (iter == NULL) |
... | ... | @@ -866,8 +857,7 @@ |
866 | 857 | list_add_tail(&dt->link, &ddebug_tables); |
867 | 858 | mutex_unlock(&ddebug_lock); |
868 | 859 | |
869 | - if (verbose) | |
870 | - pr_info("%u debug prints in module %s\n", n, dt->mod_name); | |
860 | + vpr_info("%u debug prints in module %s\n", n, dt->mod_name); | |
871 | 861 | return 0; |
872 | 862 | } |
873 | 863 | EXPORT_SYMBOL_GPL(ddebug_add_module); |
... | ... | @@ -888,8 +878,7 @@ |
888 | 878 | struct ddebug_table *dt, *nextdt; |
889 | 879 | int ret = -ENOENT; |
890 | 880 | |
891 | - if (verbose) | |
892 | - pr_info("removing module \"%s\"\n", mod_name); | |
881 | + vpr_info("removing module \"%s\"\n", mod_name); | |
893 | 882 | |
894 | 883 | mutex_lock(&ddebug_lock); |
895 | 884 | list_for_each_entry_safe(dt, nextdt, &ddebug_tables, link) { |