diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2015-01-12 04:51:13 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2015-01-12 04:51:13 -0500 |
commit | 2f5eaf66e580f64032b365a00157b6b58c266b37 (patch) | |
tree | 7852017c864f0eb3833782e2a017952bd8531458 /scripts | |
parent | c291ee622165cb2c8d4e7af63fffd499354a23be (diff) | |
parent | 91d1179212161f220938198b742c328ad38fd0a3 (diff) |
Merge tag 'irqchip-urgent-3.19' of git://git.infradead.org/users/jcooper/linux into irq/urgent
irqchip urgent fixes for v3.19 from Jason Cooper
- mtk-sysirq: Fix error handling
- hip04: Fix cpu map for 16bit value
- gic-v3-its: Clear a warning regarding decimal constants
- omap-intc: Fix legacy DMA regression
- atmel-aic-common: Retain priority when changing type
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Kbuild.include | 12 | ||||
-rw-r--r-- | scripts/Makefile.clean | 10 | ||||
-rw-r--r-- | scripts/Makefile.headersinst | 1 | ||||
-rw-r--r-- | scripts/checkkconfigsymbols.py | 139 | ||||
-rwxr-xr-x | scripts/checkkconfigsymbols.sh | 59 | ||||
-rwxr-xr-x | scripts/checkpatch.pl | 263 | ||||
-rw-r--r-- | scripts/coccinelle/api/platform_no_drv_owner.cocci | 106 | ||||
-rw-r--r-- | scripts/coccinelle/misc/bugon.cocci | 2 | ||||
-rwxr-xr-x | scripts/headers.sh | 2 | ||||
-rw-r--r-- | scripts/kconfig/list.h | 6 | ||||
-rw-r--r-- | scripts/kconfig/mconf.c | 4 | ||||
-rw-r--r-- | scripts/kconfig/menu.c | 4 | ||||
-rwxr-xr-x | scripts/kernel-doc | 2 | ||||
-rwxr-xr-x | scripts/package/mkspec | 4 | ||||
-rw-r--r-- | scripts/recordmcount.c | 2 | ||||
-rwxr-xr-x | scripts/recordmcount.pl | 2 |
16 files changed, 465 insertions, 153 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 5374b1bdf02f..edd2794569db 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
@@ -185,6 +185,18 @@ modbuiltin := -f $(srctree)/scripts/Makefile.modbuiltin obj | |||
185 | # $(Q)$(MAKE) $(dtbinst)=dir | 185 | # $(Q)$(MAKE) $(dtbinst)=dir |
186 | dtbinst := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.dtbinst obj | 186 | dtbinst := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.dtbinst obj |
187 | 187 | ||
188 | ### | ||
189 | # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj= | ||
190 | # Usage: | ||
191 | # $(Q)$(MAKE) $(clean)=dir | ||
192 | clean := -f $(srctree)/scripts/Makefile.clean obj | ||
193 | |||
194 | ### | ||
195 | # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.headersinst obj= | ||
196 | # Usage: | ||
197 | # $(Q)$(MAKE) $(hdr-inst)=dir | ||
198 | hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj | ||
199 | |||
188 | # Prefix -I with $(srctree) if it is not an absolute path. | 200 | # Prefix -I with $(srctree) if it is not an absolute path. |
189 | # skip if -I has no parameter | 201 | # skip if -I has no parameter |
190 | addtree = $(if $(patsubst -I%,%,$(1)), \ | 202 | addtree = $(if $(patsubst -I%,%,$(1)), \ |
diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean index b1c668dc6815..1bca180db8ad 100644 --- a/scripts/Makefile.clean +++ b/scripts/Makefile.clean | |||
@@ -7,10 +7,7 @@ src := $(obj) | |||
7 | PHONY := __clean | 7 | PHONY := __clean |
8 | __clean: | 8 | __clean: |
9 | 9 | ||
10 | # Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir | 10 | include scripts/Kbuild.include |
11 | # Usage: | ||
12 | # $(Q)$(MAKE) $(clean)=dir | ||
13 | clean := -f $(srctree)/scripts/Makefile.clean obj | ||
14 | 11 | ||
15 | # The filename Kbuild has precedence over Makefile | 12 | # The filename Kbuild has precedence over Makefile |
16 | kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) | 13 | kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) |
@@ -91,11 +88,6 @@ PHONY += $(subdir-ymn) | |||
91 | $(subdir-ymn): | 88 | $(subdir-ymn): |
92 | $(Q)$(MAKE) $(clean)=$@ | 89 | $(Q)$(MAKE) $(clean)=$@ |
93 | 90 | ||
94 | # If quiet is set, only print short version of command | ||
95 | |||
96 | cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1)) | ||
97 | |||
98 | |||
99 | # Declare the contents of the .PHONY variable as phony. We keep that | 91 | # Declare the contents of the .PHONY variable as phony. We keep that |
100 | # information in a variable se we can use it in if_changed and friends. | 92 | # information in a variable se we can use it in if_changed and friends. |
101 | 93 | ||
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index 8ccf83056a7a..1106d6ca3a38 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst | |||
@@ -122,7 +122,6 @@ $(check-file): scripts/headers_check.pl $(output-files) FORCE | |||
122 | endif | 122 | endif |
123 | 123 | ||
124 | # Recursion | 124 | # Recursion |
125 | hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj | ||
126 | .PHONY: $(subdirs) | 125 | .PHONY: $(subdirs) |
127 | $(subdirs): | 126 | $(subdirs): |
128 | $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(_dst)/$@ | 127 | $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(_dst)/$@ |
diff --git a/scripts/checkkconfigsymbols.py b/scripts/checkkconfigsymbols.py new file mode 100644 index 000000000000..e9cc689033fe --- /dev/null +++ b/scripts/checkkconfigsymbols.py | |||
@@ -0,0 +1,139 @@ | |||
1 | #!/usr/bin/env python | ||
2 | |||
3 | """Find Kconfig identifiers that are referenced but not defined.""" | ||
4 | |||
5 | # (c) 2014 Valentin Rothberg <valentinrothberg@gmail.com> | ||
6 | # (c) 2014 Stefan Hengelein <stefan.hengelein@fau.de> | ||
7 | # | ||
8 | # Licensed under the terms of the GNU GPL License version 2 | ||
9 | |||
10 | |||
11 | import os | ||
12 | import re | ||
13 | from subprocess import Popen, PIPE, STDOUT | ||
14 | |||
15 | |||
16 | # regex expressions | ||
17 | OPERATORS = r"&|\(|\)|\||\!" | ||
18 | FEATURE = r"(?:\w*[A-Z0-9]\w*){2,}" | ||
19 | DEF = r"^\s*(?:menu){,1}config\s+(" + FEATURE + r")\s*" | ||
20 | EXPR = r"(?:" + OPERATORS + r"|\s|" + FEATURE + r")+" | ||
21 | STMT = r"^\s*(?:if|select|depends\s+on)\s+" + EXPR | ||
22 | SOURCE_FEATURE = r"(?:\W|\b)+[D]{,1}CONFIG_(" + FEATURE + r")" | ||
23 | |||
24 | # regex objects | ||
25 | REGEX_FILE_KCONFIG = re.compile(r".*Kconfig[\.\w+\-]*$") | ||
26 | REGEX_FEATURE = re.compile(r"(" + FEATURE + r")") | ||
27 | REGEX_SOURCE_FEATURE = re.compile(SOURCE_FEATURE) | ||
28 | REGEX_KCONFIG_DEF = re.compile(DEF) | ||
29 | REGEX_KCONFIG_EXPR = re.compile(EXPR) | ||
30 | REGEX_KCONFIG_STMT = re.compile(STMT) | ||
31 | REGEX_KCONFIG_HELP = re.compile(r"^\s+(help|---help---)\s*$") | ||
32 | REGEX_FILTER_FEATURES = re.compile(r"[A-Za-z0-9]$") | ||
33 | |||
34 | |||
35 | def main(): | ||
36 | """Main function of this module.""" | ||
37 | source_files = [] | ||
38 | kconfig_files = [] | ||
39 | defined_features = set() | ||
40 | referenced_features = dict() # {feature: [files]} | ||
41 | |||
42 | # use 'git ls-files' to get the worklist | ||
43 | pop = Popen("git ls-files", stdout=PIPE, stderr=STDOUT, shell=True) | ||
44 | (stdout, _) = pop.communicate() # wait until finished | ||
45 | if len(stdout) > 0 and stdout[-1] == "\n": | ||
46 | stdout = stdout[:-1] | ||
47 | |||
48 | for gitfile in stdout.rsplit("\n"): | ||
49 | if ".git" in gitfile or "ChangeLog" in gitfile or \ | ||
50 | ".log" in gitfile or os.path.isdir(gitfile): | ||
51 | continue | ||
52 | if REGEX_FILE_KCONFIG.match(gitfile): | ||
53 | kconfig_files.append(gitfile) | ||
54 | else: | ||
55 | # all non-Kconfig files are checked for consistency | ||
56 | source_files.append(gitfile) | ||
57 | |||
58 | for sfile in source_files: | ||
59 | parse_source_file(sfile, referenced_features) | ||
60 | |||
61 | for kfile in kconfig_files: | ||
62 | parse_kconfig_file(kfile, defined_features, referenced_features) | ||
63 | |||
64 | print "Undefined symbol used\tFile list" | ||
65 | for feature in sorted(referenced_features): | ||
66 | # filter some false positives | ||
67 | if feature == "FOO" or feature == "BAR" or \ | ||
68 | feature == "FOO_BAR" or feature == "XXX": | ||
69 | continue | ||
70 | if feature not in defined_features: | ||
71 | if feature.endswith("_MODULE"): | ||
72 | # avoid false positives for kernel modules | ||
73 | if feature[:-len("_MODULE")] in defined_features: | ||
74 | continue | ||
75 | files = referenced_features.get(feature) | ||
76 | print "%s\t%s" % (feature, ", ".join(files)) | ||
77 | |||
78 | |||
79 | def parse_source_file(sfile, referenced_features): | ||
80 | """Parse @sfile for referenced Kconfig features.""" | ||
81 | lines = [] | ||
82 | with open(sfile, "r") as stream: | ||
83 | lines = stream.readlines() | ||
84 | |||
85 | for line in lines: | ||
86 | if not "CONFIG_" in line: | ||
87 | continue | ||
88 | features = REGEX_SOURCE_FEATURE.findall(line) | ||
89 | for feature in features: | ||
90 | if not REGEX_FILTER_FEATURES.search(feature): | ||
91 | continue | ||
92 | sfiles = referenced_features.get(feature, set()) | ||
93 | sfiles.add(sfile) | ||
94 | referenced_features[feature] = sfiles | ||
95 | |||
96 | |||
97 | def get_features_in_line(line): | ||
98 | """Return mentioned Kconfig features in @line.""" | ||
99 | return REGEX_FEATURE.findall(line) | ||
100 | |||
101 | |||
102 | def parse_kconfig_file(kfile, defined_features, referenced_features): | ||
103 | """Parse @kfile and update feature definitions and references.""" | ||
104 | lines = [] | ||
105 | skip = False | ||
106 | |||
107 | with open(kfile, "r") as stream: | ||
108 | lines = stream.readlines() | ||
109 | |||
110 | for i in range(len(lines)): | ||
111 | line = lines[i] | ||
112 | line = line.strip('\n') | ||
113 | line = line.split("#")[0] # ignore comments | ||
114 | |||
115 | if REGEX_KCONFIG_DEF.match(line): | ||
116 | feature_def = REGEX_KCONFIG_DEF.findall(line) | ||
117 | defined_features.add(feature_def[0]) | ||
118 | skip = False | ||
119 | elif REGEX_KCONFIG_HELP.match(line): | ||
120 | skip = True | ||
121 | elif skip: | ||
122 | # ignore content of help messages | ||
123 | pass | ||
124 | elif REGEX_KCONFIG_STMT.match(line): | ||
125 | features = get_features_in_line(line) | ||
126 | # multi-line statements | ||
127 | while line.endswith("\\"): | ||
128 | i += 1 | ||
129 | line = lines[i] | ||
130 | line = line.strip('\n') | ||
131 | features.extend(get_features_in_line(line)) | ||
132 | for feature in set(features): | ||
133 | paths = referenced_features.get(feature, set()) | ||
134 | paths.add(kfile) | ||
135 | referenced_features[feature] = paths | ||
136 | |||
137 | |||
138 | if __name__ == "__main__": | ||
139 | main() | ||
diff --git a/scripts/checkkconfigsymbols.sh b/scripts/checkkconfigsymbols.sh deleted file mode 100755 index ccb3391882d1..000000000000 --- a/scripts/checkkconfigsymbols.sh +++ /dev/null | |||
@@ -1,59 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # Find Kconfig variables used in source code but never defined in Kconfig | ||
3 | # Copyright (C) 2007, Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> | ||
4 | |||
5 | # Tested with dash. | ||
6 | paths="$@" | ||
7 | [ -z "$paths" ] && paths=. | ||
8 | |||
9 | # Doing this once at the beginning saves a lot of time, on a cache-hot tree. | ||
10 | Kconfigs="`find . -name 'Kconfig' -o -name 'Kconfig*[^~]'`" | ||
11 | |||
12 | printf "File list \tundefined symbol used\n" | ||
13 | find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while read i | ||
14 | do | ||
15 | # Output the bare Kconfig variable and the filename; the _MODULE part at | ||
16 | # the end is not removed here (would need perl an not-hungry regexp for that). | ||
17 | sed -ne 's!^.*\<\(UML_\)\?CONFIG_\([0-9A-Za-z_]\+\).*!\2 '$i'!p' < $i | ||
18 | done | \ | ||
19 | # Smart "sort|uniq" implemented in awk and tuned to collect the names of all | ||
20 | # files which use a given symbol | ||
21 | awk '{map[$1, count[$1]++] = $2; } | ||
22 | END { | ||
23 | for (combIdx in map) { | ||
24 | split(combIdx, separate, SUBSEP); | ||
25 | # The value may have been removed. | ||
26 | if (! ( (separate[1], separate[2]) in map ) ) | ||
27 | continue; | ||
28 | symb=separate[1]; | ||
29 | printf "%s ", symb; | ||
30 | #Use gawk extension to delete the names vector | ||
31 | delete names; | ||
32 | #Portably delete the names vector | ||
33 | #split("", names); | ||
34 | for (i=0; i < count[symb]; i++) { | ||
35 | names[map[symb, i]] = 1; | ||
36 | # Unfortunately, we may still encounter symb, i in the | ||
37 | # outside iteration. | ||
38 | delete map[symb, i]; | ||
39 | } | ||
40 | i=0; | ||
41 | for (name in names) { | ||
42 | if (i > 0) | ||
43 | printf ", %s", name; | ||
44 | else | ||
45 | printf "%s", name; | ||
46 | i++; | ||
47 | } | ||
48 | printf "\n"; | ||
49 | } | ||
50 | }' | | ||
51 | while read symb files; do | ||
52 | # Remove the _MODULE suffix when checking the variable name. This should | ||
53 | # be done only on tristate symbols, actually, but Kconfig parsing is | ||
54 | # beyond the purpose of this script. | ||
55 | symb_bare=`echo $symb | sed -e 's/_MODULE//'` | ||
56 | if ! grep -q "\<$symb_bare\>" $Kconfigs; then | ||
57 | printf "$files: \t$symb\n" | ||
58 | fi | ||
59 | done|sort | ||
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 374abf443636..f0bb6d60c07b 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -7,10 +7,11 @@ | |||
7 | 7 | ||
8 | use strict; | 8 | use strict; |
9 | use POSIX; | 9 | use POSIX; |
10 | use File::Basename; | ||
11 | use Cwd 'abs_path'; | ||
10 | 12 | ||
11 | my $P = $0; | 13 | my $P = $0; |
12 | $P =~ s@(.*)/@@g; | 14 | my $D = dirname(abs_path($P)); |
13 | my $D = $1; | ||
14 | 15 | ||
15 | my $V = '0.32'; | 16 | my $V = '0.32'; |
16 | 17 | ||
@@ -438,26 +439,29 @@ our $allowed_asm_includes = qr{(?x: | |||
438 | 439 | ||
439 | # Load common spelling mistakes and build regular expression list. | 440 | # Load common spelling mistakes and build regular expression list. |
440 | my $misspellings; | 441 | my $misspellings; |
441 | my @spelling_list; | ||
442 | my %spelling_fix; | 442 | my %spelling_fix; |
443 | open(my $spelling, '<', $spelling_file) | ||
444 | or die "$P: Can't open $spelling_file for reading: $!\n"; | ||
445 | while (<$spelling>) { | ||
446 | my $line = $_; | ||
447 | 443 | ||
448 | $line =~ s/\s*\n?$//g; | 444 | if (open(my $spelling, '<', $spelling_file)) { |
449 | $line =~ s/^\s*//g; | 445 | my @spelling_list; |
446 | while (<$spelling>) { | ||
447 | my $line = $_; | ||
450 | 448 | ||
451 | next if ($line =~ m/^\s*#/); | 449 | $line =~ s/\s*\n?$//g; |
452 | next if ($line =~ m/^\s*$/); | 450 | $line =~ s/^\s*//g; |
453 | 451 | ||
454 | my ($suspect, $fix) = split(/\|\|/, $line); | 452 | next if ($line =~ m/^\s*#/); |
453 | next if ($line =~ m/^\s*$/); | ||
455 | 454 | ||
456 | push(@spelling_list, $suspect); | 455 | my ($suspect, $fix) = split(/\|\|/, $line); |
457 | $spelling_fix{$suspect} = $fix; | 456 | |
457 | push(@spelling_list, $suspect); | ||
458 | $spelling_fix{$suspect} = $fix; | ||
459 | } | ||
460 | close($spelling); | ||
461 | $misspellings = join("|", @spelling_list); | ||
462 | } else { | ||
463 | warn "No typos will be found - file '$spelling_file': $!\n"; | ||
458 | } | 464 | } |
459 | close($spelling); | ||
460 | $misspellings = join("|", @spelling_list); | ||
461 | 465 | ||
462 | sub build_types { | 466 | sub build_types { |
463 | my $mods = "(?x: \n" . join("|\n ", @modifierList) . "\n)"; | 467 | my $mods = "(?x: \n" . join("|\n ", @modifierList) . "\n)"; |
@@ -942,7 +946,7 @@ sub sanitise_line { | |||
942 | sub get_quoted_string { | 946 | sub get_quoted_string { |
943 | my ($line, $rawline) = @_; | 947 | my ($line, $rawline) = @_; |
944 | 948 | ||
945 | return "" if ($line !~ m/(\"[X]+\")/g); | 949 | return "" if ($line !~ m/(\"[X\t]+\")/g); |
946 | return substr($rawline, $-[0], $+[0] - $-[0]); | 950 | return substr($rawline, $-[0], $+[0] - $-[0]); |
947 | } | 951 | } |
948 | 952 | ||
@@ -1843,6 +1847,7 @@ sub process { | |||
1843 | my $non_utf8_charset = 0; | 1847 | my $non_utf8_charset = 0; |
1844 | 1848 | ||
1845 | my $last_blank_line = 0; | 1849 | my $last_blank_line = 0; |
1850 | my $last_coalesced_string_linenr = -1; | ||
1846 | 1851 | ||
1847 | our @report = (); | 1852 | our @report = (); |
1848 | our $cnt_lines = 0; | 1853 | our $cnt_lines = 0; |
@@ -2078,6 +2083,12 @@ sub process { | |||
2078 | $in_commit_log = 0; | 2083 | $in_commit_log = 0; |
2079 | } | 2084 | } |
2080 | 2085 | ||
2086 | # Check if MAINTAINERS is being updated. If so, there's probably no need to | ||
2087 | # emit the "does MAINTAINERS need updating?" message on file add/move/delete | ||
2088 | if ($line =~ /^\s*MAINTAINERS\s*\|/) { | ||
2089 | $reported_maintainer_file = 1; | ||
2090 | } | ||
2091 | |||
2081 | # Check signature styles | 2092 | # Check signature styles |
2082 | if (!$in_header_lines && | 2093 | if (!$in_header_lines && |
2083 | $line =~ /^(\s*)([a-z0-9_-]+by:|$signature_tags)(\s*)(.*)/i) { | 2094 | $line =~ /^(\s*)([a-z0-9_-]+by:|$signature_tags)(\s*)(.*)/i) { |
@@ -2246,7 +2257,7 @@ sub process { | |||
2246 | } | 2257 | } |
2247 | 2258 | ||
2248 | # Check for various typo / spelling mistakes | 2259 | # Check for various typo / spelling mistakes |
2249 | if ($in_commit_log || $line =~ /^\+/) { | 2260 | if (defined($misspellings) && ($in_commit_log || $line =~ /^\+/)) { |
2250 | while ($rawline =~ /(?:^|[^a-z@])($misspellings)(?:$|[^a-z@])/gi) { | 2261 | while ($rawline =~ /(?:^|[^a-z@])($misspellings)(?:$|[^a-z@])/gi) { |
2251 | my $typo = $1; | 2262 | my $typo = $1; |
2252 | my $typo_fix = $spelling_fix{lc($typo)}; | 2263 | my $typo_fix = $spelling_fix{lc($typo)}; |
@@ -2403,33 +2414,6 @@ sub process { | |||
2403 | "line over $max_line_length characters\n" . $herecurr); | 2414 | "line over $max_line_length characters\n" . $herecurr); |
2404 | } | 2415 | } |
2405 | 2416 | ||
2406 | # Check for user-visible strings broken across lines, which breaks the ability | ||
2407 | # to grep for the string. Make exceptions when the previous string ends in a | ||
2408 | # newline (multiple lines in one string constant) or '\t', '\r', ';', or '{' | ||
2409 | # (common in inline assembly) or is a octal \123 or hexadecimal \xaf value | ||
2410 | if ($line =~ /^\+\s*"/ && | ||
2411 | $prevline =~ /"\s*$/ && | ||
2412 | $prevrawline !~ /(?:\\(?:[ntr]|[0-7]{1,3}|x[0-9a-fA-F]{1,2})|;\s*|\{\s*)"\s*$/) { | ||
2413 | WARN("SPLIT_STRING", | ||
2414 | "quoted string split across lines\n" . $hereprev); | ||
2415 | } | ||
2416 | |||
2417 | # check for missing a space in a string concatination | ||
2418 | if ($prevrawline =~ /[^\\]\w"$/ && $rawline =~ /^\+[\t ]+"\w/) { | ||
2419 | WARN('MISSING_SPACE', | ||
2420 | "break quoted strings at a space character\n" . $hereprev); | ||
2421 | } | ||
2422 | |||
2423 | # check for spaces before a quoted newline | ||
2424 | if ($rawline =~ /^.*\".*\s\\n/) { | ||
2425 | if (WARN("QUOTED_WHITESPACE_BEFORE_NEWLINE", | ||
2426 | "unnecessary whitespace before a quoted newline\n" . $herecurr) && | ||
2427 | $fix) { | ||
2428 | $fixed[$fixlinenr] =~ s/^(\+.*\".*)\s+\\n/$1\\n/; | ||
2429 | } | ||
2430 | |||
2431 | } | ||
2432 | |||
2433 | # check for adding lines without a newline. | 2417 | # check for adding lines without a newline. |
2434 | if ($line =~ /^\+/ && defined $lines[$linenr] && $lines[$linenr] =~ /^\\ No newline at end of file/) { | 2418 | if ($line =~ /^\+/ && defined $lines[$linenr] && $lines[$linenr] =~ /^\\ No newline at end of file/) { |
2435 | WARN("MISSING_EOF_NEWLINE", | 2419 | WARN("MISSING_EOF_NEWLINE", |
@@ -2515,7 +2499,8 @@ sub process { | |||
2515 | } | 2499 | } |
2516 | } | 2500 | } |
2517 | 2501 | ||
2518 | if ($line =~ /^\+.*\(\s*$Type\s*\)[ \t]+(?!$Assignment|$Arithmetic|{)/) { | 2502 | if ($line =~ /^\+.*(\w+\s*)?\(\s*$Type\s*\)[ \t]+(?!$Assignment|$Arithmetic|[,;\({\[\<\>])/ && |
2503 | (!defined($1) || $1 !~ /sizeof\s*/)) { | ||
2519 | if (CHK("SPACING", | 2504 | if (CHK("SPACING", |
2520 | "No space is necessary after a cast\n" . $herecurr) && | 2505 | "No space is necessary after a cast\n" . $herecurr) && |
2521 | $fix) { | 2506 | $fix) { |
@@ -3563,14 +3548,33 @@ sub process { | |||
3563 | } | 3548 | } |
3564 | } | 3549 | } |
3565 | 3550 | ||
3566 | # , must have a space on the right. | 3551 | # , must not have a space before and must have a space on the right. |
3567 | } elsif ($op eq ',') { | 3552 | } elsif ($op eq ',') { |
3553 | my $rtrim_before = 0; | ||
3554 | my $space_after = 0; | ||
3555 | if ($ctx =~ /Wx./) { | ||
3556 | if (ERROR("SPACING", | ||
3557 | "space prohibited before that '$op' $at\n" . $hereptr)) { | ||
3558 | $line_fixed = 1; | ||
3559 | $rtrim_before = 1; | ||
3560 | } | ||
3561 | } | ||
3568 | if ($ctx !~ /.x[WEC]/ && $cc !~ /^}/) { | 3562 | if ($ctx !~ /.x[WEC]/ && $cc !~ /^}/) { |
3569 | if (ERROR("SPACING", | 3563 | if (ERROR("SPACING", |
3570 | "space required after that '$op' $at\n" . $hereptr)) { | 3564 | "space required after that '$op' $at\n" . $hereptr)) { |
3571 | $good = $fix_elements[$n] . trim($fix_elements[$n + 1]) . " "; | ||
3572 | $line_fixed = 1; | 3565 | $line_fixed = 1; |
3573 | $last_after = $n; | 3566 | $last_after = $n; |
3567 | $space_after = 1; | ||
3568 | } | ||
3569 | } | ||
3570 | if ($rtrim_before || $space_after) { | ||
3571 | if ($rtrim_before) { | ||
3572 | $good = rtrim($fix_elements[$n]) . trim($fix_elements[$n + 1]); | ||
3573 | } else { | ||
3574 | $good = $fix_elements[$n] . trim($fix_elements[$n + 1]); | ||
3575 | } | ||
3576 | if ($space_after) { | ||
3577 | $good .= " "; | ||
3574 | } | 3578 | } |
3575 | } | 3579 | } |
3576 | 3580 | ||
@@ -3814,9 +3818,27 @@ sub process { | |||
3814 | # ie: &(foo->bar) should be &foo->bar and *(foo->bar) should be *foo->bar | 3818 | # ie: &(foo->bar) should be &foo->bar and *(foo->bar) should be *foo->bar |
3815 | 3819 | ||
3816 | while ($line =~ /(?:[^&]&\s*|\*)\(\s*($Ident\s*(?:$Member\s*)+)\s*\)/g) { | 3820 | while ($line =~ /(?:[^&]&\s*|\*)\(\s*($Ident\s*(?:$Member\s*)+)\s*\)/g) { |
3817 | CHK("UNNECESSARY_PARENTHESES", | 3821 | my $var = $1; |
3818 | "Unnecessary parentheses around $1\n" . $herecurr); | 3822 | if (CHK("UNNECESSARY_PARENTHESES", |
3819 | } | 3823 | "Unnecessary parentheses around $var\n" . $herecurr) && |
3824 | $fix) { | ||
3825 | $fixed[$fixlinenr] =~ s/\(\s*\Q$var\E\s*\)/$var/; | ||
3826 | } | ||
3827 | } | ||
3828 | |||
3829 | # check for unnecessary parentheses around function pointer uses | ||
3830 | # ie: (foo->bar)(); should be foo->bar(); | ||
3831 | # but not "if (foo->bar) (" to avoid some false positives | ||
3832 | if ($line =~ /(\bif\s*|)(\(\s*$Ident\s*(?:$Member\s*)+\))[ \t]*\(/ && $1 !~ /^if/) { | ||
3833 | my $var = $2; | ||
3834 | if (CHK("UNNECESSARY_PARENTHESES", | ||
3835 | "Unnecessary parentheses around function pointer $var\n" . $herecurr) && | ||
3836 | $fix) { | ||
3837 | my $var2 = deparenthesize($var); | ||
3838 | $var2 =~ s/\s//g; | ||
3839 | $fixed[$fixlinenr] =~ s/\Q$var\E/$var2/; | ||
3840 | } | ||
3841 | } | ||
3820 | 3842 | ||
3821 | #goto labels aren't indented, allow a single space however | 3843 | #goto labels aren't indented, allow a single space however |
3822 | if ($line=~/^.\s+[A-Za-z\d_]+:(?![0-9]+)/ and | 3844 | if ($line=~/^.\s+[A-Za-z\d_]+:(?![0-9]+)/ and |
@@ -4056,7 +4078,9 @@ sub process { | |||
4056 | #Ignore Page<foo> variants | 4078 | #Ignore Page<foo> variants |
4057 | $var !~ /^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ && | 4079 | $var !~ /^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ && |
4058 | #Ignore SI style variants like nS, mV and dB (ie: max_uV, regulator_min_uA_show) | 4080 | #Ignore SI style variants like nS, mV and dB (ie: max_uV, regulator_min_uA_show) |
4059 | $var !~ /^(?:[a-z_]*?)_?[a-z][A-Z](?:_[a-z_]+)?$/) { | 4081 | $var !~ /^(?:[a-z_]*?)_?[a-z][A-Z](?:_[a-z_]+)?$/ && |
4082 | #Ignore some three character SI units explicitly, like MiB and KHz | ||
4083 | $var !~ /^(?:[a-z_]*?)_?(?:[KMGT]iB|[KMGT]?Hz)(?:_[a-z_]+)?$/) { | ||
4060 | while ($var =~ m{($Ident)}g) { | 4084 | while ($var =~ m{($Ident)}g) { |
4061 | my $word = $1; | 4085 | my $word = $1; |
4062 | next if ($word !~ /[A-Z][a-z]|[a-z][A-Z]/); | 4086 | next if ($word !~ /[A-Z][a-z]|[a-z][A-Z]/); |
@@ -4408,12 +4432,85 @@ sub process { | |||
4408 | "Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt\n" . $herecurr); | 4432 | "Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt\n" . $herecurr); |
4409 | } | 4433 | } |
4410 | 4434 | ||
4435 | # Check for user-visible strings broken across lines, which breaks the ability | ||
4436 | # to grep for the string. Make exceptions when the previous string ends in a | ||
4437 | # newline (multiple lines in one string constant) or '\t', '\r', ';', or '{' | ||
4438 | # (common in inline assembly) or is a octal \123 or hexadecimal \xaf value | ||
4439 | if ($line =~ /^\+\s*"[X\t]*"/ && | ||
4440 | $prevline =~ /"\s*$/ && | ||
4441 | $prevrawline !~ /(?:\\(?:[ntr]|[0-7]{1,3}|x[0-9a-fA-F]{1,2})|;\s*|\{\s*)"\s*$/) { | ||
4442 | if (WARN("SPLIT_STRING", | ||
4443 | "quoted string split across lines\n" . $hereprev) && | ||
4444 | $fix && | ||
4445 | $prevrawline =~ /^\+.*"\s*$/ && | ||
4446 | $last_coalesced_string_linenr != $linenr - 1) { | ||
4447 | my $extracted_string = get_quoted_string($line, $rawline); | ||
4448 | my $comma_close = ""; | ||
4449 | if ($rawline =~ /\Q$extracted_string\E(\s*\)\s*;\s*$|\s*,\s*)/) { | ||
4450 | $comma_close = $1; | ||
4451 | } | ||
4452 | |||
4453 | fix_delete_line($fixlinenr - 1, $prevrawline); | ||
4454 | fix_delete_line($fixlinenr, $rawline); | ||
4455 | my $fixedline = $prevrawline; | ||
4456 | $fixedline =~ s/"\s*$//; | ||
4457 | $fixedline .= substr($extracted_string, 1) . trim($comma_close); | ||
4458 | fix_insert_line($fixlinenr - 1, $fixedline); | ||
4459 | $fixedline = $rawline; | ||
4460 | $fixedline =~ s/\Q$extracted_string\E\Q$comma_close\E//; | ||
4461 | if ($fixedline !~ /\+\s*$/) { | ||
4462 | fix_insert_line($fixlinenr, $fixedline); | ||
4463 | } | ||
4464 | $last_coalesced_string_linenr = $linenr; | ||
4465 | } | ||
4466 | } | ||
4467 | |||
4468 | # check for missing a space in a string concatenation | ||
4469 | if ($prevrawline =~ /[^\\]\w"$/ && $rawline =~ /^\+[\t ]+"\w/) { | ||
4470 | WARN('MISSING_SPACE', | ||
4471 | "break quoted strings at a space character\n" . $hereprev); | ||
4472 | } | ||
4473 | |||
4474 | # check for spaces before a quoted newline | ||
4475 | if ($rawline =~ /^.*\".*\s\\n/) { | ||
4476 | if (WARN("QUOTED_WHITESPACE_BEFORE_NEWLINE", | ||
4477 | "unnecessary whitespace before a quoted newline\n" . $herecurr) && | ||
4478 | $fix) { | ||
4479 | $fixed[$fixlinenr] =~ s/^(\+.*\".*)\s+\\n/$1\\n/; | ||
4480 | } | ||
4481 | |||
4482 | } | ||
4483 | |||
4411 | # concatenated string without spaces between elements | 4484 | # concatenated string without spaces between elements |
4412 | if ($line =~ /"X+"[A-Z_]+/ || $line =~ /[A-Z_]+"X+"/) { | 4485 | if ($line =~ /"X+"[A-Z_]+/ || $line =~ /[A-Z_]+"X+"/) { |
4413 | CHK("CONCATENATED_STRING", | 4486 | CHK("CONCATENATED_STRING", |
4414 | "Concatenated strings should use spaces between elements\n" . $herecurr); | 4487 | "Concatenated strings should use spaces between elements\n" . $herecurr); |
4415 | } | 4488 | } |
4416 | 4489 | ||
4490 | # uncoalesced string fragments | ||
4491 | if ($line =~ /"X*"\s*"/) { | ||
4492 | WARN("STRING_FRAGMENTS", | ||
4493 | "Consecutive strings are generally better as a single string\n" . $herecurr); | ||
4494 | } | ||
4495 | |||
4496 | # check for %L{u,d,i} in strings | ||
4497 | my $string; | ||
4498 | while ($line =~ /(?:^|")([X\t]*)(?:"|$)/g) { | ||
4499 | $string = substr($rawline, $-[1], $+[1] - $-[1]); | ||
4500 | $string =~ s/%%/__/g; | ||
4501 | if ($string =~ /(?<!%)%L[udi]/) { | ||
4502 | WARN("PRINTF_L", | ||
4503 | "\%Ld/%Lu are not-standard C, use %lld/%llu\n" . $herecurr); | ||
4504 | last; | ||
4505 | } | ||
4506 | } | ||
4507 | |||
4508 | # check for line continuations in quoted strings with odd counts of " | ||
4509 | if ($rawline =~ /\\$/ && $rawline =~ tr/"/"/ % 2) { | ||
4510 | WARN("LINE_CONTINUATIONS", | ||
4511 | "Avoid line continuations in quoted strings\n" . $herecurr); | ||
4512 | } | ||
4513 | |||
4417 | # warn about #if 0 | 4514 | # warn about #if 0 |
4418 | if ($line =~ /^.\s*\#\s*if\s+0\b/) { | 4515 | if ($line =~ /^.\s*\#\s*if\s+0\b/) { |
4419 | CHK("REDUNDANT_CODE", | 4516 | CHK("REDUNDANT_CODE", |
@@ -4426,7 +4523,7 @@ sub process { | |||
4426 | my $expr = '\s*\(\s*' . quotemeta($1) . '\s*\)\s*;'; | 4523 | my $expr = '\s*\(\s*' . quotemeta($1) . '\s*\)\s*;'; |
4427 | if ($line =~ /\b(kfree|usb_free_urb|debugfs_remove(?:_recursive)?)$expr/) { | 4524 | if ($line =~ /\b(kfree|usb_free_urb|debugfs_remove(?:_recursive)?)$expr/) { |
4428 | WARN('NEEDLESS_IF', | 4525 | WARN('NEEDLESS_IF', |
4429 | "$1(NULL) is safe this check is probably not required\n" . $hereprev); | 4526 | "$1(NULL) is safe and this check is probably not required\n" . $hereprev); |
4430 | } | 4527 | } |
4431 | } | 4528 | } |
4432 | 4529 | ||
@@ -4458,6 +4555,28 @@ sub process { | |||
4458 | } | 4555 | } |
4459 | } | 4556 | } |
4460 | 4557 | ||
4558 | # check for mask then right shift without a parentheses | ||
4559 | if ($^V && $^V ge 5.10.0 && | ||
4560 | $line =~ /$LvalOrFunc\s*\&\s*($LvalOrFunc)\s*>>/ && | ||
4561 | $4 !~ /^\&/) { # $LvalOrFunc may be &foo, ignore if so | ||
4562 | WARN("MASK_THEN_SHIFT", | ||
4563 | "Possible precedence defect with mask then right shift - may need parentheses\n" . $herecurr); | ||
4564 | } | ||
4565 | |||
4566 | # check for pointer comparisons to NULL | ||
4567 | if ($^V && $^V ge 5.10.0) { | ||
4568 | while ($line =~ /\b$LvalOrFunc\s*(==|\!=)\s*NULL\b/g) { | ||
4569 | my $val = $1; | ||
4570 | my $equal = "!"; | ||
4571 | $equal = "" if ($4 eq "!="); | ||
4572 | if (CHK("COMPARISON_TO_NULL", | ||
4573 | "Comparison to NULL could be written \"${equal}${val}\"\n" . $herecurr) && | ||
4574 | $fix) { | ||
4575 | $fixed[$fixlinenr] =~ s/\b\Q$val\E\s*(?:==|\!=)\s*NULL\b/$equal$val/; | ||
4576 | } | ||
4577 | } | ||
4578 | } | ||
4579 | |||
4461 | # check for bad placement of section $InitAttribute (e.g.: __initdata) | 4580 | # check for bad placement of section $InitAttribute (e.g.: __initdata) |
4462 | if ($line =~ /(\b$InitAttribute\b)/) { | 4581 | if ($line =~ /(\b$InitAttribute\b)/) { |
4463 | my $attr = $1; | 4582 | my $attr = $1; |
@@ -4652,6 +4771,15 @@ sub process { | |||
4652 | } | 4771 | } |
4653 | } | 4772 | } |
4654 | 4773 | ||
4774 | # Check for __attribute__ weak, or __weak declarations (may have link issues) | ||
4775 | if ($^V && $^V ge 5.10.0 && | ||
4776 | $line =~ /(?:$Declare|$DeclareMisordered)\s*$Ident\s*$balanced_parens\s*(?:$Attribute)?\s*;/ && | ||
4777 | ($line =~ /\b__attribute__\s*\(\s*\(.*\bweak\b/ || | ||
4778 | $line =~ /\b__weak\b/)) { | ||
4779 | ERROR("WEAK_DECLARATION", | ||
4780 | "Using weak declarations can have unintended link defects\n" . $herecurr); | ||
4781 | } | ||
4782 | |||
4655 | # check for sizeof(&) | 4783 | # check for sizeof(&) |
4656 | if ($line =~ /\bsizeof\s*\(\s*\&/) { | 4784 | if ($line =~ /\bsizeof\s*\(\s*\&/) { |
4657 | WARN("SIZEOF_ADDRESS", | 4785 | WARN("SIZEOF_ADDRESS", |
@@ -4667,12 +4795,6 @@ sub process { | |||
4667 | } | 4795 | } |
4668 | } | 4796 | } |
4669 | 4797 | ||
4670 | # check for line continuations in quoted strings with odd counts of " | ||
4671 | if ($rawline =~ /\\$/ && $rawline =~ tr/"/"/ % 2) { | ||
4672 | WARN("LINE_CONTINUATIONS", | ||
4673 | "Avoid line continuations in quoted strings\n" . $herecurr); | ||
4674 | } | ||
4675 | |||
4676 | # check for struct spinlock declarations | 4798 | # check for struct spinlock declarations |
4677 | if ($line =~ /^.\s*\bstruct\s+spinlock\s+\w+\s*;/) { | 4799 | if ($line =~ /^.\s*\bstruct\s+spinlock\s+\w+\s*;/) { |
4678 | WARN("USE_SPINLOCK_T", | 4800 | WARN("USE_SPINLOCK_T", |
@@ -4908,6 +5030,17 @@ sub process { | |||
4908 | } | 5030 | } |
4909 | } | 5031 | } |
4910 | 5032 | ||
5033 | # check for #defines like: 1 << <digit> that could be BIT(digit) | ||
5034 | if ($line =~ /#\s*define\s+\w+\s+\(?\s*1\s*([ulUL]*)\s*\<\<\s*(?:\d+|$Ident)\s*\)?/) { | ||
5035 | my $ull = ""; | ||
5036 | $ull = "_ULL" if (defined($1) && $1 =~ /ll/i); | ||
5037 | if (CHK("BIT_MACRO", | ||
5038 | "Prefer using the BIT$ull macro\n" . $herecurr) && | ||
5039 | $fix) { | ||
5040 | $fixed[$fixlinenr] =~ s/\(?\s*1\s*[ulUL]*\s*<<\s*(\d+|$Ident)\s*\)?/BIT${ull}($1)/; | ||
5041 | } | ||
5042 | } | ||
5043 | |||
4911 | # check for case / default statements not preceded by break/fallthrough/switch | 5044 | # check for case / default statements not preceded by break/fallthrough/switch |
4912 | if ($line =~ /^.\s*(?:case\s+(?:$Ident|$Constant)\s*|default):/) { | 5045 | if ($line =~ /^.\s*(?:case\s+(?:$Ident|$Constant)\s*|default):/) { |
4913 | my $has_break = 0; | 5046 | my $has_break = 0; |
@@ -5071,18 +5204,6 @@ sub process { | |||
5071 | "#define of '$1' is wrong - use Kconfig variables or standard guards instead\n" . $herecurr); | 5204 | "#define of '$1' is wrong - use Kconfig variables or standard guards instead\n" . $herecurr); |
5072 | } | 5205 | } |
5073 | 5206 | ||
5074 | # check for %L{u,d,i} in strings | ||
5075 | my $string; | ||
5076 | while ($line =~ /(?:^|")([X\t]*)(?:"|$)/g) { | ||
5077 | $string = substr($rawline, $-[1], $+[1] - $-[1]); | ||
5078 | $string =~ s/%%/__/g; | ||
5079 | if ($string =~ /(?<!%)%L[udi]/) { | ||
5080 | WARN("PRINTF_L", | ||
5081 | "\%Ld/%Lu are not-standard C, use %lld/%llu\n" . $herecurr); | ||
5082 | last; | ||
5083 | } | ||
5084 | } | ||
5085 | |||
5086 | # whine mightly about in_atomic | 5207 | # whine mightly about in_atomic |
5087 | if ($line =~ /\bin_atomic\s*\(/) { | 5208 | if ($line =~ /\bin_atomic\s*\(/) { |
5088 | if ($realfile =~ m@^drivers/@) { | 5209 | if ($realfile =~ m@^drivers/@) { |
diff --git a/scripts/coccinelle/api/platform_no_drv_owner.cocci b/scripts/coccinelle/api/platform_no_drv_owner.cocci new file mode 100644 index 000000000000..e065b9e714fc --- /dev/null +++ b/scripts/coccinelle/api/platform_no_drv_owner.cocci | |||
@@ -0,0 +1,106 @@ | |||
1 | /// Remove .owner field if calls are used which set it automatically | ||
2 | /// | ||
3 | // Confidence: High | ||
4 | // Copyright: (C) 2014 Wolfram Sang. GPL v2. | ||
5 | |||
6 | virtual patch | ||
7 | virtual context | ||
8 | virtual org | ||
9 | virtual report | ||
10 | |||
11 | @match1@ | ||
12 | declarer name module_platform_driver; | ||
13 | declarer name module_platform_driver_probe; | ||
14 | identifier __driver; | ||
15 | @@ | ||
16 | ( | ||
17 | module_platform_driver(__driver); | ||
18 | | | ||
19 | module_platform_driver_probe(__driver, ...); | ||
20 | ) | ||
21 | |||
22 | @fix1 depends on match1 && patch && !context && !org && !report@ | ||
23 | identifier match1.__driver; | ||
24 | @@ | ||
25 | static struct platform_driver __driver = { | ||
26 | .driver = { | ||
27 | - .owner = THIS_MODULE, | ||
28 | } | ||
29 | }; | ||
30 | |||
31 | @match2@ | ||
32 | identifier __driver; | ||
33 | @@ | ||
34 | ( | ||
35 | platform_driver_register(&__driver) | ||
36 | | | ||
37 | platform_driver_probe(&__driver, ...) | ||
38 | | | ||
39 | platform_create_bundle(&__driver, ...) | ||
40 | ) | ||
41 | |||
42 | @fix2 depends on match2 && patch && !context && !org && !report@ | ||
43 | identifier match2.__driver; | ||
44 | @@ | ||
45 | static struct platform_driver __driver = { | ||
46 | .driver = { | ||
47 | - .owner = THIS_MODULE, | ||
48 | } | ||
49 | }; | ||
50 | |||
51 | // ---------------------------------------------------------------------------- | ||
52 | |||
53 | @fix1_context depends on match1 && !patch && (context || org || report)@ | ||
54 | identifier match1.__driver; | ||
55 | position j0; | ||
56 | @@ | ||
57 | |||
58 | static struct platform_driver __driver = { | ||
59 | .driver = { | ||
60 | * .owner@j0 = THIS_MODULE, | ||
61 | } | ||
62 | }; | ||
63 | |||
64 | @fix2_context depends on match2 && !patch && (context || org || report)@ | ||
65 | identifier match2.__driver; | ||
66 | position j0; | ||
67 | @@ | ||
68 | |||
69 | static struct platform_driver __driver = { | ||
70 | .driver = { | ||
71 | * .owner@j0 = THIS_MODULE, | ||
72 | } | ||
73 | }; | ||
74 | |||
75 | // ---------------------------------------------------------------------------- | ||
76 | |||
77 | @script:python fix1_org depends on org@ | ||
78 | j0 << fix1_context.j0; | ||
79 | @@ | ||
80 | |||
81 | msg = "No need to set .owner here. The core will do it." | ||
82 | coccilib.org.print_todo(j0[0], msg) | ||
83 | |||
84 | @script:python fix2_org depends on org@ | ||
85 | j0 << fix2_context.j0; | ||
86 | @@ | ||
87 | |||
88 | msg = "No need to set .owner here. The core will do it." | ||
89 | coccilib.org.print_todo(j0[0], msg) | ||
90 | |||
91 | // ---------------------------------------------------------------------------- | ||
92 | |||
93 | @script:python fix1_report depends on report@ | ||
94 | j0 << fix1_context.j0; | ||
95 | @@ | ||
96 | |||
97 | msg = "No need to set .owner here. The core will do it." | ||
98 | coccilib.report.print_report(j0[0], msg) | ||
99 | |||
100 | @script:python fix2_report depends on report@ | ||
101 | j0 << fix2_context.j0; | ||
102 | @@ | ||
103 | |||
104 | msg = "No need to set .owner here. The core will do it." | ||
105 | coccilib.report.print_report(j0[0], msg) | ||
106 | |||
diff --git a/scripts/coccinelle/misc/bugon.cocci b/scripts/coccinelle/misc/bugon.cocci index 556456ca761c..3b7eec24fb5a 100644 --- a/scripts/coccinelle/misc/bugon.cocci +++ b/scripts/coccinelle/misc/bugon.cocci | |||
@@ -8,7 +8,7 @@ | |||
8 | // Confidence: High | 8 | // Confidence: High |
9 | // Copyright: (C) 2014 Himangi Saraogi. GPLv2. | 9 | // Copyright: (C) 2014 Himangi Saraogi. GPLv2. |
10 | // Comments: | 10 | // Comments: |
11 | // Options: --no-includes, --include-headers | 11 | // Options: --no-includes --include-headers |
12 | 12 | ||
13 | virtual patch | 13 | virtual patch |
14 | virtual context | 14 | virtual context |
diff --git a/scripts/headers.sh b/scripts/headers.sh index 95ece06599a5..d4dc4de5cea1 100755 --- a/scripts/headers.sh +++ b/scripts/headers.sh | |||
@@ -19,8 +19,6 @@ for arch in ${archs}; do | |||
19 | case ${arch} in | 19 | case ${arch} in |
20 | um) # no userspace export | 20 | um) # no userspace export |
21 | ;; | 21 | ;; |
22 | cris) # headers export are known broken | ||
23 | ;; | ||
24 | *) | 22 | *) |
25 | if [ -d ${srctree}/arch/${arch} ]; then | 23 | if [ -d ${srctree}/arch/${arch} ]; then |
26 | do_command $1 ${arch} | 24 | do_command $1 ${arch} |
diff --git a/scripts/kconfig/list.h b/scripts/kconfig/list.h index 685d80e1bb0e..2cf23f002d3f 100644 --- a/scripts/kconfig/list.h +++ b/scripts/kconfig/list.h | |||
@@ -34,7 +34,7 @@ struct list_head { | |||
34 | * list_entry - get the struct for this entry | 34 | * list_entry - get the struct for this entry |
35 | * @ptr: the &struct list_head pointer. | 35 | * @ptr: the &struct list_head pointer. |
36 | * @type: the type of the struct this is embedded in. | 36 | * @type: the type of the struct this is embedded in. |
37 | * @member: the name of the list_struct within the struct. | 37 | * @member: the name of the list_head within the struct. |
38 | */ | 38 | */ |
39 | #define list_entry(ptr, type, member) \ | 39 | #define list_entry(ptr, type, member) \ |
40 | container_of(ptr, type, member) | 40 | container_of(ptr, type, member) |
@@ -43,7 +43,7 @@ struct list_head { | |||
43 | * list_for_each_entry - iterate over list of given type | 43 | * list_for_each_entry - iterate over list of given type |
44 | * @pos: the type * to use as a loop cursor. | 44 | * @pos: the type * to use as a loop cursor. |
45 | * @head: the head for your list. | 45 | * @head: the head for your list. |
46 | * @member: the name of the list_struct within the struct. | 46 | * @member: the name of the list_head within the struct. |
47 | */ | 47 | */ |
48 | #define list_for_each_entry(pos, head, member) \ | 48 | #define list_for_each_entry(pos, head, member) \ |
49 | for (pos = list_entry((head)->next, typeof(*pos), member); \ | 49 | for (pos = list_entry((head)->next, typeof(*pos), member); \ |
@@ -55,7 +55,7 @@ struct list_head { | |||
55 | * @pos: the type * to use as a loop cursor. | 55 | * @pos: the type * to use as a loop cursor. |
56 | * @n: another type * to use as temporary storage | 56 | * @n: another type * to use as temporary storage |
57 | * @head: the head for your list. | 57 | * @head: the head for your list. |
58 | * @member: the name of the list_struct within the struct. | 58 | * @member: the name of the list_head within the struct. |
59 | */ | 59 | */ |
60 | #define list_for_each_entry_safe(pos, n, head, member) \ | 60 | #define list_for_each_entry_safe(pos, n, head, member) \ |
61 | for (pos = list_entry((head)->next, typeof(*pos), member), \ | 61 | for (pos = list_entry((head)->next, typeof(*pos), member), \ |
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 14cea7463a62..4dd37552abc2 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
@@ -330,10 +330,10 @@ static void set_subtitle(void) | |||
330 | list_for_each_entry(sp, &trail, entries) { | 330 | list_for_each_entry(sp, &trail, entries) { |
331 | if (sp->text) { | 331 | if (sp->text) { |
332 | if (pos) { | 332 | if (pos) { |
333 | pos->next = xcalloc(sizeof(*pos), 1); | 333 | pos->next = xcalloc(1, sizeof(*pos)); |
334 | pos = pos->next; | 334 | pos = pos->next; |
335 | } else { | 335 | } else { |
336 | subtitles = pos = xcalloc(sizeof(*pos), 1); | 336 | subtitles = pos = xcalloc(1, sizeof(*pos)); |
337 | } | 337 | } |
338 | pos->text = sp->text; | 338 | pos->text = sp->text; |
339 | } | 339 | } |
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index a26cc5d2a9b0..72c9dba84c5d 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c | |||
@@ -548,7 +548,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop, | |||
548 | { | 548 | { |
549 | int i, j; | 549 | int i, j; |
550 | struct menu *submenu[8], *menu, *location = NULL; | 550 | struct menu *submenu[8], *menu, *location = NULL; |
551 | struct jump_key *jump; | 551 | struct jump_key *jump = NULL; |
552 | 552 | ||
553 | str_printf(r, _("Prompt: %s\n"), _(prop->text)); | 553 | str_printf(r, _("Prompt: %s\n"), _(prop->text)); |
554 | menu = prop->menu->parent; | 554 | menu = prop->menu->parent; |
@@ -586,7 +586,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop, | |||
586 | str_printf(r, _(" Location:\n")); | 586 | str_printf(r, _(" Location:\n")); |
587 | for (j = 4; --i >= 0; j += 2) { | 587 | for (j = 4; --i >= 0; j += 2) { |
588 | menu = submenu[i]; | 588 | menu = submenu[i]; |
589 | if (head && location && menu == location) | 589 | if (jump && menu == location) |
590 | jump->offset = strlen(r->s); | 590 | jump->offset = strlen(r->s); |
591 | str_printf(r, "%*c-> %s", j, ' ', | 591 | str_printf(r, "%*c-> %s", j, ' ', |
592 | _(menu_get_prompt(menu))); | 592 | _(menu_get_prompt(menu))); |
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 70bea942b413..9922e66883a5 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
@@ -1753,7 +1753,7 @@ sub dump_struct($$) { | |||
1753 | # strip kmemcheck_bitfield_{begin,end}.*; | 1753 | # strip kmemcheck_bitfield_{begin,end}.*; |
1754 | $members =~ s/kmemcheck_bitfield_.*?;//gos; | 1754 | $members =~ s/kmemcheck_bitfield_.*?;//gos; |
1755 | # strip attributes | 1755 | # strip attributes |
1756 | $members =~ s/__aligned\s*\(.+\)//gos; | 1756 | $members =~ s/__aligned\s*\([^;]*\)//gos; |
1757 | 1757 | ||
1758 | create_parameterlist($members, ';', $file); | 1758 | create_parameterlist($members, ';', $file); |
1759 | check_sections($file, $declaration_name, "struct", $sectcheck, $struct_actual, $nested); | 1759 | check_sections($file, $declaration_name, "struct", $sectcheck, $struct_actual, $nested); |
diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 13957602f7ca..d9ab94b17de0 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec | |||
@@ -117,6 +117,7 @@ echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2" | |||
117 | echo 'mv vmlinux.orig vmlinux' | 117 | echo 'mv vmlinux.orig vmlinux' |
118 | echo "%endif" | 118 | echo "%endif" |
119 | 119 | ||
120 | if ! $PREBUILT; then | ||
120 | echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/{build,source}" | 121 | echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/{build,source}" |
121 | echo "mkdir -p "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE" | 122 | echo "mkdir -p "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE" |
122 | echo "EXCLUDES=\"$RCS_TAR_IGNORE --exclude .tmp_versions --exclude=*vmlinux* --exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation --exclude=firmware --exclude .config.old --exclude .missing-syscalls.d\"" | 123 | echo "EXCLUDES=\"$RCS_TAR_IGNORE --exclude .tmp_versions --exclude=*vmlinux* --exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation --exclude=firmware --exclude .config.old --exclude .missing-syscalls.d\"" |
@@ -124,6 +125,7 @@ echo "tar "'$EXCLUDES'" -cf- . | (cd "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNEL | |||
124 | echo 'cd $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE" | 125 | echo 'cd $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE" |
125 | echo "ln -sf /usr/src/kernels/$KERNELRELEASE build" | 126 | echo "ln -sf /usr/src/kernels/$KERNELRELEASE build" |
126 | echo "ln -sf /usr/src/kernels/$KERNELRELEASE source" | 127 | echo "ln -sf /usr/src/kernels/$KERNELRELEASE source" |
128 | fi | ||
127 | 129 | ||
128 | echo "" | 130 | echo "" |
129 | echo "%clean" | 131 | echo "%clean" |
@@ -151,9 +153,11 @@ echo "%files headers" | |||
151 | echo '%defattr (-, root, root)' | 153 | echo '%defattr (-, root, root)' |
152 | echo "/usr/include" | 154 | echo "/usr/include" |
153 | echo "" | 155 | echo "" |
156 | if ! $PREBUILT; then | ||
154 | echo "%files devel" | 157 | echo "%files devel" |
155 | echo '%defattr (-, root, root)' | 158 | echo '%defattr (-, root, root)' |
156 | echo "/usr/src/kernels/$KERNELRELEASE" | 159 | echo "/usr/src/kernels/$KERNELRELEASE" |
157 | echo "/lib/modules/$KERNELRELEASE/build" | 160 | echo "/lib/modules/$KERNELRELEASE/build" |
158 | echo "/lib/modules/$KERNELRELEASE/source" | 161 | echo "/lib/modules/$KERNELRELEASE/source" |
159 | echo "" | 162 | echo "" |
163 | fi | ||
diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c index 001facfa5b74..3d1984e59a30 100644 --- a/scripts/recordmcount.c +++ b/scripts/recordmcount.c | |||
@@ -404,7 +404,7 @@ do_file(char const *const fname) | |||
404 | } | 404 | } |
405 | if (w2(ghdr->e_machine) == EM_S390) { | 405 | if (w2(ghdr->e_machine) == EM_S390) { |
406 | reltype = R_390_64; | 406 | reltype = R_390_64; |
407 | mcount_adjust_64 = -8; | 407 | mcount_adjust_64 = -14; |
408 | } | 408 | } |
409 | if (w2(ghdr->e_machine) == EM_MIPS) { | 409 | if (w2(ghdr->e_machine) == EM_MIPS) { |
410 | reltype = R_MIPS_64; | 410 | reltype = R_MIPS_64; |
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index d4b665610d67..56ea99a12ab7 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl | |||
@@ -243,7 +243,7 @@ if ($arch eq "x86_64") { | |||
243 | 243 | ||
244 | } elsif ($arch eq "s390" && $bits == 64) { | 244 | } elsif ($arch eq "s390" && $bits == 64) { |
245 | $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*R_390_(PC|PLT)32DBL\\s+_mcount\\+0x2\$"; | 245 | $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*R_390_(PC|PLT)32DBL\\s+_mcount\\+0x2\$"; |
246 | $mcount_adjust = -8; | 246 | $mcount_adjust = -14; |
247 | $alignment = 8; | 247 | $alignment = 8; |
248 | $type = ".quad"; | 248 | $type = ".quad"; |
249 | $ld .= " -m elf64_s390"; | 249 | $ld .= " -m elf64_s390"; |