* [PATCH 1/2] checkpatch: Use a more consistent function argument style
@ 2014-02-26 19:38 Joe Perches
2014-02-26 19:38 ` [PATCH 2/2] checkpatch: Ignore networking block comment style first lines in file Joe Perches
0 siblings, 1 reply; 2+ messages in thread
From: Joe Perches @ 2014-02-26 19:38 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
Instead of array indexing $_, use temporary variables like
all the other subroutines in the script use.
Signed-off-by: Joe Perches <joe@perches.com>
---
scripts/checkpatch.pl | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 91308be..ae9f71d 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1431,21 +1431,25 @@ sub possible {
my $prefix = '';
sub show_type {
- return defined $use_type{$_[0]} if (scalar keys %use_type > 0);
+ my ($type) = @_;
- return !defined $ignore_type{$_[0]};
+ return defined $use_type{$type} if (scalar keys %use_type > 0);
+
+ return !defined $ignore_type{$type};
}
sub report {
- if (!show_type($_[1]) ||
- (defined $tst_only && $_[2] !~ /\Q$tst_only\E/)) {
+ my ($level, $type, $msg) = @_;
+
+ if (!show_type($type) ||
+ (defined $tst_only && $msg !~ /\Q$tst_only\E/)) {
return 0;
}
my $line;
if ($show_types) {
- $line = "$prefix$_[0]:$_[1]: $_[2]\n";
+ $line = "$prefix$level:$type: $msg\n";
} else {
- $line = "$prefix$_[0]: $_[2]\n";
+ $line = "$prefix$level: $msg\n";
}
$line = (split('\n', $line))[0] . "\n" if ($terse);
@@ -1453,12 +1457,15 @@ sub report {
return 1;
}
+
sub report_dump {
our @report;
}
sub ERROR {
- if (report("ERROR", $_[0], $_[1])) {
+ my ($type, $msg) = @_;
+
+ if (report("ERROR", $type, $msg)) {
our $clean = 0;
our $cnt_error++;
return 1;
@@ -1466,7 +1473,9 @@ sub ERROR {
return 0;
}
sub WARN {
- if (report("WARNING", $_[0], $_[1])) {
+ my ($type, $msg) = @_;
+
+ if (report("WARNING", $type, $msg)) {
our $clean = 0;
our $cnt_warn++;
return 1;
@@ -1474,7 +1483,9 @@ sub WARN {
return 0;
}
sub CHK {
- if ($check && report("CHECK", $_[0], $_[1])) {
+ my ($type, $msg) = @_;
+
+ if ($check && report("CHECK", $type, $msg)) {
our $clean = 0;
our $cnt_chk++;
return 1;
--
1.8.1.2.459.gbcd45b4.dirty
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] checkpatch: Ignore networking block comment style first lines in file
2014-02-26 19:38 [PATCH 1/2] checkpatch: Use a more consistent function argument style Joe Perches
@ 2014-02-26 19:38 ` Joe Perches
0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2014-02-26 19:38 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
It's very common to have normal block comments for the initial
comments of a file description preface.
So for files in drivers/net and net/ don't emit a warning when
the first comment block in the file uses the normal block comment
style and not the networking block comment style.
Signed-off-by: Joe Perches <joe@perches.com>
---
scripts/checkpatch.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index ae9f71d..c624b04 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2219,7 +2219,8 @@ sub process {
if ($realfile =~ m@^(drivers/net/|net/)@ &&
$prevrawline =~ /^\+[ \t]*\/\*[ \t]*$/ &&
- $rawline =~ /^\+[ \t]*\*/) {
+ $rawline =~ /^\+[ \t]*\*/ &&
+ $realline > 2) {
WARN("NETWORKING_BLOCK_COMMENT_STYLE",
"networking block comments don't use an empty /* line, use /* Comment...\n" . $hereprev);
}
--
1.8.1.2.459.gbcd45b4.dirty
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-02-26 19:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-26 19:38 [PATCH 1/2] checkpatch: Use a more consistent function argument style Joe Perches
2014-02-26 19:38 ` [PATCH 2/2] checkpatch: Ignore networking block comment style first lines in file Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).