diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-26 00:00:19 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-26 00:00:19 -0400 |
| commit | 45b583b10a8b438b970e95a7d1d4db22c9e35004 (patch) | |
| tree | 14fa481598289df0459580c582b48a9d95db51f6 /scripts | |
| parent | 154dd78d30b56ffb8b447f629bfcceb14150e5c4 (diff) | |
| parent | f19da2ce8ef5e49b8b8ea199c3601dd45d71b262 (diff) | |
Merge 'akpm' patch series
* Merge akpm patch series: (122 commits)
drivers/connector/cn_proc.c: remove unused local
Documentation/SubmitChecklist: add RCU debug config options
reiserfs: use hweight_long()
reiserfs: use proper little-endian bitops
pnpacpi: register disabled resources
drivers/rtc/rtc-tegra.c: properly initialize spinlock
drivers/rtc/rtc-twl.c: check return value of twl_rtc_write_u8() in twl_rtc_set_time()
drivers/rtc: add support for Qualcomm PMIC8xxx RTC
drivers/rtc/rtc-s3c.c: support clock gating
drivers/rtc/rtc-mpc5121.c: add support for RTC on MPC5200
init: skip calibration delay if previously done
misc/eeprom: add eeprom access driver for digsy_mtc board
misc/eeprom: add driver for microwire 93xx46 EEPROMs
checkpatch.pl: update $logFunctions
checkpatch: make utf-8 test --strict
checkpatch.pl: add ability to ignore various messages
checkpatch: add a "prefer __aligned" check
checkpatch: validate signature styles and To: and Cc: lines
checkpatch: add __rcu as a sparse modifier
checkpatch: suggest using min_t or max_t
...
Did this as a merge because of (trivial) conflicts in
- Documentation/feature-removal-schedule.txt
- arch/xtensa/include/asm/uaccess.h
that were just easier to fix up in the merge than in the patch series.
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/checkpatch.pl | 656 | ||||
| -rwxr-xr-x | scripts/get_maintainer.pl | 9 |
2 files changed, 513 insertions, 152 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index b0aa2c680593..9d761c95eca2 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
| @@ -10,7 +10,7 @@ use strict; | |||
| 10 | my $P = $0; | 10 | my $P = $0; |
| 11 | $P =~ s@.*/@@g; | 11 | $P =~ s@.*/@@g; |
| 12 | 12 | ||
| 13 | my $V = '0.31'; | 13 | my $V = '0.32'; |
| 14 | 14 | ||
| 15 | use Getopt::Long qw(:config no_auto_abbrev); | 15 | use Getopt::Long qw(:config no_auto_abbrev); |
| 16 | 16 | ||
| @@ -26,9 +26,13 @@ my $check = 0; | |||
| 26 | my $summary = 1; | 26 | my $summary = 1; |
| 27 | my $mailback = 0; | 27 | my $mailback = 0; |
| 28 | my $summary_file = 0; | 28 | my $summary_file = 0; |
| 29 | my $show_types = 0; | ||
| 29 | my $root; | 30 | my $root; |
| 30 | my %debug; | 31 | my %debug; |
| 32 | my %ignore_type = (); | ||
| 33 | my @ignore = (); | ||
| 31 | my $help = 0; | 34 | my $help = 0; |
| 35 | my $configuration_file = ".checkpatch.conf"; | ||
| 32 | 36 | ||
| 33 | sub help { | 37 | sub help { |
| 34 | my ($exitcode) = @_; | 38 | my ($exitcode) = @_; |
| @@ -46,6 +50,8 @@ Options: | |||
| 46 | --terse one line per report | 50 | --terse one line per report |
| 47 | -f, --file treat FILE as regular source file | 51 | -f, --file treat FILE as regular source file |
| 48 | --subjective, --strict enable more subjective tests | 52 | --subjective, --strict enable more subjective tests |
| 53 | --ignore TYPE(,TYPE2...) ignore various comma separated message types | ||
| 54 | --show-types show the message "types" in the output | ||
| 49 | --root=PATH PATH to the kernel tree root | 55 | --root=PATH PATH to the kernel tree root |
| 50 | --no-summary suppress the per-file summary | 56 | --no-summary suppress the per-file summary |
| 51 | --mailback only produce a report in case of warnings/errors | 57 | --mailback only produce a report in case of warnings/errors |
| @@ -63,6 +69,32 @@ EOM | |||
| 63 | exit($exitcode); | 69 | exit($exitcode); |
| 64 | } | 70 | } |
| 65 | 71 | ||
| 72 | my $conf = which_conf($configuration_file); | ||
| 73 | if (-f $conf) { | ||
| 74 | my @conf_args; | ||
| 75 | open(my $conffile, '<', "$conf") | ||
| 76 | or warn "$P: Can't find a readable $configuration_file file $!\n"; | ||
| 77 | |||
| 78 | while (<$conffile>) { | ||
| 79 | my $line = $_; | ||
| 80 | |||
| 81 | $line =~ s/\s*\n?$//g; | ||
| 82 | $line =~ s/^\s*//g; | ||
| 83 | $line =~ s/\s+/ /g; | ||
| 84 | |||
| 85 | next if ($line =~ m/^\s*#/); | ||
| 86 | next if ($line =~ m/^\s*$/); | ||
| 87 | |||
| 88 | my @words = split(" ", $line); | ||
| 89 | foreach my $word (@words) { | ||
| 90 | last if ($word =~ m/^#/); | ||
| 91 | push (@conf_args, $word); | ||
| 92 | } | ||
| 93 | } | ||
| 94 | close($conffile); | ||
| 95 | unshift(@ARGV, @conf_args) if @conf_args; | ||
| 96 | } | ||
| 97 | |||
| 66 | GetOptions( | 98 | GetOptions( |
| 67 | 'q|quiet+' => \$quiet, | 99 | 'q|quiet+' => \$quiet, |
| 68 | 'tree!' => \$tree, | 100 | 'tree!' => \$tree, |
| @@ -73,6 +105,8 @@ GetOptions( | |||
| 73 | 'f|file!' => \$file, | 105 | 'f|file!' => \$file, |
| 74 | 'subjective!' => \$check, | 106 | 'subjective!' => \$check, |
| 75 | 'strict!' => \$check, | 107 | 'strict!' => \$check, |
| 108 | 'ignore=s' => \@ignore, | ||
| 109 | 'show-types!' => \$show_types, | ||
| 76 | 'root=s' => \$root, | 110 | 'root=s' => \$root, |
| 77 | 'summary!' => \$summary, | 111 | 'summary!' => \$summary, |
| 78 | 'mailback!' => \$mailback, | 112 | 'mailback!' => \$mailback, |
| @@ -93,6 +127,19 @@ if ($#ARGV < 0) { | |||
| 93 | exit(1); | 127 | exit(1); |
| 94 | } | 128 | } |
| 95 | 129 | ||
| 130 | @ignore = split(/,/, join(',',@ignore)); | ||
| 131 | foreach my $word (@ignore) { | ||
| 132 | $word =~ s/\s*\n?$//g; | ||
| 133 | $word =~ s/^\s*//g; | ||
| 134 | $word =~ s/\s+/ /g; | ||
| 135 | $word =~ tr/[a-z]/[A-Z]/; | ||
| 136 | |||
| 137 | next if ($word =~ m/^\s*#/); | ||
| 138 | next if ($word =~ m/^\s*$/); | ||
| 139 | |||
| 140 | $ignore_type{$word}++; | ||
| 141 | } | ||
| 142 | |||
| 96 | my $dbg_values = 0; | 143 | my $dbg_values = 0; |
| 97 | my $dbg_possible = 0; | 144 | my $dbg_possible = 0; |
| 98 | my $dbg_type = 0; | 145 | my $dbg_type = 0; |
| @@ -145,7 +192,8 @@ our $Sparse = qr{ | |||
| 145 | __must_check| | 192 | __must_check| |
| 146 | __init_refok| | 193 | __init_refok| |
| 147 | __kprobes| | 194 | __kprobes| |
| 148 | __ref | 195 | __ref| |
| 196 | __rcu | ||
| 149 | }x; | 197 | }x; |
| 150 | 198 | ||
| 151 | # Notes to $Attribute: | 199 | # Notes to $Attribute: |
| @@ -209,13 +257,23 @@ our $typeTypedefs = qr{(?x: | |||
| 209 | )}; | 257 | )}; |
| 210 | 258 | ||
| 211 | our $logFunctions = qr{(?x: | 259 | our $logFunctions = qr{(?x: |
| 212 | printk| | 260 | printk(?:_ratelimited|_once|)| |
| 213 | [a-z]+_(emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)| | 261 | [a-z0-9]+_(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)| |
| 214 | WARN| | 262 | WARN(?:_RATELIMIT|_ONCE|)| |
| 215 | panic| | 263 | panic| |
| 216 | MODULE_[A-Z_]+ | 264 | MODULE_[A-Z_]+ |
| 217 | )}; | 265 | )}; |
| 218 | 266 | ||
| 267 | our $signature_tags = qr{(?xi: | ||
| 268 | Signed-off-by:| | ||
| 269 | Acked-by:| | ||
| 270 | Tested-by:| | ||
| 271 | Reviewed-by:| | ||
| 272 | Reported-by:| | ||
| 273 | To:| | ||
| 274 | Cc: | ||
| 275 | )}; | ||
| 276 | |||
| 219 | our @typeList = ( | 277 | our @typeList = ( |
| 220 | qr{void}, | 278 | qr{void}, |
| 221 | qr{(?:unsigned\s+)?char}, | 279 | qr{(?:unsigned\s+)?char}, |
| @@ -268,6 +326,20 @@ sub build_types { | |||
| 268 | } | 326 | } |
| 269 | build_types(); | 327 | build_types(); |
| 270 | 328 | ||
| 329 | our $match_balanced_parentheses = qr/(\((?:[^\(\)]+|(-1))*\))/; | ||
| 330 | |||
| 331 | our $Typecast = qr{\s*(\(\s*$NonptrType\s*\)){0,1}\s*}; | ||
| 332 | our $LvalOrFunc = qr{($Lval)\s*($match_balanced_parentheses{0,1})\s*}; | ||
| 333 | |||
| 334 | sub deparenthesize { | ||
| 335 | my ($string) = @_; | ||
| 336 | return "" if (!defined($string)); | ||
| 337 | $string =~ s@^\s*\(\s*@@g; | ||
| 338 | $string =~ s@\s*\)\s*$@@g; | ||
| 339 | $string =~ s@\s+@ @g; | ||
| 340 | return $string; | ||
| 341 | } | ||
| 342 | |||
| 271 | $chk_signoff = 0 if ($file); | 343 | $chk_signoff = 0 if ($file); |
| 272 | 344 | ||
| 273 | my @dep_includes = (); | 345 | my @dep_includes = (); |
| @@ -339,6 +411,88 @@ sub top_of_kernel_tree { | |||
| 339 | } | 411 | } |
| 340 | } | 412 | } |
| 341 | return 1; | 413 | return 1; |
| 414 | } | ||
| 415 | |||
| 416 | sub parse_email { | ||
| 417 | my ($formatted_email) = @_; | ||
| 418 | |||
| 419 | my $name = ""; | ||
| 420 | my $address = ""; | ||
| 421 | my $comment = ""; | ||
| 422 | |||
| 423 | if ($formatted_email =~ /^(.*)<(\S+\@\S+)>(.*)$/) { | ||
| 424 | $name = $1; | ||
| 425 | $address = $2; | ||
| 426 | $comment = $3 if defined $3; | ||
| 427 | } elsif ($formatted_email =~ /^\s*<(\S+\@\S+)>(.*)$/) { | ||
| 428 | $address = $1; | ||
| 429 | $comment = $2 if defined $2; | ||
