aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-23 22:11:50 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-23 22:11:50 -0500
commit3aacd625f20129f5a41ea3ff3b5353b0e4dabd01 (patch)
tree7cf4ea65397f80098b30494df31cfc8f5fa26d63 /scripts
parent7e21774db5cc9cf8fe93a64a2f0c6cf47db8ab24 (diff)
parent2a1d689c9ba42a6066540fb221b6ecbd6298b728 (diff)
Merge branch 'akpm' (incoming from Andrew)
Merge second patch-bomb from Andrew Morton: - various misc bits - the rest of MM - add generic fixmap.h, use it - backlight updates - dynamic_debug updates - printk() updates - checkpatch updates - binfmt_elf - ramfs - init/ - autofs4 - drivers/rtc - nilfs - hfsplus - Documentation/ - coredump - procfs - fork - exec - kexec - kdump - partitions - rapidio - rbtree - userns - memstick - w1 - decompressors * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (197 commits) lib/decompress_unlz4.c: always set an error return code on failures romfs: fix returm err while getting inode in fill_super drivers/w1/masters/w1-gpio.c: add strong pullup emulation drivers/memstick/host/rtsx_pci_ms.c: fix ms card data transfer bug userns: relax the posix_acl_valid() checks arch/sh/kernel/dwarf.c: use rbtree postorder iteration helper instead of solution using repeated rb_erase() fs-ext3-use-rbtree-postorder-iteration-helper-instead-of-opencoding-fix fs/ext3: use rbtree postorder iteration helper instead of opencoding fs/jffs2: use rbtree postorder iteration helper instead of opencoding fs/ext4: use rbtree postorder iteration helper instead of opencoding fs/ubifs: use rbtree postorder iteration helper instead of opencoding net/netfilter/ipset/ip_set_hash_netiface.c: use rbtree postorder iteration instead of opencoding rbtree/test: test rbtree_postorder_for_each_entry_safe() rbtree/test: move rb_node to the middle of the test struct rapidio: add modular rapidio core build into powerpc and mips branches partitions/efi: complete documentation of gpt kernel param purpose kdump: add /sys/kernel/vmcoreinfo ABI documentation kdump: fix exported size of vmcoreinfo note kexec: add sysctl to disable kexec_load fs/exec.c: call arch_pick_mmap_layout() only once ...
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl180
-rwxr-xr-xscripts/get_maintainer.pl91
-rw-r--r--scripts/headers_check.pl6
-rw-r--r--scripts/sortextable.c5
4 files changed, 258 insertions, 24 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 9fb30b15c9dc..1dbd6d1cd1b5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -29,6 +29,7 @@ my $mailback = 0;
29my $summary_file = 0; 29my $summary_file = 0;
30my $show_types = 0; 30my $show_types = 0;
31my $fix = 0; 31my $fix = 0;
32my $fix_inplace = 0;
32my $root; 33my $root;
33my %debug; 34my %debug;
34my %camelcase = (); 35my %camelcase = ();
@@ -76,6 +77,9 @@ Options:
76 "<inputfile>.EXPERIMENTAL-checkpatch-fixes" 77 "<inputfile>.EXPERIMENTAL-checkpatch-fixes"
77 with potential errors corrected to the preferred 78 with potential errors corrected to the preferred
78 checkpatch style 79 checkpatch style
80 --fix-inplace EXPERIMENTAL - may create horrible results
81 Is the same as --fix, but overwrites the input
82 file. It's your fault if there's no backup or git
79 --ignore-perl-version override checking of perl version. expect 83 --ignore-perl-version override checking of perl version. expect
80 runtime errors. 84 runtime errors.
81 -h, --help, --version display this help and exit 85 -h, --help, --version display this help and exit
@@ -131,6 +135,7 @@ GetOptions(
131 'mailback!' => \$mailback, 135 'mailback!' => \$mailback,
132 'summary-file!' => \$summary_file, 136 'summary-file!' => \$summary_file,
133 'fix!' => \$fix, 137 'fix!' => \$fix,
138 'fix-inplace!' => \$fix_inplace,
134 'ignore-perl-version!' => \$ignore_perl_version, 139 'ignore-perl-version!' => \$ignore_perl_version,
135 'debug=s' => \%debug, 140 'debug=s' => \%debug,
136 'test-only=s' => \$tst_only, 141 'test-only=s' => \$tst_only,
@@ -140,6 +145,8 @@ GetOptions(
140 145
141help(0) if ($help); 146help(0) if ($help);
142 147
148$fix = 1 if ($fix_inplace);
149
143my $exit = 0; 150my $exit = 0;
144 151
145if ($^V && $^V lt $minimum_perl_version) { 152if ($^V && $^V lt $minimum_perl_version) {
@@ -1963,15 +1970,14 @@ sub process {
1963 } 1970 }
1964 1971
1965# Check for FSF mailing addresses. 1972# Check for FSF mailing addresses.
1966 if ($rawline =~ /You should have received a copy/ || 1973 if ($rawline =~ /\bwrite to the Free/i ||
1967 $rawline =~ /write to the Free Software/ || 1974 $rawline =~ /\b59\s+Temple\s+Pl/i ||
1968 $rawline =~ /59 Temple Place/ || 1975 $rawline =~ /\b51\s+Franklin\s+St/i) {
1969 $rawline =~ /51 Franklin Street/) {
1970 my $herevet = "$here\n" . cat_vet($rawline) . "\n"; 1976 my $herevet = "$here\n" . cat_vet($rawline) . "\n";
1971 my $msg_type = \&ERROR; 1977 my $msg_type = \&ERROR;
1972 $msg_type = \&CHK if ($file); 1978 $msg_type = \&CHK if ($file);
1973 &{$msg_type}("FSF_MAILING_ADDRESS", 1979 &{$msg_type}("FSF_MAILING_ADDRESS",
1974 "Do not include the paragraph about writing to the Free Software Foundation's mailing address from the sample GPL notice. The FSF has changed addresses in the past, and may do so again. Linux already includes a copy of the GPL.\n" . $herevet) 1980 "Do not include the paragraph about writing to the Free Software Foundation's mailing address from the sample GPL notice. The FSF has changed addresses in the past, and may do so again. Linux already includes a copy of the GPL.\n" . $herevet)
1975 } 1981 }
1976 1982
1977# check for Kconfig help text having a real description 1983# check for Kconfig help text having a real description
@@ -2034,6 +2040,33 @@ sub process {
2034 "Use of $flag is deprecated, please use \`$replacement->{$flag} instead.\n" . $herecurr) if ($replacement->{$flag}); 2040 "Use of $flag is deprecated, please use \`$replacement->{$flag} instead.\n" . $herecurr) if ($replacement->{$flag});
2035 } 2041 }
2036 2042
2043# check for DT compatible documentation
2044 if (defined $root && $realfile =~ /\.dts/ &&
2045 $rawline =~ /^\+\s*compatible\s*=/) {
2046 my @compats = $rawline =~ /\"([a-zA-Z0-9\-\,\.\+_]+)\"/g;
2047
2048 foreach my $compat (@compats) {
2049 my $compat2 = $compat;
2050 my $dt_path = $root . "/Documentation/devicetree/bindings/";
2051 $compat2 =~ s/\,[a-z]*\-/\,<\.\*>\-/;
2052 `grep -Erq "$compat|$compat2" $dt_path`;
2053 if ( $? >> 8 ) {
2054 WARN("UNDOCUMENTED_DT_STRING",
2055 "DT compatible string \"$compat\" appears un-documented -- check $dt_path\n" . $herecurr);
2056 }
2057
2058 my $vendor = $compat;
2059 my $vendor_path = $dt_path . "vendor-prefixes.txt";
2060 next if (! -f $vendor_path);
2061 $vendor =~ s/^([a-zA-Z0-9]+)\,.*/$1/;
2062 `grep -Eq "$vendor" $vendor_path`;
2063 if ( $? >> 8 ) {
2064 WARN("UNDOCUMENTED_DT_STRING",
2065 "DT compatible string vendor \"$vendor\" appears un-documented -- check $vendor_path\n" . $herecurr);
2066 }
2067 }
2068 }
2069
2037# check we are in a valid source file if not then ignore this hunk 2070# check we are in a valid source file if not then ignore this hunk
2038 next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/); 2071 next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/);
2039 2072
@@ -2049,16 +2082,12 @@ sub process {
2049 } 2082 }
2050 2083
2051# Check for user-visible strings broken across lines, which breaks the ability 2084# Check for user-visible strings broken across lines, which breaks the ability
2052# to grep for the string. Limited to strings used as parameters (those 2085# to grep for the string. Make exceptions when the previous string ends in a
2053# following an open parenthesis), which almost completely eliminates false 2086# newline (multiple lines in one string constant) or '\t', '\r', ';', or '{'
2054# positives, as well as warning only once per parameter rather than once per 2087# (common in inline assembly) or is a octal \123 or hexadecimal \xaf value
2055# line of the string. Make an exception when the previous string ends in a
2056# newline (multiple lines in one string constant) or \n\t (common in inline
2057# assembly to indent the instruction on the following line).
2058 if ($line =~ /^\+\s*"/ && 2088 if ($line =~ /^\+\s*"/ &&
2059 $prevline =~ /"\s*$/ && 2089 $prevline =~ /"\s*$/ &&
2060 $prevline =~ /\(/ && 2090 $prevrawline !~ /(?:\\(?:[ntr]|[0-7]{1,3}|x[0-9a-fA-F]{1,2})|;\s*|\{\s*)"\s*$/) {
2061 $prevrawline !~ /\\n(?:\\t)*"\s*$/) {
2062 WARN("SPLIT_STRING", 2091 WARN("SPLIT_STRING",
2063 "quoted string split across lines\n" . $hereprev); 2092 "quoted string split across lines\n" . $hereprev);
2064 } 2093 }
@@ -2115,8 +2144,10 @@ sub process {
2115 if (WARN("SPACE_BEFORE_TAB", 2144 if (WARN("SPACE_BEFORE_TAB",
2116 "please, no space before tabs\n" . $herevet) && 2145 "please, no space before tabs\n" . $herevet) &&
2117 $fix) { 2146 $fix) {
2118 $fixed[$linenr - 1] =~ 2147 while ($fixed[$linenr - 1] =~
2119 s/(^\+.*) +\t/$1\t/; 2148 s/(^\+.*) {8,8}+\t/$1\t\t/) {}
2149 while ($fixed[$linenr - 1] =~
2150 s/(^\+.*) +\t/$1\t/) {}
2120 } 2151 }
2121 } 2152 }
2122 2153
@@ -2805,6 +2836,65 @@ sub process {
2805 } 2836 }
2806 } 2837 }
2807 2838
2839# Function pointer declarations
2840# check spacing between type, funcptr, and args
2841# canonical declaration is "type (*funcptr)(args...)"
2842#
2843# the $Declare variable will capture all spaces after the type
2844# so check it for trailing missing spaces or multiple spaces
2845 if ($line =~ /^.\s*($Declare)\((\s*)\*(\s*)$Ident(\s*)\)(\s*)\(/) {
2846 my $declare = $1;
2847 my $pre_pointer_space = $2;
2848 my $post_pointer_space = $3;
2849 my $funcname = $4;
2850 my $post_funcname_space = $5;
2851 my $pre_args_space = $6;
2852
2853 if ($declare !~ /\s$/) {
2854 WARN("SPACING",
2855 "missing space after return type\n" . $herecurr);
2856 }
2857
2858# unnecessary space "type (*funcptr)(args...)"
2859 elsif ($declare =~ /\s{2,}$/) {
2860 WARN("SPACING",
2861 "Multiple spaces after return type\n" . $herecurr);
2862 }
2863
2864# unnecessary space "type ( *funcptr)(args...)"
2865 if (defined $pre_pointer_space &&
2866 $pre_pointer_space =~ /^\s/) {
2867 WARN("SPACING",
2868 "Unnecessary space after function pointer open parenthesis\n" . $herecurr);
2869 }
2870
2871# unnecessary space "type (* funcptr)(args...)"
2872 if (defined $post_pointer_space &&
2873 $post_pointer_space =~ /^\s/) {
2874 WARN("SPACING",
2875 "Unnecessary space before function pointer name\n" . $herecurr);
2876 }
2877
2878# unnecessary space "type (*funcptr )(args...)"
2879 if (defined $post_funcname_space &&
2880 $post_funcname_space =~ /^\s/) {
2881 WARN("SPACING",
2882 "Unnecessary space after function pointer name\n" . $herecurr);
2883 }
2884
2885# unnecessary space "type (*funcptr) (args...)"
2886 if (defined $pre_args_space &&
2887 $pre_args_space =~ /^\s/) {
2888 WARN("SPACING",
2889 "Unnecessary space before function pointer arguments\n" . $herecurr);
2890 }
2891
2892 if (show_type("SPACING") && $fix) {
2893 $fixed[$linenr - 1] =~
2894 s/^(.\s*$Declare)\(\s*\*\s*($Ident)\s*\)\s*\(/rtrim($1) . " " . "\(\*$2\)\("/ex;
2895 }
2896 }
2897
2808# check for spacing round square brackets; allowed: 2898# check for spacing round square brackets; allowed:
2809# 1. with a type on the left -- int [] a; 2899# 1. with a type on the left -- int [] a;
2810# 2. at the beginning of a line for slice initialisers -- [0...10] = 5, 2900# 2. at the beginning of a line for slice initialisers -- [0...10] = 5,
@@ -3125,7 +3215,7 @@ sub process {
3125 } 3215 }
3126 3216
3127# check for whitespace before a non-naked semicolon 3217# check for whitespace before a non-naked semicolon
3128 if ($line =~ /^\+.*\S\s+;/) { 3218 if ($line =~ /^\+.*\S\s+;\s*$/) {
3129 if (WARN("SPACING", 3219 if (WARN("SPACING",
3130 "space prohibited before semicolon\n" . $herecurr) && 3220 "space prohibited before semicolon\n" . $herecurr) &&
3131 $fix) { 3221 $fix) {
@@ -3249,6 +3339,20 @@ sub process {
3249 } 3339 }
3250 } 3340 }
3251 3341
3342# if statements using unnecessary parentheses - ie: if ((foo == bar))
3343 if ($^V && $^V ge 5.10.0 &&
3344 $line =~ /\bif\s*((?:\(\s*){2,})/) {
3345 my $openparens = $1;
3346 my $count = $openparens =~ tr@\(@\(@;
3347 my $msg = "";
3348 if ($line =~ /\bif\s*(?:\(\s*){$count,$count}$LvalOrFunc\s*($Compare)\s*$LvalOrFunc(?:\s*\)){$count,$count}/) {
3349 my $comp = $4; #Not $1 because of $LvalOrFunc
3350 $msg = " - maybe == should be = ?" if ($comp eq "==");
3351 WARN("UNNECESSARY_PARENTHESES",
3352 "Unnecessary parentheses$msg\n" . $herecurr);
3353 }
3354 }
3355
3252# Return of what appears to be an errno should normally be -'ve 3356# Return of what appears to be an errno should normally be -'ve
3253 if ($line =~ /^.\s*return\s*(E[A-Z]*)\s*;/) { 3357 if ($line =~ /^.\s*return\s*(E[A-Z]*)\s*;/) {
3254 my $name = $1; 3358 my $name = $1;
@@ -3983,6 +4087,16 @@ sub process {
3983 } 4087 }
3984 } 4088 }
3985 4089
4090# Check for memcpy(foo, bar, ETH_ALEN) that could be ether_addr_copy(foo, bar)
4091 if ($^V && $^V ge 5.10.0 &&
4092 $line =~ /^\+(?:.*?)\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/s) {
4093 if (WARN("PREFER_ETHER_ADDR_COPY",
4094 "Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)\n" . $herecurr) &&
4095 $fix) {
4096 $fixed[$linenr - 1] =~ s/\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/ether_addr_copy($2, $7)/;
4097 }
4098 }
4099
3986# typecasts on min/max could be min_t/max_t 4100# typecasts on min/max could be min_t/max_t
3987 if ($^V && $^V ge 5.10.0 && 4101 if ($^V && $^V ge 5.10.0 &&
3988 defined $stat && 4102 defined $stat &&
@@ -4117,6 +4231,12 @@ sub process {
4117 "$1 uses number as first arg, sizeof is generally wrong\n" . $herecurr); 4231 "$1 uses number as first arg, sizeof is generally wrong\n" . $herecurr);
4118 } 4232 }
4119 4233
4234# check for GFP_NOWAIT use
4235 if ($line =~ /\b__GFP_NOFAIL\b/) {
4236 WARN("__GFP_NOFAIL",
4237 "Use of __GFP_NOFAIL is deprecated, no new users should be added\n" . $herecurr);
4238 }
4239
4120# check for multiple semicolons 4240# check for multiple semicolons
4121 if ($line =~ /;\s*;\s*$/) { 4241 if ($line =~ /;\s*;\s*$/) {
4122 if (WARN("ONE_SEMICOLON", 4242 if (WARN("ONE_SEMICOLON",
@@ -4126,6 +4246,31 @@ sub process {
4126 } 4246 }
4127 } 4247 }
4128 4248
4249# check for case / default statements not preceeded by break/fallthrough/switch
4250 if ($line =~ /^.\s*(?:case\s+(?:$Ident|$Constant)\s*|default):/) {
4251 my $has_break = 0;
4252 my $has_statement = 0;
4253 my $count = 0;
4254 my $prevline = $linenr;
4255 while ($prevline > 1 && $count < 3 && !$has_break) {
4256 $prevline--;
4257 my $rline = $rawlines[$prevline - 1];
4258 my $fline = $lines[$prevline - 1];
4259 last if ($fline =~ /^\@\@/);
4260 next if ($fline =~ /^\-/);
4261 next if ($fline =~ /^.(?:\s*(?:case\s+(?:$Ident|$Constant)[\s$;]*|default):[\s$;]*)*$/);
4262 $has_break = 1 if ($rline =~ /fall[\s_-]*(through|thru)/i);
4263 next if ($fline =~ /^.[\s$;]*$/);
4264 $has_statement = 1;
4265 $count++;
4266 $has_break = 1 if ($fline =~ /\bswitch\b|\b(?:break\s*;[\s$;]*$|return\b|goto\b|continue\b)/);
4267 }
4268 if (!$has_break && $has_statement) {
4269 WARN("MISSING_BREAK",
4270 "Possible switch case/default not preceeded by break or fallthrough comment\n" . $herecurr);
4271 }
4272 }
4273
4129# check for switch/default statements without a break; 4274# check for switch/default statements without a break;
4130 if ($^V && $^V ge 5.10.0 && 4275 if ($^V && $^V ge 5.10.0 &&
4131 defined $stat && 4276 defined $stat &&
@@ -4361,7 +4506,8 @@ sub process {
4361 hash_show_words(\%ignore_type, "Ignored"); 4506 hash_show_words(\%ignore_type, "Ignored");
4362 4507
4363 if ($clean == 0 && $fix && "@rawlines" ne "@fixed") { 4508 if ($clean == 0 && $fix && "@rawlines" ne "@fixed") {
4364 my $newfile = $filename . ".EXPERIMENTAL-checkpatch-fixes"; 4509 my $newfile = $filename;
4510 $newfile .= ".EXPERIMENTAL-checkpatch-fixes" if (!$fix_inplace);
4365 my $linecount = 0; 4511 my $linecount = 0;
4366 my $f; 4512 my $f;
4367 4513
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 5e4fb144a04f..9c3986f4140c 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -98,6 +98,7 @@ my %VCS_cmds_git = (
98 "available" => '(which("git") ne "") && (-d ".git")', 98 "available" => '(which("git") ne "") && (-d ".git")',
99 "find_signers_cmd" => 99 "find_signers_cmd" =>
100 "git log --no-color --follow --since=\$email_git_since " . 100 "git log --no-color --follow --since=\$email_git_since " .
101 '--numstat --no-merges ' .
101 '--format="GitCommit: %H%n' . 102 '--format="GitCommit: %H%n' .
102 'GitAuthor: %an <%ae>%n' . 103 'GitAuthor: %an <%ae>%n' .
103 'GitDate: %aD%n' . 104 'GitDate: %aD%n' .
@@ -106,6 +107,7 @@ my %VCS_cmds_git = (
106 " -- \$file", 107 " -- \$file",
107 "find_commit_signers_cmd" => 108 "find_commit_signers_cmd" =>
108 "git log --no-color " . 109 "git log --no-color " .
110 '--numstat ' .
109 '--format="GitCommit: %H%n' . 111 '--format="GitCommit: %H%n' .
110 'GitAuthor: %an <%ae>%n' . 112 'GitAuthor: %an <%ae>%n' .
111 'GitDate: %aD%n' . 113 'GitDate: %aD%n' .
@@ -114,6 +116,7 @@ my %VCS_cmds_git = (
114 " -1 \$commit", 116 " -1 \$commit",
115 "find_commit_author_cmd" => 117 "find_commit_author_cmd" =>
116 "git log --no-color " . 118 "git log --no-color " .
119 '--numstat ' .
117 '--format="GitCommit: %H%n' . 120 '--format="GitCommit: %H%n' .
118 'GitAuthor: %an <%ae>%n' . 121 'GitAuthor: %an <%ae>%n' .
119 'GitDate: %aD%n' . 122 'GitDate: %aD%n' .
@@ -125,6 +128,7 @@ my %VCS_cmds_git = (
125 "blame_commit_pattern" => "^([0-9a-f]+) ", 128 "blame_commit_pattern" => "^([0-9a-f]+) ",
126 "author_pattern" => "^GitAuthor: (.*)", 129 "author_pattern" => "^GitAuthor: (.*)",
127 "subject_pattern" => "^GitSubject: (.*)", 130 "subject_pattern" => "^GitSubject: (.*)",
131 "stat_pattern" => "^(\\d+)\\t(\\d+)\\t\$file\$",
128); 132);
129 133
130my %VCS_cmds_hg = ( 134my %VCS_cmds_hg = (
@@ -152,6 +156,7 @@ my %VCS_cmds_hg = (
152 "blame_commit_pattern" => "^([ 0-9a-f]+):", 156 "blame_commit_pattern" => "^([ 0-9a-f]+):",
153 "author_pattern" => "^HgAuthor: (.*)", 157 "author_pattern" => "^HgAuthor: (.*)",
154 "subject_pattern" => "^HgSubject: (.*)", 158 "subject_pattern" => "^HgSubject: (.*)",
159 "stat_pattern" => "^(\\d+)\t(\\d+)\t\$file\$",
155); 160);
156 161
157my $conf = which_conf(".get_maintainer.conf"); 162my $conf = which_conf(".get_maintainer.conf");
@@ -1269,20 +1274,30 @@ sub extract_formatted_signatures {
1269} 1274}
1270 1275
1271sub vcs_find_signers { 1276sub vcs_find_signers {
1272 my ($cmd) = @_; 1277 my ($cmd, $file) = @_;
1273 my $commits; 1278 my $commits;
1274 my @lines = (); 1279 my @lines = ();
1275 my @signatures = (); 1280 my @signatures = ();
1281 my @authors = ();
1282 my @stats = ();
1276 1283
1277 @lines = &{$VCS_cmds{"execute_cmd"}}($cmd); 1284 @lines = &{$VCS_cmds{"execute_cmd"}}($cmd);
1278 1285
1279 my $pattern = $VCS_cmds{"commit_pattern"}; 1286 my $pattern = $VCS_cmds{"commit_pattern"};
1287 my $author_pattern = $VCS_cmds{"author_pattern"};
1288 my $stat_pattern = $VCS_cmds{"stat_pattern"};
1289
1290 $stat_pattern =~ s/(\$\w+)/$1/eeg; #interpolate $stat_pattern
1280 1291
1281 $commits = grep(/$pattern/, @lines); # of commits 1292 $commits = grep(/$pattern/, @lines); # of commits
1282 1293
1294 @authors = grep(/$author_pattern/, @lines);
1283 @signatures = grep(/^[ \t]*${signature_pattern}.*\@.*$/, @lines); 1295 @signatures = grep(/^[ \t]*${signature_pattern}.*\@.*$/, @lines);
1296 @stats = grep(/$stat_pattern/, @lines);
1284 1297
1285 return (0, @signatures) if !@signatures; 1298# print("stats: <@stats>\n");
1299
1300 return (0, \@signatures, \@authors, \@stats) if !@signatures;
1286 1301
1287 save_commits_by_author(@lines) if ($interactive); 1302 save_commits_by_author(@lines) if ($interactive);
1288 save_commits_by_signer(@lines) if ($interactive); 1303 save_commits_by_signer(@lines) if ($interactive);
@@ -1291,9 +1306,10 @@ sub vcs_find_signers {
1291 @signatures = grep(!/${penguin_chiefs}/i, @signatures); 1306 @signatures = grep(!/${penguin_chiefs}/i, @signatures);
1292 } 1307 }
1293 1308
1309 my ($author_ref, $authors_ref) = extract_formatted_signatures(@authors);
1294 my ($types_ref, $signers_ref) = extract_formatted_signatures(@signatures); 1310 my ($types_ref, $signers_ref) = extract_formatted_signatures(@signatures);
1295 1311
1296 return ($commits, @$signers_ref); 1312 return ($commits, $signers_ref, $authors_ref, \@stats);
1297} 1313}
1298 1314
1299sub vcs_find_author { 1315sub vcs_find_author {
@@ -1849,7 +1865,12 @@ sub vcs_assign {
1849sub vcs_file_signoffs { 1865sub vcs_file_signoffs {
1850 my ($file) = @_; 1866 my ($file) = @_;
1851 1867
1868 my $authors_ref;
1869 my $signers_ref;
1870 my $stats_ref;
1871 my @authors = ();
1852 my @signers = (); 1872 my @signers = ();
1873 my @stats = ();
1853 my $commits; 1874 my $commits;
1854 1875
1855 $vcs_used = vcs_exists(); 1876 $vcs_used = vcs_exists();
@@ -1858,13 +1879,59 @@ sub vcs_file_signoffs {
1858 my $cmd = $VCS_cmds{"find_signers_cmd"}; 1879 my $cmd = $VCS_cmds{"find_signers_cmd"};
1859 $cmd =~ s/(\$\w+)/$1/eeg; # interpolate $cmd 1880 $cmd =~ s/(\$\w+)/$1/eeg; # interpolate $cmd
1860 1881
1861 ($commits, @signers) = vcs_find_signers($cmd); 1882 ($commits, $signers_ref, $authors_ref, $stats_ref) = vcs_find_signers($cmd, $file);
1883
1884 @signers = @{$signers_ref} if defined $signers_ref;
1885 @authors = @{$authors_ref} if defined $authors_ref;
1886 @stats = @{$stats_ref} if defined $stats_ref;
1887
1888# print("commits: <$commits>\nsigners:<@signers>\nauthors: <@authors>\nstats: <@stats>\n");
1862 1889
1863 foreach my $signer (@signers) { 1890 foreach my $signer (@signers) {
1864 $signer = deduplicate_email($signer); 1891 $signer = deduplicate_email($signer);
1865 } 1892 }
1866 1893
1867 vcs_assign("commit_signer", $commits, @signers); 1894 vcs_assign("commit_signer", $commits, @signers);
1895 vcs_assign("authored", $commits, @authors);
1896 if ($#authors == $#stats) {
1897 my $stat_pattern = $VCS_cmds{"stat_pattern"};
1898 $stat_pattern =~ s/(\$\w+)/$1/eeg; #interpolate $stat_pattern
1899
1900 my $added = 0;
1901 my $deleted = 0;
1902 for (my $i = 0; $i <= $#stats; $i++) {
1903 if ($stats[$i] =~ /$stat_pattern/) {
1904 $added += $1;
1905 $deleted += $2;
1906 }
1907 }
1908 my @tmp_authors = uniq(@authors);
1909 foreach my $author (@tmp_authors) {
1910 $author = deduplicate_email($author);
1911 }
1912 @tmp_authors = uniq(@tmp_authors);
1913 my @list_added = ();
1914 my @list_deleted = ();
1915 foreach my $author (@tmp_authors) {
1916 my $auth_added = 0;
1917 my $auth_deleted = 0;
1918 for (my $i = 0; $i <= $#stats; $i++) {
1919 if ($author eq deduplicate_email($authors[$i]) &&
1920 $stats[$i] =~ /$stat_pattern/) {
1921 $auth_added += $1;
1922 $auth_deleted += $2;
1923 }
1924 }
1925 for (my $i = 0; $i < $auth_added; $i++) {
1926 push(@list_added, $author);
1927 }
1928 for (my $i = 0; $i < $auth_deleted; $i++) {
1929 push(@list_deleted, $author);
1930 }
1931 }
1932 vcs_assign("added_lines", $added, @list_added);
1933 vcs_assign("removed_lines", $deleted, @list_deleted);
1934 }
1868} 1935}
1869 1936
1870sub vcs_file_blame { 1937sub vcs_file_blame {
@@ -1887,6 +1954,10 @@ sub vcs_file_blame {
1887 if ($email_git_blame_signatures) { 1954 if ($email_git_blame_signatures) {
1888 if (vcs_is_hg()) { 1955 if (vcs_is_hg()) {
1889 my $commit_count; 1956 my $commit_count;
1957 my $commit_authors_ref;
1958 my $commit_signers_ref;
1959 my $stats_ref;
1960 my @commit_authors = ();
1890 my @commit_signers = (); 1961 my @commit_signers = ();
1891 my $commit = join(" -r ", @commits); 1962 my $commit = join(" -r ", @commits);
1892 my $cmd; 1963 my $cmd;
@@ -1894,19 +1965,27 @@ sub vcs_file_blame {
1894 $cmd = $VCS_cmds{"find_commit_signers_cmd"}; 1965 $cmd = $VCS_cmds{"find_commit_signers_cmd"};
1895 $cmd =~ s/(\$\w+)/$1/eeg; #substitute variables in $cmd 1966 $cmd =~ s/(\$\w+)/$1/eeg; #substitute variables in $cmd
1896 1967
1897 ($commit_count, @commit_signers) = vcs_find_signers($cmd); 1968 ($commit_count, $commit_signers_ref, $commit_authors_ref, $stats_ref) = vcs_find_signers($cmd, $file);
1969 @commit_authors = @{$commit_authors_ref} if defined $commit_authors_ref;
1970 @commit_signers = @{$commit_signers_ref} if defined $commit_signers_ref;
1898 1971
1899 push(@signers, @commit_signers); 1972 push(@signers, @commit_signers);
1900 } else { 1973 } else {
1901 foreach my $commit (@commits) { 1974 foreach my $commit (@commits) {
1902 my $commit_count; 1975 my $commit_count;
1976 my $commit_authors_ref;
1977 my $commit_signers_ref;
1978 my $stats_ref;
1979 my @commit_authors = ();
1903 my @commit_signers = (); 1980 my @commit_signers = ();
1904 my $cmd; 1981 my $cmd;
1905 1982
1906 $cmd = $VCS_cmds{"find_commit_signers_cmd"}; 1983 $cmd = $VCS_cmds{"find_commit_signers_cmd"};
1907 $cmd =~ s/(\$\w+)/$1/eeg; #substitute variables in $cmd 1984 $cmd =~ s/(\$\w+)/$1/eeg; #substitute variables in $cmd
1908 1985
1909 ($commit_count, @commit_signers) = vcs_find_signers($cmd); 1986 ($commit_count, $commit_signers_ref, $commit_authors_ref, $stats_ref) = vcs_find_signers($cmd, $file);
1987 @commit_authors = @{$commit_authors_ref} if defined $commit_authors_ref;
1988 @commit_signers = @{$commit_signers_ref} if defined $commit_signers_ref;
1910 1989
1911 push(@signers, @commit_signers); 1990 push(@signers, @commit_signers);
1912 } 1991 }
diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl
index 64ac2380e4d5..62320f93e903 100644
--- a/scripts/headers_check.pl
+++ b/scripts/headers_check.pl
@@ -65,7 +65,11 @@ sub check_include
65 65
66sub check_declarations 66sub check_declarations
67{ 67{
68 if ($line =~m/^(\s*extern|unsigned|char|short|int|long|void)\b/) { 68 # soundcard.h is what it is
69 if ($line =~ m/^void seqbuf_dump\(void\);/) {
70 return;
71 }
72 if ($line =~ m/^(\s*extern|unsigned|char|short|int|long|void)\b/) {
69 printf STDERR "$filename:$lineno: " . 73 printf STDERR "$filename:$lineno: " .
70 "userspace cannot reference function or " . 74 "userspace cannot reference function or " .
71 "variable defined in the kernel\n"; 75 "variable defined in the kernel\n";
diff --git a/scripts/sortextable.c b/scripts/sortextable.c
index 7941fbdfb050..cc49062acdee 100644
--- a/scripts/sortextable.c
+++ b/scripts/sortextable.c
@@ -39,6 +39,10 @@
39#define EM_AARCH64 183 39#define EM_AARCH64 183
40#endif 40#endif
41 41
42#ifndef EM_MICROBLAZE
43#define EM_MICROBLAZE 189
44#endif
45
42static int fd_map; /* File descriptor for file being modified. */ 46static int fd_map; /* File descriptor for file being modified. */
43static int mmap_failed; /* Boolean flag. */ 47static int mmap_failed; /* Boolean flag. */
44static void *ehdr_curr; /* current ElfXX_Ehdr * for resource cleanup */ 48static void *ehdr_curr; /* current ElfXX_Ehdr * for resource cleanup */
@@ -275,6 +279,7 @@ do_file(char const *const fname)
275 case EM_ARCOMPACT: 279 case EM_ARCOMPACT:
276 case EM_ARM: 280 case EM_ARM:
277 case EM_AARCH64: 281 case EM_AARCH64:
282 case EM_MICROBLAZE:
278 case EM_MIPS: 283 case EM_MIPS:
279 break; 284 break;
280 } /* end switch */ 285 } /* end switch */