aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2014-04-03 17:49:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-03 19:21:13 -0400
commitcbec18afcc82a9b49953aeaa39ecb5ed553e3509 (patch)
treedd79c29439d6351b9ab4117fdeb13814cd917094 /scripts/checkpatch.pl
parent9b0fa60d9be0a82bc9e49bdd2dcacdfe4d1d5192 (diff)
checkpatch: use a more consistent function argument style
Instead of array indexing $_, use temporary variables like all the other subroutines in the script use. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl29
1 files changed, 20 insertions, 9 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 91308bec89b9..ae9f71d27a85 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1431,21 +1431,25 @@ sub possible {
1431my $prefix = ''; 1431my $prefix = '';
1432 1432
1433sub show_type { 1433sub show_type {
1434 return defined $use_type{$_[0]} if (scalar keys %use_type > 0); 1434 my ($type) = @_;
1435 1435
1436 return !defined $ignore_type{$_[0]}; 1436 return defined $use_type{$type} if (scalar keys %use_type > 0);
1437
1438 return !defined $ignore_type{$type};
1437} 1439}
1438 1440
1439sub report { 1441sub report {
1440 if (!show_type($_[1]) || 1442 my ($level, $type, $msg) = @_;
1441 (defined $tst_only && $_[2] !~ /\Q$tst_only\E/)) { 1443
1444 if (!show_type($type) ||
1445 (defined $tst_only && $msg !~ /\Q$tst_only\E/)) {
1442 return 0; 1446 return 0;
1443 } 1447 }
1444 my $line; 1448 my $line;
1445 if ($show_types) { 1449 if ($show_types) {
1446 $line = "$prefix$_[0]:$_[1]: $_[2]\n"; 1450 $line = "$prefix$level:$type: $msg\n";
1447 } else { 1451 } else {
1448 $line = "$prefix$_[0]: $_[2]\n"; 1452 $line = "$prefix$level: $msg\n";
1449 } 1453 }
1450 $line = (split('\n', $line))[0] . "\n" if ($terse); 1454 $line = (split('\n', $line))[0] . "\n" if ($terse);
1451 1455
@@ -1453,12 +1457,15 @@ sub report {
1453 1457
1454 return 1; 1458 return 1;
1455} 1459}
1460
1456sub report_dump { 1461sub report_dump {
1457 our @report; 1462 our @report;
1458} 1463}
1459 1464
1460sub ERROR { 1465sub ERROR {
1461 if (report("ERROR", $_[0], $_[1])) { 1466 my ($type, $msg) = @_;
1467
1468 if (report("ERROR", $type, $msg)) {
1462 our $clean = 0; 1469 our $clean = 0;
1463 our $cnt_error++; 1470 our $cnt_error++;
1464 return 1; 1471 return 1;
@@ -1466,7 +1473,9 @@ sub ERROR {
1466 return 0; 1473 return 0;
1467} 1474}
1468sub WARN { 1475sub WARN {
1469 if (report("WARNING", $_[0], $_[1])) { 1476 my ($type, $msg) = @_;
1477
1478 if (report("WARNING", $type, $msg)) {
1470 our $clean = 0; 1479 our $clean = 0;
1471 our $cnt_warn++; 1480 our $cnt_warn++;
1472 return 1; 1481 return 1;
@@ -1474,7 +1483,9 @@ sub WARN {
1474 return 0; 1483 return 0;
1475} 1484}
1476sub CHK { 1485sub CHK {
1477 if ($check && report("CHECK", $_[0], $_[1])) { 1486 my ($type, $msg) = @_;
1487
1488 if ($check && report("CHECK", $type, $msg)) {
1478 our $clean = 0; 1489 our $clean = 0;
1479 our $cnt_chk++; 1490 our $cnt_chk++;
1480 return 1; 1491 return 1;