diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.lib | 3 | ||||
-rw-r--r-- | scripts/Makefile.modinst | 3 | ||||
-rw-r--r-- | scripts/Makefile.modsign | 32 | ||||
-rwxr-xr-x | scripts/checkpatch.pl | 156 | ||||
-rw-r--r-- | scripts/coccinelle/api/d_find_alias.cocci | 80 | ||||
-rw-r--r-- | scripts/coccinelle/misc/warn.cocci | 109 | ||||
-rwxr-xr-x | scripts/config | 1 | ||||
-rw-r--r-- | scripts/dtc/Makefile | 2 | ||||
-rw-r--r-- | scripts/headers_install.pl | 3 | ||||
-rw-r--r-- | scripts/kconfig/expr.h | 5 | ||||
-rw-r--r-- | scripts/kconfig/list.h | 91 | ||||
-rw-r--r-- | scripts/kconfig/lkc_proto.h | 4 | ||||
-rw-r--r-- | scripts/kconfig/mconf.c | 6 | ||||
-rw-r--r-- | scripts/kconfig/menu.c | 14 | ||||
-rwxr-xr-x | scripts/kernel-doc | 1 | ||||
-rw-r--r-- | scripts/mod/modpost.c | 24 | ||||
-rw-r--r-- | scripts/pnmtologo.c | 7 | ||||
-rwxr-xr-x | scripts/sign-file | 6 | ||||
-rw-r--r-- | scripts/sortextable.c | 1 | ||||
-rwxr-xr-x | scripts/tags.sh | 57 |
20 files changed, 499 insertions, 106 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 | |||
266 | quiet_cmd_dtc = DTC $@ | 266 | quiet_cmd_dtc = DTC $@ |
267 | cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile) $< | 267 | cmd_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.modinst b/scripts/Makefile.modinst index dda4b2b61927..ecbb44797e28 100644 --- a/scripts/Makefile.modinst +++ b/scripts/Makefile.modinst | |||
@@ -16,8 +16,9 @@ PHONY += $(modules) | |||
16 | __modinst: $(modules) | 16 | __modinst: $(modules) |
17 | @: | 17 | @: |
18 | 18 | ||
19 | # Don't stop modules_install if we can't sign external modules. | ||
19 | quiet_cmd_modules_install = INSTALL $@ | 20 | quiet_cmd_modules_install = INSTALL $@ |
20 | cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@) ; $(mod_sign_cmd) $(2)/$(notdir $@) | 21 | cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@) ; $(mod_sign_cmd) $(2)/$(notdir $@) $(patsubst %,|| true,$(KBUILD_EXTMOD)) |
21 | 22 | ||
22 | # Modules built outside the kernel source tree go into extra by default | 23 | # Modules built outside the kernel source tree go into extra by default |
23 | INSTALL_MOD_DIR ?= extra | 24 | INSTALL_MOD_DIR ?= extra |
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 | |||
5 | PHONY := __modsign | ||
6 | __modsign: | ||
7 | |||
8 | include scripts/Kbuild.include | ||
9 | |||
10 | __modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) | ||
11 | modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o))) | ||
12 | |||
13 | PHONY += $(modules) | ||
14 | __modsign: $(modules) | ||
15 | @: | ||
16 | |||
17 | quiet_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 | ||
21 | INSTALL_MOD_DIR ?= extra | ||
22 | ext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(patsubst %/,%,$(KBUILD_EXTMOD)),,$(@D)) | ||
23 | |||
24 | modinst_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 21a9f5de0a21..4d2c7dfdaabd 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -33,6 +33,7 @@ my %ignore_type = (); | |||
33 | my @ignore = (); | 33 | my @ignore = (); |
34 | my $help = 0; | 34 | my $help = 0; |
35 | my $configuration_file = ".checkpatch.conf"; | 35 | my $configuration_file = ".checkpatch.conf"; |
36 | my $max_line_length = 80; | ||
36 | 37 | ||
37 | sub help { | 38 | sub 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}; | |||
227 | our $Member = qr{->$Ident|\.$Ident|\[[^]]*\]}; | 230 | our $Member = qr{->$Ident|\.$Ident|\[[^]]*\]}; |
228 | our $Lval = qr{$Ident(?:$Member)*}; | 231 | our $Lval = qr{$Ident(?:$Member)*}; |
229 | 232 | ||
230 | our $Constant = qr{(?i:(?:[0-9]+|0x[0-9a-f]+)[ul]*)}; | 233 | our $Float_hex = qr{(?i:0x[0-9a-f]+p-?[0-9]+[fl]?)}; |
234 | our $Float_dec = qr{(?i:((?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+)(?:e-?[0-9]+)?[fl]?))}; | ||
235 | our $Float_int = qr{(?i:[0-9]+e-?[0-9]+[fl]?)}; | ||
236 | our $Float = qr{$Float_hex|$Float_dec|$Float_int}; | ||
237 | our $Constant = qr{(?:$Float|(?i:(?:0x[0-9a-f]+|[0-9]+)[ul]*))}; | ||
231 | our $Assignment = qr{(?:\*\=|/=|%=|\+=|-=|<<=|>>=|&=|\^=|\|=|=)}; | 238 | our $Assignment = qr{(?:\*\=|/=|%=|\+=|-=|<<=|>>=|&=|\^=|\|=|=)}; |
232 | our $Compare = qr{<=|>=|==|!=|<|>}; | 239 | our $Compare = qr{<=|>=|==|!=|<|>}; |
233 | our $Operators = qr{ | 240 | our $Operators = qr{ |
@@ -352,27 +359,6 @@ sub deparenthesize { | |||
352 | 359 | ||
353 | $chk_signoff = 0 if ($file); | 360 | $chk_signoff = 0 if ($file); |
354 | 361 | ||
355 | my @dep_includes = (); | ||
356 | my @dep_functions = (); | ||
357 | my $removal = "Documentation/feature-removal-schedule.txt"; | ||
358 | if ($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 | |||
376 | my @rawlines = (); | 362 | my @rawlines = (); |
377 | my @lines = (); | 363 | my @lines = (); |
378 | my $vname; | 364 | my $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 |
@@ -1890,8 +1885,10 @@ sub process { | |||
1890 | } | 1885 | } |
1891 | 1886 | ||
1892 | if ($realfile =~ m@^(drivers/net/|net/)@ && | 1887 | if ($realfile =~ m@^(drivers/net/|net/)@ && |
1893 | $rawline !~ m@^\+[ \t]*(\/\*|\*\/)@ && | 1888 | $rawline !~ m@^\+[ \t]*\*/[ \t]*$@ && #trailing */ |
1894 | $rawline =~ m@^\+[ \t]*.+\*\/[ \t]*$@) { | 1889 | $rawline !~ m@^\+.*/\*.*\*/[ \t]*$@ && #inline /*...*/ |
1890 | $rawline !~ m@^\+.*\*{2,}/[ \t]*$@ && #trailing **/ | ||
1891 | $rawline =~ m@^\+[ \t]*.+\*\/[ \t]*$@) { #non blank */ | ||
1895 | WARN("NETWORKING_BLOCK_COMMENT_STYLE", | 1892 | WARN("NETWORKING_BLOCK_COMMENT_STYLE", |
1896 | "networking block comments put the trailing */ on a separate line\n" . $herecurr); | 1893 | "networking block comments put the trailing */ on a separate line\n" . $herecurr); |
1897 | } | 1894 | } |
@@ -1910,6 +1907,12 @@ sub process { | |||
1910 | # 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 |
1911 | next if ($realfile !~ /\.(h|c)$/); | 1908 | next if ($realfile !~ /\.(h|c)$/); |
1912 | 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 | |||
1913 | # check for RCS/CVS revision markers | 1916 | # check for RCS/CVS revision markers |
1914 | if ($rawline =~ /^\+.*\$(Revision|Log|Id)(?:\$|)/) { | 1917 | if ($rawline =~ /^\+.*\$(Revision|Log|Id)(?:\$|)/) { |
1915 | WARN("CVS_KEYWORD", | 1918 | WARN("CVS_KEYWORD", |
@@ -2223,8 +2226,11 @@ sub process { | |||
2223 | my $path = $1; | 2226 | my $path = $1; |
2224 | if ($path =~ m{//}) { | 2227 | if ($path =~ m{//}) { |
2225 | ERROR("MALFORMED_INCLUDE", | 2228 | ERROR("MALFORMED_INCLUDE", |
2226 | "malformed #include filename\n" . | 2229 | "malformed #include filename\n" . $herecurr); |
2227 | $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); | ||
2228 | } | 2234 | } |
2229 | } | 2235 | } |
2230 | 2236 | ||
@@ -2904,12 +2910,17 @@ sub process { | |||
2904 | } | 2910 | } |
2905 | } | 2911 | } |
2906 | 2912 | ||
2907 | #studly caps, commented out until figure out how to distinguish between use of existing and adding new | 2913 | #CamelCase |
2908 | # if (($line=~/[\w_][a-z\d]+[A-Z]/) and !($line=~/print/)) { | 2914 | while ($line =~ m{($Constant|$Lval)}g) { |
2909 | # print "No studly caps, use _\n"; | 2915 | my $var = $1; |
2910 | # print "$herecurr"; | 2916 | if ($var !~ /$Constant/ && |
2911 | # $clean = 0; | 2917 | $var =~ /[A-Z]\w*[a-z]|[a-z]\w*[A-Z]/ && |
2912 | # } | 2918 | !defined $camelcase{$var}) { |
2919 | $camelcase{$var} = 1; | ||
2920 | WARN("CAMELCASE", | ||
2921 | "Avoid CamelCase: <$var>\n" . $herecurr); | ||
2922 | } | ||
2923 | } | ||
2913 | 2924 | ||
2914 | #no spaces allowed after \ in define | 2925 | #no spaces allowed after \ in define |
2915 | if ($line=~/\#\s*define.*\\\s$/) { | 2926 | if ($line=~/\#\s*define.*\\\s$/) { |
@@ -3011,6 +3022,17 @@ sub process { | |||
3011 | "Macros with complex values should be enclosed in parenthesis\n" . "$herectx"); | 3022 | "Macros with complex values should be enclosed in parenthesis\n" . "$herectx"); |
3012 | } | 3023 | } |
3013 | } | 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 | } | ||
3014 | } | 3036 | } |
3015 | 3037 | ||
3016 | # do {} while (0) macro tests: | 3038 | # do {} while (0) macro tests: |
@@ -3181,20 +3203,14 @@ sub process { | |||
3181 | } | 3203 | } |
3182 | } | 3204 | } |
3183 | 3205 | ||
3184 | # don't include deprecated include files (uses RAW line) | 3206 | # check for unnecessary blank lines around braces |
3185 | for my $inc (@dep_includes) { | 3207 | if (($line =~ /^..*}\s*$/ && $prevline =~ /^.\s*$/)) { |
3186 | if ($rawline =~ m@^.\s*\#\s*include\s*\<$inc>@) { | 3208 | CHK("BRACES", |
3187 | ERROR("DEPRECATED_INCLUDE", | 3209 | "Blank lines aren't necessary before a close brace '}'\n" . $hereprev); |
3188 | "Don't use <$inc>: see Documentation/feature-removal-schedule.txt\n" . $herecurr); | ||
3189 | } | ||
3190 | } | 3210 | } |
3191 | 3211 | if (($line =~ /^.\s*$/ && $prevline =~ /^..*{\s*$/)) { | |
3192 | # don't use deprecated functions | 3212 | CHK("BRACES", |
3193 | for my $func (@dep_functions) { | 3213 | "Blank lines aren't necessary after an open brace '{'\n" . $hereprev); |
3194 | if ($line =~ /\b$func\b/) { | ||
3195 | ERROR("DEPRECATED_FUNCTION", | ||
3196 | "Don't use $func(): see Documentation/feature-removal-schedule.txt\n" . $herecurr); | ||
3197 | } | ||
3198 | } | 3214 | } |
3199 | 3215 | ||
3200 | # no volatiles please | 3216 | # no volatiles please |
@@ -3211,20 +3227,12 @@ sub process { | |||
3211 | $herecurr); | 3227 | $herecurr); |
3212 | } | 3228 | } |
3213 | 3229 | ||
3214 | # check for needless kfree() checks | 3230 | # check for needless "if (<foo>) fn(<foo>)" uses |
3215 | if ($prevline =~ /\bif\s*\(([^\)]*)\)/) { | 3231 | if ($prevline =~ /\bif\s*\(\s*($Lval)\s*\)/) { |
3216 | my $expr = $1; | 3232 | my $expr = '\s*\(\s*' . quotemeta($1) . '\s*\)\s*;'; |
3217 | if ($line =~ /\bkfree\(\Q$expr\E\);/) { | 3233 | if ($line =~ /\b(kfree|usb_free_urb|debugfs_remove(?:_recursive)?)$expr/) { |
3218 | WARN("NEEDLESS_KFREE", | 3234 | WARN('NEEDLESS_IF', |
3219 | "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); |
3220 | } | ||
3221 | } | ||
3222 | # check for needless usb_free_urb() checks | ||
3223 | if ($prevline =~ /\bif\s*\(([^\)]*)\)/) { | ||
3224 | my $expr = $1; | ||
3225 | if ($line =~ /\busb_free_urb\(\Q$expr\E\);/) { | ||
3226 | WARN("NEEDLESS_USB_FREE_URB", | ||
3227 | "usb_free_urb(NULL) is safe this check is probably not required\n" . $hereprev); | ||
3228 | } | 3236 | } |
3229 | } | 3237 | } |
3230 | 3238 | ||
@@ -3342,6 +3350,12 @@ sub process { | |||
3342 | "Avoid line continuations in quoted strings\n" . $herecurr); | 3350 | "Avoid line continuations in quoted strings\n" . $herecurr); |
3343 | } | 3351 | } |
3344 | 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 | |||
3345 | # Check for misused memsets | 3359 | # Check for misused memsets |
3346 | if ($^V && $^V ge 5.10.0 && | 3360 | if ($^V && $^V ge 5.10.0 && |
3347 | defined $stat && | 3361 | defined $stat && |
@@ -3448,8 +3462,22 @@ sub process { | |||
3448 | 3462 | ||
3449 | # check for multiple semicolons | 3463 | # check for multiple semicolons |
3450 | if ($line =~ /;\s*;\s*$/) { | 3464 | if ($line =~ /;\s*;\s*$/) { |
3451 | WARN("ONE_SEMICOLON", | 3465 | WARN("ONE_SEMICOLON", |
3452 | "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); | ||
3453 | } | 3481 | } |
3454 | 3482 | ||
3455 | # 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 | |||
9 | virtual context | ||
10 | virtual org | ||
11 | virtual patch | ||
12 | virtual report | ||
13 | |||
14 | @r exists@ | ||
15 | local idexpression struct dentry *dent; | ||
16 | expression E, E1; | ||
17 | statement S1, S2; | ||
18 | position 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 | ||
31 | if (!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@ | ||
44 | local idexpression struct dentry *r.dent; | ||
45 | position 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@ | ||
57 | p1 << r.p1; | ||
58 | p2 << r.p2; | ||
59 | @@ | ||
60 | cocci.print_main("Missing call to dput()",p1) | ||
61 | cocci.print_secs("",p2) | ||
62 | |||
63 | @depends on patch@ | ||
64 | local idexpression struct dentry *r.dent; | ||
65 | position 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@ | ||
76 | p1 << r.p1; | ||
77 | p2 << r.p2; | ||
78 | @@ | ||
79 | msg = "Missing call to dput() at line %s." | ||
80 | coccilib.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 | |||
10 | virtual patch | ||
11 | virtual context | ||
12 | virtual org | ||
13 | virtual report | ||
14 | |||
15 | @bad1@ | ||
16 | position p; | ||
17 | @@ | ||
18 | |||
19 | printk(...); | ||
20 | printk@p(...); | ||
21 | WARN_ON(1); | ||
22 | |||
23 | @r1 depends on context || report || org@ | ||
24 | position p != bad1.p; | ||
25 | @@ | ||
26 | |||
27 | printk@p(...); | ||
28 | *WARN_ON(1); | ||
29 | |||
30 | @script:python depends on org@ | ||
31 | p << r1.p; | ||
32 | @@ | ||
33 | |||
34 | cocci.print_main("printk + WARN_ON can be just WARN",p) | ||
35 | |||
36 | @script:python depends on report@ | ||
37 | p << r1.p; | ||
38 | @@ | ||
39 | |||
40 | msg = "SUGGESTION: printk + WARN_ON can be just WARN" | ||
41 | coccilib.report.print_report(p[0],msg) | ||
42 | |||
43 | @ok1 depends on patch@ | ||
44 | expression list es; | ||
45 | position p != bad1.p; | ||
46 | @@ | ||
47 | |||
48 | -printk@p( | ||
49 | +WARN(1, | ||
50 | es); | ||
51 | -WARN_ON(1); | ||
52 | |||
53 | @depends on patch@ | ||
54 | expression list ok1.es; | ||
55 | @@ | ||
56 | |||
57 | if (...) | ||
58 | - { | ||
59 | WARN(1,es); | ||
60 | - } | ||
61 | |||
62 | // -------------------------------------------------------------------- | ||
63 | |||
64 | @bad2@ | ||
65 | position p; | ||
66 | @@ | ||
67 | |||
68 | printk(...); | ||
69 | printk@p(...); | ||
70 | WARN_ON_ONCE(1); | ||
71 | |||
72 | @r2 depends on context || report || org@ | ||
73 | position p != bad1.p; | ||
74 | @@ | ||
75 | |||
76 | printk@p(...); | ||
77 | *WARN_ON_ONCE(1); | ||
78 | |||
79 | @script:python depends on org@ | ||
80 | p << r2.p; | ||
81 | @@ | ||
82 | |||
83 | cocci.print_main("printk + WARN_ON_ONCE can be just WARN_ONCE",p) | ||
84 | |||
85 | @script:python depends on report@ | ||
86 | p << r2.p; | ||
87 | @@ | ||
88 | |||
89 | msg = "SUGGESTION: printk + WARN_ON_ONCE can be just WARN_ONCE" | ||
90 | coccilib.report.print_report(p[0],msg) | ||
91 | |||
92 | @ok2 depends on patch@ | ||
93 | expression list es; | ||
94 | position p != bad2.p; | ||
95 | @@ | ||
96 | |||
97 | -printk@p( | ||
98 | +WARN_ONCE(1, | ||
99 | es); | ||
100 | -WARN_ON_ONCE(1); | ||
101 | |||
102 | @depends on patch@ | ||
103 | expression list ok2.es; | ||
104 | @@ | ||
105 | |||
106 | if (...) | ||
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 | ||
31 | clean-files := dtc-lexer.lex.c dtc-parser.tab.c dtc-parser.tab.h | ||
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl index 239d22d4207b..581ca99c96f2 100644 --- a/scripts/headers_install.pl +++ b/scripts/headers_install.pl | |||
@@ -42,6 +42,9 @@ foreach my $filename (@files) { | |||
42 | $line =~ s/(^|\s)(inline)\b/$1__$2__/g; | 42 | $line =~ s/(^|\s)(inline)\b/$1__$2__/g; |
43 | $line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g; | 43 | $line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g; |
44 | $line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g; | 44 | $line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g; |
45 | $line =~ s/#ifndef\s+_UAPI/#ifndef /; | ||
46 | $line =~ s/#define\s+_UAPI/#define /; | ||
47 | $line =~ s!#endif\s+/[*]\s*_UAPI!#endif /* !; | ||
45 | printf {$out} "%s", $line; | 48 | printf {$out} "%s", $line; |
46 | } | 49 | } |
47 | close $out; | 50 | close $out; |
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index bd2e09895553..cdd48600e02a 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h | |||
@@ -12,7 +12,7 @@ extern "C" { | |||
12 | 12 | ||
13 | #include <assert.h> | 13 | #include <assert.h> |
14 | #include <stdio.h> | 14 | #include <stdio.h> |
15 | #include <sys/queue.h> | 15 | #include "list.h" |
16 | #ifndef __cplusplus | 16 | #ifndef __cplusplus |
17 | #include <stdbool.h> | 17 | #include <stdbool.h> |
18 | #endif | 18 | #endif |
@@ -175,12 +175,11 @@ struct menu { | |||
175 | #define MENU_ROOT 0x0002 | 175 | #define MENU_ROOT 0x0002 |
176 | 176 | ||
177 | struct jump_key { | 177 | struct jump_key { |
178 | CIRCLEQ_ENTRY(jump_key) entries; | 178 | struct list_head entries; |
179 | size_t offset; | 179 | size_t offset; |
180 | struct menu *target; | 180 | struct menu *target; |
181 | int index; | 181 | int index; |
182 | }; | 182 | }; |
183 | CIRCLEQ_HEAD(jk_head, jump_key); | ||
184 | 183 | ||
185 | #define JUMP_NB 9 | 184 | #define JUMP_NB 9 |
186 | 185 | ||
diff --git a/scripts/kconfig/list.h b/scripts/kconfig/list.h new file mode 100644 index 000000000000..0ae730be5f49 --- /dev/null +++ b/scripts/kconfig/list.h | |||
@@ -0,0 +1,91 @@ | |||
1 | #ifndef LIST_H | ||
2 | #define LIST_H | ||
3 | |||
4 | /* | ||
5 | * Copied from include/linux/... | ||
6 | */ | ||
7 | |||
8 | #undef offsetof | ||
9 | #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) | ||
10 | |||
11 | /** | ||
12 | * container_of - cast a member of a structure out to the containing structure | ||
13 | * @ptr: the pointer to the member. | ||
14 | * @type: the type of the container struct this is embedded in. | ||
15 | * @member: the name of the member within the struct. | ||
16 | * | ||
17 | */ | ||
18 | #define container_of(ptr, type, member) ({ \ | ||
19 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ | ||
20 | (type *)( (char *)__mptr - offsetof(type,member) );}) | ||
21 | |||
22 | |||
23 | struct list_head { | ||
24 | struct list_head *next, *prev; | ||
25 | }; | ||
26 | |||
27 | |||
28 | #define LIST_HEAD_INIT(name) { &(name), &(name) } | ||
29 | |||
30 | #define LIST_HEAD(name) \ | ||
31 | struct list_head name = LIST_HEAD_INIT(name) | ||
32 | |||
33 | /** | ||
34 | * list_entry - get the struct for this entry | ||
35 | * @ptr: the &struct list_head pointer. | ||
36 | * @type: the type of the struct this is embedded in. | ||
37 | * @member: the name of the list_struct within the struct. | ||
38 | */ | ||
39 | #define list_entry(ptr, type, member) \ | ||
40 | container_of(ptr, type, member) | ||
41 | |||
42 | /** | ||
43 | * list_for_each_entry - iterate over list of given type | ||
44 | * @pos: the type * to use as a loop cursor. | ||
45 | * @head: the head for your list. | ||
46 | * @member: the name of the list_struct within the struct. | ||
47 | */ | ||
48 | #define list_for_each_entry(pos, head, member) \ | ||
49 | for (pos = list_entry((head)->next, typeof(*pos), member); \ | ||
50 | &pos->member != (head); \ | ||
51 | pos = list_entry(pos->member.next, typeof(*pos), member)) | ||
52 | |||
53 | /** | ||
54 | * list_empty - tests whether a list is empty | ||
55 | * @head: the list to test. | ||
56 | */ | ||
57 | static inline int list_empty(const struct list_head *head) | ||
58 | { | ||
59 | return head->next == head; | ||
60 | } | ||
61 | |||
62 | /* | ||
63 | * Insert a new entry between two known consecutive entries. | ||
64 | * | ||
65 | * This is only for internal list manipulation where we know | ||
66 | * the prev/next entries already! | ||
67 | */ | ||
68 | static inline void __list_add(struct list_head *_new, | ||
69 | struct list_head *prev, | ||
70 | struct list_head *next) | ||
71 | { | ||
72 | next->prev = _new; | ||
73 | _new->next = next; | ||
74 | _new->prev = prev; | ||
75 | prev->next = _new; | ||
76 | } | ||
77 | |||
78 | /** | ||
79 | * list_add_tail - add a new entry | ||
80 | * @new: new entry to be added | ||
81 | * @head: list head to add it before | ||
82 | * | ||
83 | * Insert a new entry before the specified head. | ||
84 | * This is useful for implementing queues. | ||
85 | */ | ||
86 | static inline void list_add_tail(struct list_head *_new, struct list_head *head) | ||
87 | { | ||
88 | __list_add(_new, head->prev, head); | ||
89 | } | ||
90 | |||
91 | #endif | ||
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index 1d1c08537f1e..ef1a7381f956 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h | |||
@@ -21,9 +21,9 @@ P(menu_get_root_menu,struct menu *,(struct menu *menu)); | |||
21 | P(menu_get_parent_menu,struct menu *,(struct menu *menu)); | 21 | P(menu_get_parent_menu,struct menu *,(struct menu *menu)); |
22 | P(menu_has_help,bool,(struct menu *menu)); | 22 | P(menu_has_help,bool,(struct menu *menu)); |
23 | P(menu_get_help,const char *,(struct menu *menu)); | 23 | P(menu_get_help,const char *,(struct menu *menu)); |
24 | P(get_symbol_str, void, (struct gstr *r, struct symbol *sym, struct jk_head | 24 | P(get_symbol_str, void, (struct gstr *r, struct symbol *sym, struct list_head |
25 | *head)); | 25 | *head)); |
26 | P(get_relations_str, struct gstr, (struct symbol **sym_arr, struct jk_head | 26 | P(get_relations_str, struct gstr, (struct symbol **sym_arr, struct list_head |
27 | *head)); | 27 | *head)); |
28 | P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help)); | 28 | P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help)); |
29 | 29 | ||
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 48f67448af7b..53975cf87608 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
@@ -312,7 +312,7 @@ static void set_config_filename(const char *config_filename) | |||
312 | 312 | ||
313 | 313 | ||
314 | struct search_data { | 314 | struct search_data { |
315 | struct jk_head *head; | 315 | struct list_head *head; |
316 | struct menu **targets; | 316 | struct menu **targets; |
317 | int *keys; | 317 | int *keys; |
318 | }; | 318 | }; |
@@ -323,7 +323,7 @@ static void update_text(char *buf, size_t start, size_t end, void *_data) | |||
323 | struct jump_key *pos; | 323 | struct jump_key *pos; |
324 | int k = 0; | 324 | int k = 0; |
325 | 325 | ||
326 | CIRCLEQ_FOREACH(pos, data->head, entries) { | 326 | list_for_each_entry(pos, data->head, entries) { |
327 | if (pos->offset >= start && pos->offset < end) { | 327 | if (pos->offset >= start && pos->offset < end) { |
328 | char header[4]; | 328 | char header[4]; |
329 | 329 | ||
@@ -375,7 +375,7 @@ again: | |||
375 | 375 | ||
376 | sym_arr = sym_re_search(dialog_input); | 376 | sym_arr = sym_re_search(dialog_input); |
377 | do { | 377 | do { |
378 | struct jk_head head = CIRCLEQ_HEAD_INITIALIZER(head); | 378 | LIST_HEAD(head); |
379 | struct menu *targets[JUMP_NB]; | 379 | struct menu *targets[JUMP_NB]; |
380 | int keys[JUMP_NB + 1], i; | 380 | int keys[JUMP_NB + 1], i; |
381 | struct search_data data = { | 381 | struct search_data data = { |
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index a3cade659f89..e98a05c8e508 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c | |||
@@ -508,7 +508,7 @@ const char *menu_get_help(struct menu *menu) | |||
508 | } | 508 | } |
509 | 509 | ||
510 | static void get_prompt_str(struct gstr *r, struct property *prop, | 510 | static void get_prompt_str(struct gstr *r, struct property *prop, |
511 | struct jk_head *head) | 511 | struct list_head *head) |
512 | { | 512 | { |
513 | int i, j; | 513 | int i, j; |
514 | struct menu *submenu[8], *menu, *location = NULL; | 514 | struct menu *submenu[8], *menu, *location = NULL; |
@@ -544,12 +544,13 @@ static void get_prompt_str(struct gstr *r, struct property *prop, | |||
544 | } else | 544 | } else |
545 | jump->target = location; | 545 | jump->target = location; |
546 | 546 | ||
547 | if (CIRCLEQ_EMPTY(head)) | 547 | if (list_empty(head)) |
548 | jump->index = 0; | 548 | jump->index = 0; |
549 | else | 549 | else |
550 | jump->index = CIRCLEQ_LAST(head)->index + 1; | 550 | jump->index = list_entry(head->prev, struct jump_key, |
551 | entries)->index + 1; | ||
551 | 552 | ||
552 | CIRCLEQ_INSERT_TAIL(head, jump, entries); | 553 | list_add_tail(&jump->entries, head); |
553 | } | 554 | } |
554 | 555 | ||
555 | if (i > 0) { | 556 | if (i > 0) { |
@@ -573,7 +574,8 @@ static void get_prompt_str(struct gstr *r, struct property *prop, | |||
573 | /* | 574 | /* |
574 | * head is optional and may be NULL | 575 | * head is optional and may be NULL |
575 | */ | 576 | */ |
576 | void get_symbol_str(struct gstr *r, struct symbol *sym, struct jk_head *head) | 577 | void get_symbol_str(struct gstr *r, struct symbol *sym, |
578 | struct list_head *head) | ||
577 | { | 579 | { |
578 | bool hit; | 580 | bool hit; |
579 | struct property *prop; | 581 | struct property *prop; |
@@ -612,7 +614,7 @@ void get_symbol_str(struct gstr *r, struct symbol *sym, struct jk_head *head) | |||
612 | str_append(r, "\n\n"); | 614 | str_append(r, "\n\n"); |
613 | } | 615 | } |
614 | 616 | ||
615 | struct gstr get_relations_str(struct symbol **sym_arr, struct jk_head *head) | 617 | struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head) |
616 | { | 618 | { |
617 | struct symbol *sym; | 619 | struct symbol *sym; |
618 | struct gstr res = str_new(); | 620 | struct gstr res = str_new(); |
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 28b761567815..f565536a2bef 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
@@ -2079,7 +2079,6 @@ sub dump_function($$) { | |||
2079 | $prototype =~ s/^__inline +//; | 2079 | $prototype =~ s/^__inline +//; |
2080 | $prototype =~ s/^__always_inline +//; | 2080 | $prototype =~ s/^__always_inline +//; |
2081 | $prototype =~ s/^noinline +//; | 2081 | $prototype =~ s/^noinline +//; |
2082 | $prototype =~ s/__devinit +//; | ||
2083 | $prototype =~ s/__init +//; | 2082 | $prototype =~ s/__init +//; |
2084 | $prototype =~ s/__init_or_module +//; | 2083 | $prototype =~ s/__init_or_module +//; |
2085 | $prototype =~ s/__must_check +//; | 2084 | $prototype =~ s/__must_check +//; |
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; | |||
74 | static struct color **logo_data; | 74 | static struct color **logo_data; |
75 | static struct color logo_clut[MAX_LINUX_LOGO_COLORS]; | 75 | static struct color logo_clut[MAX_LINUX_LOGO_COLORS]; |
76 | static unsigned int logo_clutsize; | 76 | static unsigned int logo_clutsize; |
77 | static int is_plain_pbm = 0; | ||
77 | 78 | ||
78 | static void die(const char *fmt, ...) | 79 | static 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/sign-file b/scripts/sign-file index 87ca59d36e7e..974a20b661b7 100755 --- a/scripts/sign-file +++ b/scripts/sign-file | |||
@@ -156,12 +156,12 @@ sub asn1_extract($$@) | |||
156 | 156 | ||
157 | if ($l == 0x1) { | 157 | if ($l == 0x1) { |
158 | $len = unpack("C", substr(${$cursor->[2]}, $cursor->[0], 1)); | 158 | $len = unpack("C", substr(${$cursor->[2]}, $cursor->[0], 1)); |
159 | } elsif ($l = 0x2) { | 159 | } elsif ($l == 0x2) { |
160 | $len = unpack("n", substr(${$cursor->[2]}, $cursor->[0], 2)); | 160 | $len = unpack("n", substr(${$cursor->[2]}, $cursor->[0], 2)); |
161 | } elsif ($l = 0x3) { | 161 | } elsif ($l == 0x3) { |
162 | $len = unpack("C", substr(${$cursor->[2]}, $cursor->[0], 1)) << 16; | 162 | $len = unpack("C", substr(${$cursor->[2]}, $cursor->[0], 1)) << 16; |
163 | $len = unpack("n", substr(${$cursor->[2]}, $cursor->[0] + 1, 2)); | 163 | $len = unpack("n", substr(${$cursor->[2]}, $cursor->[0] + 1, 2)); |
164 | } elsif ($l = 0x4) { | 164 | } elsif ($l == 0x4) { |
165 | $len = unpack("N", substr(${$cursor->[2]}, $cursor->[0], 4)); | 165 | $len = unpack("N", substr(${$cursor->[2]}, $cursor->[0], 4)); |
166 | } else { | 166 | } else { |
167 | die $x509, ": ", $cursor->[0], ": ASN.1 element too long (", $l, ")\n"; | 167 | die $x509, ": ", $cursor->[0], ": ASN.1 element too long (", $l, ")\n"; |
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 |
55 | find_arch_include_sources() | 55 | find_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 | ||
99 | all_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 | |||
116 | all_target_sources() | ||
117 | { | ||
118 | if [ -n "$COMPILED_SOURCE" ]; then | ||
119 | all_compiled_sources | ||
120 | else | ||
121 | all_sources | ||
122 | fi | ||
123 | } | ||
124 | |||
98 | all_kconfigs() | 125 | all_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 | ||
111 | docscope() | 138 | docscope() |
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 | ||
117 | dogtags() | 144 | dogtags() |
118 | { | 145 | { |
119 | all_sources | gtags -i -f - | 146 | all_target_sources | gtags -i -f - |
120 | } | 147 | } |
121 | 148 | ||
122 | exuberant() | 149 | exuberant() |
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 | ||
174 | emacs() | 201 | emacs() |
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) |
229 | if [ "${ARCH}" = "um" ]; then | 255 | if [ "${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 |
263 | elif [ "${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 | ||
237 | fi | 278 | fi |
238 | 279 | ||
239 | remove_structs= | 280 | remove_structs= |