aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.lib3
-rw-r--r--scripts/Makefile.modsign32
-rwxr-xr-xscripts/checkpatch.pl150
-rw-r--r--scripts/coccinelle/api/d_find_alias.cocci80
-rw-r--r--scripts/coccinelle/misc/warn.cocci109
-rwxr-xr-xscripts/config1
-rw-r--r--scripts/dtc/Makefile2
-rwxr-xr-xscripts/kernel-doc34
-rw-r--r--scripts/mod/modpost.c24
-rw-r--r--scripts/pnmtologo.c7
-rw-r--r--scripts/sortextable.c1
-rwxr-xr-xscripts/tags.sh57
12 files changed, 415 insertions, 85 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 0be6f110cce7..bdf42fdf64c9 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -266,6 +266,9 @@ $(obj)/%.dtb.S: $(obj)/%.dtb
266quiet_cmd_dtc = DTC $@ 266quiet_cmd_dtc = DTC $@
267cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile) $< 267cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile) $<
268 268
269$(obj)/%.dtb: $(src)/%.dts FORCE
270 $(call if_changed_dep,dtc)
271
269# Bzip2 272# Bzip2
270# --------------------------------------------------------------------------- 273# ---------------------------------------------------------------------------
271 274
diff --git a/scripts/Makefile.modsign b/scripts/Makefile.modsign
new file mode 100644
index 000000000000..abfda626dbad
--- /dev/null
+++ b/scripts/Makefile.modsign
@@ -0,0 +1,32 @@
1# ==========================================================================
2# Signing modules
3# ==========================================================================
4
5PHONY := __modsign
6__modsign:
7
8include scripts/Kbuild.include
9
10__modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod)))
11modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o)))
12
13PHONY += $(modules)
14__modsign: $(modules)
15 @:
16
17quiet_cmd_sign_ko = SIGN [M] $(2)/$(notdir $@)
18 cmd_sign_ko = $(mod_sign_cmd) $(2)/$(notdir $@)
19
20# Modules built outside the kernel source tree go into extra by default
21INSTALL_MOD_DIR ?= extra
22ext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(patsubst %/,%,$(KBUILD_EXTMOD)),,$(@D))
23
24modinst_dir = $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D))
25
26$(modules):
27 $(call cmd,sign_ko,$(MODLIB)/$(modinst_dir))
28
29# Declare the contents of the .PHONY variable as phony. We keep that
30# information in a variable se we can use it in if_changed and friends.
31
32.PHONY: $(PHONY)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f18750e3bd6c..4d2c7dfdaabd 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -33,6 +33,7 @@ my %ignore_type = ();
33my @ignore = (); 33my @ignore = ();
34my $help = 0; 34my $help = 0;
35my $configuration_file = ".checkpatch.conf"; 35my $configuration_file = ".checkpatch.conf";
36my $max_line_length = 80;
36 37
37sub help { 38sub help {
38 my ($exitcode) = @_; 39 my ($exitcode) = @_;
@@ -51,6 +52,7 @@ Options:
51 -f, --file treat FILE as regular source file 52 -f, --file treat FILE as regular source file
52 --subjective, --strict enable more subjective tests 53 --subjective, --strict enable more subjective tests
53 --ignore TYPE(,TYPE2...) ignore various comma separated message types 54 --ignore TYPE(,TYPE2...) ignore various comma separated message types
55 --max-line-length=n set the maximum line length, if exceeded, warn
54 --show-types show the message "types" in the output 56 --show-types show the message "types" in the output
55 --root=PATH PATH to the kernel tree root 57 --root=PATH PATH to the kernel tree root
56 --no-summary suppress the per-file summary 58 --no-summary suppress the per-file summary
@@ -107,6 +109,7 @@ GetOptions(
107 'strict!' => \$check, 109 'strict!' => \$check,
108 'ignore=s' => \@ignore, 110 'ignore=s' => \@ignore,
109 'show-types!' => \$show_types, 111 'show-types!' => \$show_types,
112 'max-line-length=i' => \$max_line_length,
110 'root=s' => \$root, 113 'root=s' => \$root,
111 'summary!' => \$summary, 114 'summary!' => \$summary,
112 'mailback!' => \$mailback, 115 'mailback!' => \$mailback,
@@ -227,7 +230,11 @@ our $Inline = qr{inline|__always_inline|noinline};
227our $Member = qr{->$Ident|\.$Ident|\[[^]]*\]}; 230our $Member = qr{->$Ident|\.$Ident|\[[^]]*\]};
228our $Lval = qr{$Ident(?:$Member)*}; 231our $Lval = qr{$Ident(?:$Member)*};
229 232
230our $Constant = qr{(?i:(?:[0-9]+|0x[0-9a-f]+)[ul]*)}; 233our $Float_hex = qr{(?i:0x[0-9a-f]+p-?[0-9]+[fl]?)};
234our $Float_dec = qr{(?i:((?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+)(?:e-?[0-9]+)?[fl]?))};
235our $Float_int = qr{(?i:[0-9]+e-?[0-9]+[fl]?)};
236our $Float = qr{$Float_hex|$Float_dec|$Float_int};
237our $Constant = qr{(?:$Float|(?i:(?:0x[0-9a-f]+|[0-9]+)[ul]*))};
231our $Assignment = qr{(?:\*\=|/=|%=|\+=|-=|<<=|>>=|&=|\^=|\|=|=)}; 238our $Assignment = qr{(?:\*\=|/=|%=|\+=|-=|<<=|>>=|&=|\^=|\|=|=)};
232our $Compare = qr{<=|>=|==|!=|<|>}; 239our $Compare = qr{<=|>=|==|!=|<|>};
233our $Operators = qr{ 240our $Operators = qr{
@@ -352,27 +359,6 @@ sub deparenthesize {
352 359
353$chk_signoff = 0 if ($file); 360$chk_signoff = 0 if ($file);
354 361
355my @dep_includes = ();
356my @dep_functions = ();
357my $removal = "Documentation/feature-removal-schedule.txt";
358if ($tree && -f "$root/$removal") {
359 open(my $REMOVE, '<', "$root/$removal") ||
360 die "$P: $removal: open failed - $!\n";
361 while (<$REMOVE>) {
362 if (/^Check:\s+(.*\S)/) {
363 for my $entry (split(/[, ]+/, $1)) {
364 if ($entry =~ m@include/(.*)@) {
365 push(@dep_includes, $1);
366
367 } elsif ($entry !~ m@/@) {
368 push(@dep_functions, $entry);
369 }
370 }
371 }
372 }
373 close($REMOVE);
374}
375
376my @rawlines = (); 362my @rawlines = ();
377my @lines = (); 363my @lines = ();
378my $vname; 364my $vname;
@@ -1412,6 +1398,8 @@ sub process {
1412 my %suppress_export; 1398 my %suppress_export;
1413 my $suppress_statement = 0; 1399 my $suppress_statement = 0;
1414 1400
1401 my %camelcase = ();
1402
1415 # Pre-scan the patch sanitizing the lines. 1403 # Pre-scan the patch sanitizing the lines.
1416 # Pre-scan the patch looking for any __setup documentation. 1404 # Pre-scan the patch looking for any __setup documentation.
1417 # 1405 #
@@ -1757,6 +1745,13 @@ sub process {
1757 #print "is_start<$is_start> is_end<$is_end> length<$length>\n"; 1745 #print "is_start<$is_start> is_end<$is_end> length<$length>\n";
1758 } 1746 }
1759 1747
1748# discourage the addition of CONFIG_EXPERIMENTAL in Kconfig.
1749 if ($realfile =~ /Kconfig/ &&
1750 $line =~ /.\s*depends on\s+.*\bEXPERIMENTAL\b/) {
1751 WARN("CONFIG_EXPERIMENTAL",
1752 "Use of CONFIG_EXPERIMENTAL is deprecated. For alternatives, see https://lkml.org/lkml/2012/10/23/580\n");
1753 }
1754
1760 if (($realfile =~ /Makefile.*/ || $realfile =~ /Kbuild.*/) && 1755 if (($realfile =~ /Makefile.*/ || $realfile =~ /Kbuild.*/) &&
1761 ($line =~ /\+(EXTRA_[A-Z]+FLAGS).*/)) { 1756 ($line =~ /\+(EXTRA_[A-Z]+FLAGS).*/)) {
1762 my $flag = $1; 1757 my $flag = $1;
@@ -1774,15 +1769,15 @@ sub process {
1774# check we are in a valid source file if not then ignore this hunk 1769# check we are in a valid source file if not then ignore this hunk
1775 next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/); 1770 next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/);
1776 1771
1777#80 column limit 1772#line length limit
1778 if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ && 1773 if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ &&
1779 $rawline !~ /^.\s*\*\s*\@$Ident\s/ && 1774 $rawline !~ /^.\s*\*\s*\@$Ident\s/ &&
1780 !($line =~ /^\+\s*$logFunctions\s*\(\s*(?:(KERN_\S+\s*|[^"]*))?"[X\t]*"\s*(?:|,|\)\s*;)\s*$/ || 1775 !($line =~ /^\+\s*$logFunctions\s*\(\s*(?:(KERN_\S+\s*|[^"]*))?"[X\t]*"\s*(?:|,|\)\s*;)\s*$/ ||
1781 $line =~ /^\+\s*"[^"]*"\s*(?:\s*|,|\)\s*;)\s*$/) && 1776 $line =~ /^\+\s*"[^"]*"\s*(?:\s*|,|\)\s*;)\s*$/) &&
1782 $length > 80) 1777 $length > $max_line_length)
1783 { 1778 {
1784 WARN("LONG_LINE", 1779 WARN("LONG_LINE",
1785 "line over 80 characters\n" . $herecurr); 1780 "line over $max_line_length characters\n" . $herecurr);
1786 } 1781 }
1787 1782
1788# Check for user-visible strings broken across lines, which breaks the ability 1783# Check for user-visible strings broken across lines, which breaks the ability
@@ -1912,6 +1907,12 @@ sub process {
1912# check we are in a valid C source file if not then ignore this hunk 1907# check we are in a valid C source file if not then ignore this hunk
1913 next if ($realfile !~ /\.(h|c)$/); 1908 next if ($realfile !~ /\.(h|c)$/);
1914 1909
1910# discourage the addition of CONFIG_EXPERIMENTAL in #if(def).
1911 if ($line =~ /^\+\s*\#\s*if.*\bCONFIG_EXPERIMENTAL\b/) {
1912 WARN("CONFIG_EXPERIMENTAL",
1913 "Use of CONFIG_EXPERIMENTAL is deprecated. For alternatives, see https://lkml.org/lkml/2012/10/23/580\n");
1914 }
1915
1915# check for RCS/CVS revision markers 1916# check for RCS/CVS revision markers
1916 if ($rawline =~ /^\+.*\$(Revision|Log|Id)(?:\$|)/) { 1917 if ($rawline =~ /^\+.*\$(Revision|Log|Id)(?:\$|)/) {
1917 WARN("CVS_KEYWORD", 1918 WARN("CVS_KEYWORD",
@@ -2225,8 +2226,11 @@ sub process {
2225 my $path = $1; 2226 my $path = $1;
2226 if ($path =~ m{//}) { 2227 if ($path =~ m{//}) {
2227 ERROR("MALFORMED_INCLUDE", 2228 ERROR("MALFORMED_INCLUDE",
2228 "malformed #include filename\n" . 2229 "malformed #include filename\n" . $herecurr);
2229 $herecurr); 2230 }
2231 if ($path =~ "^uapi/" && $realfile =~ m@\binclude/uapi/@) {
2232 ERROR("UAPI_INCLUDE",
2233 "No #include in ...include/uapi/... should use a uapi/ path prefix\n" . $herecurr);
2230 } 2234 }
2231 } 2235 }
2232 2236
@@ -2906,12 +2910,17 @@ sub process {
2906 } 2910 }
2907 } 2911 }
2908 2912
2909#studly caps, commented out until figure out how to distinguish between use of existing and adding new 2913#CamelCase
2910# if (($line=~/[\w_][a-z\d]+[A-Z]/) and !($line=~/print/)) { 2914 while ($line =~ m{($Constant|$Lval)}g) {
2911# print "No studly caps, use _\n"; 2915 my $var = $1;
2912# print "$herecurr"; 2916 if ($var !~ /$Constant/ &&
2913# $clean = 0; 2917 $var =~ /[A-Z]\w*[a-z]|[a-z]\w*[A-Z]/ &&
2914# } 2918 !defined $camelcase{$var}) {
2919 $camelcase{$var} = 1;
2920 WARN("CAMELCASE",
2921 "Avoid CamelCase: <$var>\n" . $herecurr);
2922 }
2923 }
2915 2924
2916#no spaces allowed after \ in define 2925#no spaces allowed after \ in define
2917 if ($line=~/\#\s*define.*\\\s$/) { 2926 if ($line=~/\#\s*define.*\\\s$/) {
@@ -3013,6 +3022,17 @@ sub process {
3013 "Macros with complex values should be enclosed in parenthesis\n" . "$herectx"); 3022 "Macros with complex values should be enclosed in parenthesis\n" . "$herectx");
3014 } 3023 }
3015 } 3024 }
3025
3026# check for line continuations outside of #defines, preprocessor #, and asm
3027
3028 } else {
3029 if ($prevline !~ /^..*\\$/ &&
3030 $line !~ /^\+\s*\#.*\\$/ && # preprocessor
3031 $line !~ /^\+.*\b(__asm__|asm)\b.*\\$/ && # asm
3032 $line =~ /^\+.*\\$/) {
3033 WARN("LINE_CONTINUATIONS",
3034 "Avoid unnecessary line continuations\n" . $herecurr);
3035 }
3016 } 3036 }
3017 3037
3018# do {} while (0) macro tests: 3038# do {} while (0) macro tests:
@@ -3183,20 +3203,14 @@ sub process {
3183 } 3203 }
3184 } 3204 }
3185 3205
3186# don't include deprecated include files (uses RAW line) 3206# check for unnecessary blank lines around braces
3187 for my $inc (@dep_includes) { 3207 if (($line =~ /^..*}\s*$/ && $prevline =~ /^.\s*$/)) {
3188 if ($rawline =~ m@^.\s*\#\s*include\s*\<$inc>@) { 3208 CHK("BRACES",
3189 ERROR("DEPRECATED_INCLUDE", 3209 "Blank lines aren't necessary before a close brace '}'\n" . $hereprev);
3190 "Don't use <$inc>: see Documentation/feature-removal-schedule.txt\n" . $herecurr);
3191 }
3192 } 3210 }
3193 3211 if (($line =~ /^.\s*$/ && $prevline =~ /^..*{\s*$/)) {
3194# don't use deprecated functions 3212 CHK("BRACES",
3195 for my $func (@dep_functions) { 3213 "Blank lines aren't necessary after an open brace '{'\n" . $hereprev);
3196 if ($line =~ /\b$func\b/) {
3197 ERROR("DEPRECATED_FUNCTION",
3198 "Don't use $func(): see Documentation/feature-removal-schedule.txt\n" . $herecurr);
3199 }
3200 } 3214 }
3201 3215
3202# no volatiles please 3216# no volatiles please
@@ -3213,20 +3227,12 @@ sub process {
3213 $herecurr); 3227 $herecurr);
3214 } 3228 }
3215 3229
3216# check for needless kfree() checks 3230# check for needless "if (<foo>) fn(<foo>)" uses
3217 if ($prevline =~ /\bif\s*\(([^\)]*)\)/) { 3231 if ($prevline =~ /\bif\s*\(\s*($Lval)\s*\)/) {
3218 my $expr = $1; 3232 my $expr = '\s*\(\s*' . quotemeta($1) . '\s*\)\s*;';
3219 if ($line =~ /\bkfree\(\Q$expr\E\);/) { 3233 if ($line =~ /\b(kfree|usb_free_urb|debugfs_remove(?:_recursive)?)$expr/) {
3220 WARN("NEEDLESS_KFREE", 3234 WARN('NEEDLESS_IF',
3221 "kfree(NULL) is safe this check is probably not required\n" . $hereprev); 3235 "$1(NULL) is safe this check is probably not required\n" . $hereprev);
3222 }
3223 }
3224# check for needless usb_free_urb() checks
3225 if ($prevline =~ /\bif\s*\(([^\)]*)\)/) {
3226 my $expr = $1;
3227 if ($line =~ /\busb_free_urb\(\Q$expr\E\);/) {
3228 WARN("NEEDLESS_USB_FREE_URB",
3229 "usb_free_urb(NULL) is safe this check is probably not required\n" . $hereprev);
3230 } 3236 }
3231 } 3237 }
3232 3238
@@ -3344,6 +3350,12 @@ sub process {
3344 "Avoid line continuations in quoted strings\n" . $herecurr); 3350 "Avoid line continuations in quoted strings\n" . $herecurr);
3345 } 3351 }
3346 3352
3353# check for struct spinlock declarations
3354 if ($line =~ /^.\s*\bstruct\s+spinlock\s+\w+\s*;/) {
3355 WARN("USE_SPINLOCK_T",
3356 "struct spinlock should be spinlock_t\n" . $herecurr);
3357 }
3358
3347# Check for misused memsets 3359# Check for misused memsets
3348 if ($^V && $^V ge 5.10.0 && 3360 if ($^V && $^V ge 5.10.0 &&
3349 defined $stat && 3361 defined $stat &&
@@ -3450,8 +3462,22 @@ sub process {
3450 3462
3451# check for multiple semicolons 3463# check for multiple semicolons
3452 if ($line =~ /;\s*;\s*$/) { 3464 if ($line =~ /;\s*;\s*$/) {
3453 WARN("ONE_SEMICOLON", 3465 WARN("ONE_SEMICOLON",
3454 "Statements terminations use 1 semicolon\n" . $herecurr); 3466 "Statements terminations use 1 semicolon\n" . $herecurr);
3467 }
3468
3469# check for switch/default statements without a break;
3470 if ($^V && $^V ge 5.10.0 &&
3471 defined $stat &&
3472 $stat =~ /^\+[$;\s]*(?:case[$;\s]+\w+[$;\s]*:[$;\s]*|)*[$;\s]*\bdefault[$;\s]*:[$;\s]*;/g) {
3473 my $ctx = '';
3474 my $herectx = $here . "\n";
3475 my $cnt = statement_rawlines($stat);
3476 for (my $n = 0; $n < $cnt; $n++) {
3477 $herectx .= raw_line($linenr, $n) . "\n";
3478 }
3479 WARN("DEFAULT_NO_BREAK",
3480 "switch default: should use break\n" . $herectx);
3455 } 3481 }
3456 3482
3457# check for gcc specific __FUNCTION__ 3483# check for gcc specific __FUNCTION__
diff --git a/scripts/coccinelle/api/d_find_alias.cocci b/scripts/coccinelle/api/d_find_alias.cocci
new file mode 100644
index 000000000000..a9694a8d3e5a
--- /dev/null
+++ b/scripts/coccinelle/api/d_find_alias.cocci
@@ -0,0 +1,80 @@
1/// Make sure calls to d_find_alias() have a corresponding call to dput().
2//
3// Keywords: d_find_alias, dput
4//
5// Confidence: Moderate
6// URL: http://coccinelle.lip6.fr/
7// Options: -include_headers
8
9virtual context
10virtual org
11virtual patch
12virtual report
13
14@r exists@
15local idexpression struct dentry *dent;
16expression E, E1;
17statement S1, S2;
18position p1, p2;
19@@
20(
21 if (!(dent@p1 = d_find_alias(...))) S1
22|
23 dent@p1 = d_find_alias(...)
24)
25
26<...when != dput(dent)
27 when != if (...) { <+... dput(dent) ...+> }
28 when != true !dent || ...
29 when != dent = E
30 when != E = dent
31if (!dent || ...) S2
32...>
33(
34 return <+...dent...+>;
35|
36 return @p2 ...;
37|
38 dent@p2 = E1;
39|
40 E1 = dent;
41)
42
43@depends on context@
44local idexpression struct dentry *r.dent;
45position r.p1,r.p2;
46@@
47* dent@p1 = ...
48 ...
49(
50* return@p2 ...;
51|
52* dent@p2
53)
54
55
56@script:python depends on org@
57p1 << r.p1;
58p2 << r.p2;
59@@
60cocci.print_main("Missing call to dput()",p1)
61cocci.print_secs("",p2)
62
63@depends on patch@
64local idexpression struct dentry *r.dent;
65position r.p2;
66@@
67(
68+ dput(dent);
69 return @p2 ...;
70|
71+ dput(dent);
72 dent@p2 = ...;
73)
74
75@script:python depends on report@
76p1 << r.p1;
77p2 << r.p2;
78@@
79msg = "Missing call to dput() at line %s."
80coccilib.report.print_report(p1[0], msg % (p2[0].line))
diff --git a/scripts/coccinelle/misc/warn.cocci b/scripts/coccinelle/misc/warn.cocci
new file mode 100644
index 000000000000..fda8c3558e4f
--- /dev/null
+++ b/scripts/coccinelle/misc/warn.cocci
@@ -0,0 +1,109 @@
1/// Use WARN(1,...) rather than printk followed by WARN_ON(1)
2///
3// Confidence: High
4// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
5// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2.
6// URL: http://coccinelle.lip6.fr/
7// Comments:
8// Options: -no_includes -include_headers
9
10virtual patch
11virtual context
12virtual org
13virtual report
14
15@bad1@
16position p;
17@@
18
19printk(...);
20printk@p(...);
21WARN_ON(1);
22
23@r1 depends on context || report || org@
24position p != bad1.p;
25@@
26
27 printk@p(...);
28*WARN_ON(1);
29
30@script:python depends on org@
31p << r1.p;
32@@
33
34cocci.print_main("printk + WARN_ON can be just WARN",p)
35
36@script:python depends on report@
37p << r1.p;
38@@
39
40msg = "SUGGESTION: printk + WARN_ON can be just WARN"
41coccilib.report.print_report(p[0],msg)
42
43@ok1 depends on patch@
44expression list es;
45position p != bad1.p;
46@@
47
48-printk@p(
49+WARN(1,
50 es);
51-WARN_ON(1);
52
53@depends on patch@
54expression list ok1.es;
55@@
56
57if (...)
58- {
59 WARN(1,es);
60- }
61
62// --------------------------------------------------------------------
63
64@bad2@
65position p;
66@@
67
68printk(...);
69printk@p(...);
70WARN_ON_ONCE(1);
71
72@r2 depends on context || report || org@
73position p != bad1.p;
74@@
75
76 printk@p(...);
77*WARN_ON_ONCE(1);
78
79@script:python depends on org@
80p << r2.p;
81@@
82
83cocci.print_main("printk + WARN_ON_ONCE can be just WARN_ONCE",p)
84
85@script:python depends on report@
86p << r2.p;
87@@
88
89msg = "SUGGESTION: printk + WARN_ON_ONCE can be just WARN_ONCE"
90coccilib.report.print_report(p[0],msg)
91
92@ok2 depends on patch@
93expression list es;
94position p != bad2.p;
95@@
96
97-printk@p(
98+WARN_ONCE(1,
99 es);
100-WARN_ON_ONCE(1);
101
102@depends on patch@
103expression list ok2.es;
104@@
105
106if (...)
107- {
108 WARN_ONCE(1,es);
109- }
diff --git a/scripts/config b/scripts/config
index ee355394f4ef..bb4d3deb6d1c 100755
--- a/scripts/config
+++ b/scripts/config
@@ -101,7 +101,6 @@ while [ "$1" != "" ] ; do
101 case "$CMD" in 101 case "$CMD" in
102 --keep-case|-k) 102 --keep-case|-k)
103 MUNGE_CASE=no 103 MUNGE_CASE=no
104 shift
105 continue 104 continue
106 ;; 105 ;;
107 --refresh) 106 --refresh)
diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile
index 6d1c6bb9f224..2a48022c41e7 100644
--- a/scripts/dtc/Makefile
+++ b/scripts/dtc/Makefile
@@ -27,3 +27,5 @@ HOSTCFLAGS_dtc-parser.tab.o := $(HOSTCFLAGS_DTC)
27# dependencies on generated files need to be listed explicitly 27# dependencies on generated files need to be listed explicitly
28$(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h 28$(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h
29 29
30# generated files need to be cleaned explicitly
31clean-files := dtc-lexer.lex.c dtc-parser.tab.c dtc-parser.tab.h
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 46e7aff80d1a..28b761567815 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -137,6 +137,8 @@ use strict;
137# should document the "Context:" of the function, e.g. whether the functions 137# should document the "Context:" of the function, e.g. whether the functions
138# can be called form interrupts. Unlike other sections you can end it with an 138# can be called form interrupts. Unlike other sections you can end it with an
139# empty line. 139# empty line.
140# A non-void function should have a "Return:" section describing the return
141# value(s).
140# Example-sections should contain the string EXAMPLE so that they are marked 142# Example-sections should contain the string EXAMPLE so that they are marked
141# appropriately in DocBook. 143# appropriately in DocBook.
142# 144#
@@ -315,6 +317,7 @@ my $section_default = "Description"; # default section
315my $section_intro = "Introduction"; 317my $section_intro = "Introduction";
316my $section = $section_default; 318my $section = $section_default;
317my $section_context = "Context"; 319my $section_context = "Context";
320my $section_return = "Return";
318 321
319my $undescribed = "-- undescribed --"; 322my $undescribed = "-- undescribed --";
320 323
@@ -2039,6 +2042,28 @@ sub check_sections($$$$$$) {
2039} 2042}
2040 2043
2041## 2044##
2045# Checks the section describing the return value of a function.
2046sub check_return_section {
2047 my $file = shift;
2048 my $declaration_name = shift;
2049 my $return_type = shift;
2050
2051 # Ignore an empty return type (It's a macro)
2052 # Ignore functions with a "void" return type. (But don't ignore "void *")
2053 if (($return_type eq "") || ($return_type =~ /void\s*\w*\s*$/)) {
2054 return;
2055 }
2056
2057 if (!defined($sections{$section_return}) ||
2058 $sections{$section_return} eq "") {
2059 print STDERR "Warning(${file}:$.): " .
2060 "No description found for return value of " .
2061 "'$declaration_name'\n";
2062 ++$warnings;
2063 }
2064}
2065
2066##
2042# takes a function prototype and the name of the current file being 2067# takes a function prototype and the name of the current file being
2043# processed and spits out all the details stored in the global 2068# processed and spits out all the details stored in the global
2044# arrays/hashes. 2069# arrays/hashes.
@@ -2109,6 +2134,15 @@ sub dump_function($$) {
2109 my $prms = join " ", @parameterlist; 2134 my $prms = join " ", @parameterlist;
2110 check_sections($file, $declaration_name, "function", $sectcheck, $prms, ""); 2135 check_sections($file, $declaration_name, "function", $sectcheck, $prms, "");
2111 2136
2137 # This check emits a lot of warnings at the moment, because many
2138 # functions don't have a 'Return' doc section. So until the number
2139 # of warnings goes sufficiently down, the check is only performed in
2140 # verbose mode.
2141 # TODO: always perform the check.
2142 if ($verbose) {
2143 check_return_section($file, $declaration_name, $return_type);
2144 }
2145
2112 output_declaration($declaration_name, 2146 output_declaration($declaration_name,
2113 'function', 2147 'function',
2114 {'function' => $declaration_name, 2148 {'function' => $declaration_name,
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 0d93856a03f4..ff36c508a10e 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -858,25 +858,23 @@ static void check_section(const char *modname, struct elf_info *elf,
858 858
859#define ALL_INIT_DATA_SECTIONS \ 859#define ALL_INIT_DATA_SECTIONS \
860 ".init.setup$", ".init.rodata$", \ 860 ".init.setup$", ".init.rodata$", \
861 ".devinit.rodata$", ".cpuinit.rodata$", ".meminit.rodata$", \ 861 ".cpuinit.rodata$", ".meminit.rodata$", \
862 ".init.data$", ".devinit.data$", ".cpuinit.data$", ".meminit.data$" 862 ".init.data$", ".cpuinit.data$", ".meminit.data$"
863#define ALL_EXIT_DATA_SECTIONS \ 863#define ALL_EXIT_DATA_SECTIONS \
864 ".exit.data$", ".devexit.data$", ".cpuexit.data$", ".memexit.data$" 864 ".exit.data$", ".cpuexit.data$", ".memexit.data$"
865 865
866#define ALL_INIT_TEXT_SECTIONS \ 866#define ALL_INIT_TEXT_SECTIONS \
867 ".init.text$", ".devinit.text$", ".cpuinit.text$", ".meminit.text$" 867 ".init.text$", ".cpuinit.text$", ".meminit.text$"
868#define ALL_EXIT_TEXT_SECTIONS \ 868#define ALL_EXIT_TEXT_SECTIONS \
869 ".exit.text$", ".devexit.text$", ".cpuexit.text$", ".memexit.text$" 869 ".exit.text$", ".cpuexit.text$", ".memexit.text$"
870 870
871#define ALL_PCI_INIT_SECTIONS \ 871#define ALL_PCI_INIT_SECTIONS \
872 ".pci_fixup_early$", ".pci_fixup_header$", ".pci_fixup_final$", \ 872 ".pci_fixup_early$", ".pci_fixup_header$", ".pci_fixup_final$", \
873 ".pci_fixup_enable$", ".pci_fixup_resume$", \ 873 ".pci_fixup_enable$", ".pci_fixup_resume$", \
874 ".pci_fixup_resume_early$", ".pci_fixup_suspend$" 874 ".pci_fixup_resume_early$", ".pci_fixup_suspend$"
875 875
876#define ALL_XXXINIT_SECTIONS DEV_INIT_SECTIONS, CPU_INIT_SECTIONS, \ 876#define ALL_XXXINIT_SECTIONS CPU_INIT_SECTIONS, MEM_INIT_SECTIONS
877 MEM_INIT_SECTIONS 877#define ALL_XXXEXIT_SECTIONS CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS
878#define ALL_XXXEXIT_SECTIONS DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, \
879 MEM_EXIT_SECTIONS
880 878
881#define ALL_INIT_SECTIONS INIT_SECTIONS, ALL_XXXINIT_SECTIONS 879#define ALL_INIT_SECTIONS INIT_SECTIONS, ALL_XXXINIT_SECTIONS
882#define ALL_EXIT_SECTIONS EXIT_SECTIONS, ALL_XXXEXIT_SECTIONS 880#define ALL_EXIT_SECTIONS EXIT_SECTIONS, ALL_XXXEXIT_SECTIONS
@@ -885,12 +883,10 @@ static void check_section(const char *modname, struct elf_info *elf,
885#define TEXT_SECTIONS ".text$" 883#define TEXT_SECTIONS ".text$"
886 884
887#define INIT_SECTIONS ".init.*" 885#define INIT_SECTIONS ".init.*"
888#define DEV_INIT_SECTIONS ".devinit.*"
889#define CPU_INIT_SECTIONS ".cpuinit.*" 886#define CPU_INIT_SECTIONS ".cpuinit.*"
890#define MEM_INIT_SECTIONS ".meminit.*" 887#define MEM_INIT_SECTIONS ".meminit.*"
891 888
892#define EXIT_SECTIONS ".exit.*" 889#define EXIT_SECTIONS ".exit.*"
893#define DEV_EXIT_SECTIONS ".devexit.*"
894#define CPU_EXIT_SECTIONS ".cpuexit.*" 890#define CPU_EXIT_SECTIONS ".cpuexit.*"
895#define MEM_EXIT_SECTIONS ".memexit.*" 891#define MEM_EXIT_SECTIONS ".memexit.*"
896 892
@@ -979,7 +975,7 @@ const struct sectioncheck sectioncheck[] = {
979 .mismatch = DATA_TO_ANY_EXIT, 975 .mismatch = DATA_TO_ANY_EXIT,
980 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, 976 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL },
981}, 977},
982/* Do not reference init code/data from devinit/cpuinit/meminit code/data */ 978/* Do not reference init code/data from cpuinit/meminit code/data */
983{ 979{
984 .fromsec = { ALL_XXXINIT_SECTIONS, NULL }, 980 .fromsec = { ALL_XXXINIT_SECTIONS, NULL },
985 .tosec = { INIT_SECTIONS, NULL }, 981 .tosec = { INIT_SECTIONS, NULL },
@@ -1000,7 +996,7 @@ const struct sectioncheck sectioncheck[] = {
1000 .mismatch = XXXINIT_TO_SOME_INIT, 996 .mismatch = XXXINIT_TO_SOME_INIT,
1001 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, 997 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL },
1002}, 998},
1003/* Do not reference exit code/data from devexit/cpuexit/memexit code/data */ 999/* Do not reference exit code/data from cpuexit/memexit code/data */
1004{ 1000{
1005 .fromsec = { ALL_XXXEXIT_SECTIONS, NULL }, 1001 .fromsec = { ALL_XXXEXIT_SECTIONS, NULL },
1006 .tosec = { EXIT_SECTIONS, NULL }, 1002 .tosec = { EXIT_SECTIONS, NULL },
@@ -1089,7 +1085,7 @@ static const struct sectioncheck *section_mismatch(
1089 * Pattern 2: 1085 * Pattern 2:
1090 * Many drivers utilise a *driver container with references to 1086 * Many drivers utilise a *driver container with references to
1091 * add, remove, probe functions etc. 1087 * add, remove, probe functions etc.
1092 * These functions may often be marked __devinit and we do not want to 1088 * These functions may often be marked __cpuinit and we do not want to
1093 * warn here. 1089 * warn here.
1094 * the pattern is identified by: 1090 * the pattern is identified by:
1095 * tosec = init or exit section 1091 * tosec = init or exit section
diff --git a/scripts/pnmtologo.c b/scripts/pnmtologo.c
index 5c113123ed9f..68bb4efc5af4 100644
--- a/scripts/pnmtologo.c
+++ b/scripts/pnmtologo.c
@@ -74,6 +74,7 @@ static unsigned int logo_height;
74static struct color **logo_data; 74static struct color **logo_data;
75static struct color logo_clut[MAX_LINUX_LOGO_COLORS]; 75static struct color logo_clut[MAX_LINUX_LOGO_COLORS];
76static unsigned int logo_clutsize; 76static unsigned int logo_clutsize;
77static int is_plain_pbm = 0;
77 78
78static void die(const char *fmt, ...) 79static void die(const char *fmt, ...)
79 __attribute__ ((noreturn)) __attribute ((format (printf, 1, 2))); 80 __attribute__ ((noreturn)) __attribute ((format (printf, 1, 2)));
@@ -103,6 +104,11 @@ static unsigned int get_number(FILE *fp)
103 val = 0; 104 val = 0;
104 while (isdigit(c)) { 105 while (isdigit(c)) {
105 val = 10*val+c-'0'; 106 val = 10*val+c-'0';
107 /* some PBM are 'broken'; GiMP for example exports a PBM without space
108 * between the digits. This is Ok cause we know a PBM can only have a '1'
109 * or a '0' for the digit. */
110 if (is_plain_pbm)
111 break;
106 c = fgetc(fp); 112 c = fgetc(fp);
107 if (c == EOF) 113 if (c == EOF)
108 die("%s: end of file\n", filename); 114 die("%s: end of file\n", filename);
@@ -167,6 +173,7 @@ static void read_image(void)
167 switch (magic) { 173 switch (magic) {
168 case '1': 174 case '1':
169 /* Plain PBM */ 175 /* Plain PBM */
176 is_plain_pbm = 1;
170 for (i = 0; i < logo_height; i++) 177 for (i = 0; i < logo_height; i++)
171 for (j = 0; j < logo_width; j++) 178 for (j = 0; j < logo_width; j++)
172 logo_data[i][j].red = logo_data[i][j].green = 179 logo_data[i][j].red = logo_data[i][j].green =
diff --git a/scripts/sortextable.c b/scripts/sortextable.c
index f19ddc47304c..1f10e89d15b4 100644
--- a/scripts/sortextable.c
+++ b/scripts/sortextable.c
@@ -248,6 +248,7 @@ do_file(char const *const fname)
248 case EM_S390: 248 case EM_S390:
249 custom_sort = sort_relative_table; 249 custom_sort = sort_relative_table;
250 break; 250 break;
251 case EM_ARM:
251 case EM_MIPS: 252 case EM_MIPS:
252 break; 253 break;
253 } /* end switch */ 254 } /* end switch */
diff --git a/scripts/tags.sh b/scripts/tags.sh
index 79fdafb0d263..08f06c00745e 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -48,13 +48,14 @@ find_arch_sources()
48 for i in $archincludedir; do 48 for i in $archincludedir; do
49 prune="$prune -wholename $i -prune -o" 49 prune="$prune -wholename $i -prune -o"
50 done 50 done
51 find ${tree}arch/$1 $ignore $prune -name "$2" -print; 51 find ${tree}arch/$1 $ignore $subarchprune $prune -name "$2" -print;
52} 52}
53 53
54# find sources in arch/$1/include 54# find sources in arch/$1/include
55find_arch_include_sources() 55find_arch_include_sources()
56{ 56{
57 include=$(find ${tree}arch/$1/ -name include -type d); 57 include=$(find ${tree}arch/$1/ $subarchprune \
58 -name include -type d -print);
58 if [ -n "$include" ]; then 59 if [ -n "$include" ]; then
59 archincludedir="$archincludedir $include" 60 archincludedir="$archincludedir $include"
60 find $include $ignore -name "$2" -print; 61 find $include $ignore -name "$2" -print;
@@ -95,6 +96,32 @@ all_sources()
95 find_other_sources '*.[chS]' 96 find_other_sources '*.[chS]'
96} 97}
97 98
99all_compiled_sources()
100{
101 for i in $(all_sources); do
102 case "$i" in
103 *.[cS])
104 j=${i/\.[cS]/\.o}
105 if [ -e $j ]; then
106 echo $i
107 fi
108 ;;
109 *)
110 echo $i
111 ;;
112 esac
113 done
114}
115
116all_target_sources()
117{
118 if [ -n "$COMPILED_SOURCE" ]; then
119 all_compiled_sources
120 else
121 all_sources
122 fi
123}
124
98all_kconfigs() 125all_kconfigs()
99{ 126{
100 for arch in $ALLSOURCE_ARCHS; do 127 for arch in $ALLSOURCE_ARCHS; do
@@ -110,18 +137,18 @@ all_defconfigs()
110 137
111docscope() 138docscope()
112{ 139{
113 (echo \-k; echo \-q; all_sources) > cscope.files 140 (echo \-k; echo \-q; all_target_sources) > cscope.files
114 cscope -b -f cscope.out 141 cscope -b -f cscope.out
115} 142}
116 143
117dogtags() 144dogtags()
118{ 145{
119 all_sources | gtags -i -f - 146 all_target_sources | gtags -i -f -
120} 147}
121 148
122exuberant() 149exuberant()
123{ 150{
124 all_sources | xargs $1 -a \ 151 all_target_sources | xargs $1 -a \
125 -I __initdata,__exitdata,__acquires,__releases \ 152 -I __initdata,__exitdata,__acquires,__releases \
126 -I __read_mostly,____cacheline_aligned \ 153 -I __read_mostly,____cacheline_aligned \
127 -I ____cacheline_aligned_in_smp \ 154 -I ____cacheline_aligned_in_smp \
@@ -173,7 +200,7 @@ exuberant()
173 200
174emacs() 201emacs()
175{ 202{
176 all_sources | xargs $1 -a \ 203 all_target_sources | xargs $1 -a \
177 --regex='/^(ENTRY|_GLOBAL)(\([^)]*\)).*/\2/' \ 204 --regex='/^(ENTRY|_GLOBAL)(\([^)]*\)).*/\2/' \
178 --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' \ 205 --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' \
179 --regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \ 206 --regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \
@@ -220,11 +247,10 @@ xtags()
220 elif $1 --version 2>&1 | grep -iq emacs; then 247 elif $1 --version 2>&1 | grep -iq emacs; then
221 emacs $1 248 emacs $1
222 else 249 else
223 all_sources | xargs $1 -a 250 all_target_sources | xargs $1 -a
224 fi 251 fi
225} 252}
226 253
227
228# Support um (which uses SUBARCH) 254# Support um (which uses SUBARCH)
229if [ "${ARCH}" = "um" ]; then 255if [ "${ARCH}" = "um" ]; then
230 if [ "$SUBARCH" = "i386" ]; then 256 if [ "$SUBARCH" = "i386" ]; then
@@ -234,6 +260,21 @@ if [ "${ARCH}" = "um" ]; then
234 else 260 else
235 archinclude=${SUBARCH} 261 archinclude=${SUBARCH}
236 fi 262 fi
263elif [ "${SRCARCH}" = "arm" -a "${SUBARCH}" != "" ]; then
264 subarchdir=$(find ${tree}arch/$SRCARCH/ -name "mach-*" -type d -o \
265 -name "plat-*" -type d);
266 for i in $subarchdir; do
267 case "$i" in
268 *"mach-"${SUBARCH})
269 ;;
270 *"plat-"${SUBARCH})
271 ;;
272 *)
273 subarchprune="$subarchprune \
274 -wholename $i -prune -o"
275 ;;
276 esac
277 done
237fi 278fi
238 279
239remove_structs= 280remove_structs=