aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl34
-rwxr-xr-xscripts/decodecode8
-rwxr-xr-xscripts/get_maintainer.pl2
-rw-r--r--scripts/kconfig/streamline_config.pl26
-rw-r--r--scripts/mod/devicetable-offsets.c3
-rw-r--r--scripts/mod/file2alias.c12
6 files changed, 69 insertions, 16 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b28cc384a5bc..b954de58304f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -281,6 +281,7 @@ our $signature_tags = qr{(?xi:
281 Tested-by:| 281 Tested-by:|
282 Reviewed-by:| 282 Reviewed-by:|
283 Reported-by:| 283 Reported-by:|
284 Suggested-by:|
284 To:| 285 To:|
285 Cc: 286 Cc:
286)}; 287)};
@@ -628,6 +629,13 @@ sub sanitise_line {
628 return $res; 629 return $res;
629} 630}
630 631
632sub get_quoted_string {
633 my ($line, $rawline) = @_;
634
635 return "" if ($line !~ m/(\"[X]+\")/g);
636 return substr($rawline, $-[0], $+[0] - $-[0]);
637}
638
631sub ctx_statement_block { 639sub ctx_statement_block {
632 my ($linenr, $remain, $off) = @_; 640 my ($linenr, $remain, $off) = @_;
633 my $line = $linenr - 1; 641 my $line = $linenr - 1;
@@ -1576,7 +1584,8 @@ sub process {
1576# Check for incorrect file permissions 1584# Check for incorrect file permissions
1577 if ($line =~ /^new (file )?mode.*[7531]\d{0,2}$/) { 1585 if ($line =~ /^new (file )?mode.*[7531]\d{0,2}$/) {
1578 my $permhere = $here . "FILE: $realfile\n"; 1586 my $permhere = $here . "FILE: $realfile\n";
1579 if ($realfile =~ /(Makefile|Kconfig|\.c|\.h|\.S|\.tmpl)$/) { 1587 if ($realfile !~ m@scripts/@ &&
1588 $realfile !~ /\.(py|pl|awk|sh)$/) {
1580 ERROR("EXECUTE_PERMISSIONS", 1589 ERROR("EXECUTE_PERMISSIONS",
1581 "do not set execute permissions for source files\n" . $permhere); 1590 "do not set execute permissions for source files\n" . $permhere);
1582 } 1591 }
@@ -2514,8 +2523,8 @@ sub process {
2514 2523
2515# check for whitespace before a non-naked semicolon 2524# check for whitespace before a non-naked semicolon
2516 if ($line =~ /^\+.*\S\s+;/) { 2525 if ($line =~ /^\+.*\S\s+;/) {
2517 CHK("SPACING", 2526 WARN("SPACING",
2518 "space prohibited before semicolon\n" . $herecurr); 2527 "space prohibited before semicolon\n" . $herecurr);
2519 } 2528 }
2520 2529
2521# Check operator spacing. 2530# Check operator spacing.
@@ -3016,6 +3025,7 @@ sub process {
3016 $dstat !~ /^'X'$/ && # character constants 3025 $dstat !~ /^'X'$/ && # character constants
3017 $dstat !~ /$exceptions/ && 3026 $dstat !~ /$exceptions/ &&
3018 $dstat !~ /^\.$Ident\s*=/ && # .foo = 3027 $dstat !~ /^\.$Ident\s*=/ && # .foo =
3028 $dstat !~ /^(?:\#\s*$Ident|\#\s*$Constant)\s*$/ && # stringification #foo
3019 $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (...) 3029 $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (...)
3020 $dstat !~ /^for\s*$Constant$/ && # for (...) 3030 $dstat !~ /^for\s*$Constant$/ && # for (...)
3021 $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar() 3031 $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar()
@@ -3220,7 +3230,7 @@ sub process {
3220 } 3230 }
3221 3231
3222# check for unnecessary blank lines around braces 3232# check for unnecessary blank lines around braces
3223 if (($line =~ /^..*}\s*$/ && $prevline =~ /^.\s*$/)) { 3233 if (($line =~ /^.\s*}\s*$/ && $prevline =~ /^.\s*$/)) {
3224 CHK("BRACES", 3234 CHK("BRACES",
3225 "Blank lines aren't necessary before a close brace '}'\n" . $hereprev); 3235 "Blank lines aren't necessary before a close brace '}'\n" . $hereprev);
3226 } 3236 }
@@ -3372,6 +3382,15 @@ sub process {
3372 "struct spinlock should be spinlock_t\n" . $herecurr); 3382 "struct spinlock should be spinlock_t\n" . $herecurr);
3373 } 3383 }
3374 3384
3385# check for seq_printf uses that could be seq_puts
3386 if ($line =~ /\bseq_printf\s*\(/) {
3387 my $fmt = get_quoted_string($line, $rawline);
3388 if ($fmt !~ /[^\\]\%/) {
3389 WARN("PREFER_SEQ_PUTS",
3390 "Prefer seq_puts to seq_printf\n" . $herecurr);
3391 }
3392 }
3393
3375# Check for misused memsets 3394# Check for misused memsets
3376 if ($^V && $^V ge 5.10.0 && 3395 if ($^V && $^V ge 5.10.0 &&
3377 defined $stat && 3396 defined $stat &&
@@ -3476,6 +3495,13 @@ sub process {
3476 "unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr); 3495 "unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr);
3477 } 3496 }
3478 3497
3498# check for krealloc arg reuse
3499 if ($^V && $^V ge 5.10.0 &&
3500 $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*krealloc\s*\(\s*\1\s*,/) {
3501 WARN("KREALLOC_ARG_REUSE",
3502 "Reusing the krealloc arg is almost always a bug\n" . $herecurr);
3503 }
3504
3479# check for alloc argument mismatch 3505# check for alloc argument mismatch
3480 if ($line =~ /\b(kcalloc|kmalloc_array)\s*\(\s*sizeof\b/) { 3506 if ($line =~ /\b(kcalloc|kmalloc_array)\s*\(\s*sizeof\b/) {
3481 WARN("ALLOC_ARRAY_ARGS", 3507 WARN("ALLOC_ARRAY_ARGS",
diff --git a/scripts/decodecode b/scripts/decodecode
index 4f8248d5a11f..d8824f37acce 100755
--- a/scripts/decodecode
+++ b/scripts/decodecode
@@ -89,10 +89,16 @@ echo $code >> $T.s
89disas $T 89disas $T
90cat $T.dis >> $T.aa 90cat $T.dis >> $T.aa
91 91
92# (lines of whole $T.oo) - (lines of $T.aa, i.e. "Code starting") + 3,
93# i.e. the title + the "===..=" line (sed is counting from 1, 0 address is
94# special)
95faultlinenum=$(( $(wc -l $T.oo | cut -d" " -f1) - \
96 $(wc -l $T.aa | cut -d" " -f1) + 3))
97
92faultline=`cat $T.dis | head -1 | cut -d":" -f2-` 98faultline=`cat $T.dis | head -1 | cut -d":" -f2-`
93faultline=`echo "$faultline" | sed -e 's/\[/\\\[/g; s/\]/\\\]/g'` 99faultline=`echo "$faultline" | sed -e 's/\[/\\\[/g; s/\]/\\\]/g'`
94 100
95cat $T.oo | sed -e "s/\($faultline\)/\*\1 <-- trapping instruction/g" 101cat $T.oo | sed -e "${faultlinenum}s/^\(.*:\)\(.*\)/\1\*\2\t\t<-- trapping instruction/"
96echo 102echo
97cat $T.aa 103cat $T.aa
98cleanup 104cleanup
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index ce4cc837b748..5e4fb144a04f 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -611,7 +611,7 @@ sub get_maintainers {
611 $hash{$tvi} = $value_pd; 611 $hash{$tvi} = $value_pd;
612 } 612 }
613 } 613 }
614 } elsif ($type eq 'K') { 614 } elsif ($type eq 'N') {
615 if ($file =~ m/$value/x) { 615 if ($file =~ m/$value/x) {
616 $hash{$tvi} = 0; 616 $hash{$tvi} = 0;
617 } 617 }
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index 33689396953a..4606cdfb859d 100644
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -156,7 +156,6 @@ sub read_kconfig {
156 156
157 my $state = "NONE"; 157 my $state = "NONE";
158 my $config; 158 my $config;
159 my @kconfigs;
160 159
161 my $cont = 0; 160 my $cont = 0;
162 my $line; 161 my $line;
@@ -190,7 +189,13 @@ sub read_kconfig {
190 189
191 # collect any Kconfig sources 190 # collect any Kconfig sources
192 if (/^source\s*"(.*)"/) { 191 if (/^source\s*"(.*)"/) {
193 $kconfigs[$#kconfigs+1] = $1; 192 my $kconfig = $1;
193 # prevent reading twice.
194 if (!defined($read_kconfigs{$kconfig})) {
195 $read_kconfigs{$kconfig} = 1;
196 read_kconfig($kconfig);
197 }
198 next;
194 } 199 }
195 200
196 # configs found 201 # configs found
@@ -250,14 +255,6 @@ sub read_kconfig {
250 } 255 }
251 } 256 }
252 close($kinfile); 257 close($kinfile);
253
254 # read in any configs that were found.
255 foreach my $kconfig (@kconfigs) {
256 if (!defined($read_kconfigs{$kconfig})) {
257 $read_kconfigs{$kconfig} = 1;
258 read_kconfig($kconfig);
259 }
260 }
261} 258}
262 259
263if ($kconfig) { 260if ($kconfig) {
@@ -396,6 +393,15 @@ foreach my $module (keys(%modules)) {
396 foreach my $conf (@arr) { 393 foreach my $conf (@arr) {
397 $configs{$conf} = $module; 394 $configs{$conf} = $module;
398 dprint "$conf added by direct ($module)\n"; 395 dprint "$conf added by direct ($module)\n";
396 if ($debugprint) {
397 my $c=$conf;
398 $c =~ s/^CONFIG_//;
399 if (defined($depends{$c})) {
400 dprint " deps = $depends{$c}\n";
401 } else {
402 dprint " no deps\n";
403 }
404 }
399 } 405 }
400 } else { 406 } else {
401 # Most likely, someone has a custom (binary?) module loaded. 407 # Most likely, someone has a custom (binary?) module loaded.
diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c
index b45260bfeaa0..e66d4d258e1a 100644
--- a/scripts/mod/devicetable-offsets.c
+++ b/scripts/mod/devicetable-offsets.c
@@ -174,5 +174,8 @@ int main(void)
174 DEVID_FIELD(x86_cpu_id, model); 174 DEVID_FIELD(x86_cpu_id, model);
175 DEVID_FIELD(x86_cpu_id, vendor); 175 DEVID_FIELD(x86_cpu_id, vendor);
176 176
177 DEVID(mei_cl_device_id);
178 DEVID_FIELD(mei_cl_device_id, name);
179
177 return 0; 180 return 0;
178} 181}
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 771ac17f635d..45f9a3377dcd 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -1133,6 +1133,18 @@ static int do_x86cpu_entry(const char *filename, void *symval,
1133} 1133}
1134ADD_TO_DEVTABLE("x86cpu", x86_cpu_id, do_x86cpu_entry); 1134ADD_TO_DEVTABLE("x86cpu", x86_cpu_id, do_x86cpu_entry);
1135 1135
1136/* Looks like: mei:S */
1137static int do_mei_entry(const char *filename, void *symval,
1138 char *alias)
1139{
1140 DEF_FIELD_ADDR(symval, mei_cl_device_id, name);
1141
1142 sprintf(alias, MEI_CL_MODULE_PREFIX "%s", *name);
1143
1144 return 1;
1145}
1146ADD_TO_DEVTABLE("mei", mei_cl_device_id, do_mei_entry);
1147
1136/* Does namelen bytes of name exactly match the symbol? */ 1148/* Does namelen bytes of name exactly match the symbol? */
1137static bool sym_is(const char *name, unsigned namelen, const char *symbol) 1149static bool sym_is(const char *name, unsigned namelen, const char *symbol)
1138{ 1150{