Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

checkpatch: prefer ftrace over function entry/exit printks

Prefer using ftrace over function entry/exit logging messages.

Warn with various function entry/exit only logging that only
use __func__ with or without descriptive decoration.

Link: https://lkml.kernel.org/r/47c01081533a417c99c9a80a4cd537f8c308503f.camel@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Joe Perches and committed by
Linus Torvalds
adb2da82 ea7dbab3

+35
+35
scripts/checkpatch.pl
··· 507 507 Cc: 508 508 )}; 509 509 510 + our $tracing_logging_tags = qr{(?xi: 511 + [=-]*> | 512 + <[=-]* | 513 + \[ | 514 + \] | 515 + start | 516 + called | 517 + entered | 518 + entry | 519 + enter | 520 + in | 521 + inside | 522 + here | 523 + begin | 524 + exit | 525 + end | 526 + done | 527 + leave | 528 + completed | 529 + out | 530 + return | 531 + [\.\!:\s]* 532 + )}; 533 + 510 534 sub edit_distance_min { 511 535 my (@arr) = @_; 512 536 my $len = scalar @arr; ··· 5994 5970 length(get_quoted_string($line, $rawline)) != (length($context_function) + 2)) { 5995 5971 WARN("EMBEDDED_FUNCTION_NAME", 5996 5972 "Prefer using '\"%s...\", __func__' to using '$context_function', this function's name, in a string\n" . $herecurr); 5973 + } 5974 + 5975 + # check for unnecessary function tracing like uses 5976 + # This does not use $logFunctions because there are many instances like 5977 + # 'dprintk(FOO, "%s()\n", __func__);' which do not match $logFunctions 5978 + if ($rawline =~ /^\+.*\([^"]*"$tracing_logging_tags{0,3}%s(?:\s*\(\s*\)\s*)?$tracing_logging_tags{0,3}(?:\\n)?"\s*,\s*__func__\s*\)\s*;/) { 5979 + if (WARN("TRACING_LOGGING", 5980 + "Unnecessary ftrace-like logging - prefer using ftrace\n" . $herecurr) && 5981 + $fix) { 5982 + fix_delete_line($fixlinenr, $rawline); 5983 + } 5997 5984 } 5998 5985 5999 5986 # check for spaces before a quoted newline