Skip to content

Commit

Permalink
checkpatch: update seq_<foo> tests
Browse files Browse the repository at this point in the history
seq_vprintf, seq_printf and seq_puts are logging functions and should be
allowed to exceed the maximium line length.

Add maximum line length exceptions for these functions.

Also, suggesting seq_printf conversions to seq_puts should be tested for
arguments after the format.

Signed-off-by: Joe Perches <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
JoePerches authored and torvalds committed Nov 13, 2013
1 parent d8b0771 commit 0666872
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@ sub hash_show_words {
(?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)|
WARN(?:_RATELIMIT|_ONCE|)|
panic|
MODULE_[A-Z_]+
MODULE_[A-Z_]+|
seq_vprintf|seq_printf|seq_puts
)};

our $signature_tags = qr{(?xi:
Expand Down Expand Up @@ -3909,9 +3910,9 @@ sub string_find_replace {
}

# check for seq_printf uses that could be seq_puts
if ($line =~ /\bseq_printf\s*\(/) {
if ($sline =~ /\bseq_printf\s*\(.*"\s*\)\s*;\s*$/) {
my $fmt = get_quoted_string($line, $rawline);
if ($fmt !~ /[^\\]\%/) {
if ($fmt ne "" && $fmt !~ /[^\\]\%/) {
if (WARN("PREFER_SEQ_PUTS",
"Prefer seq_puts to seq_printf\n" . $herecurr) &&
$fix) {
Expand Down

0 comments on commit 0666872

Please sign in to comment.