aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkkconfigsymbols.sh4
-rwxr-xr-xscripts/checkpatch.pl345
-rw-r--r--scripts/coccinelle/api/ptr_ret.cocci10
-rw-r--r--scripts/coccinelle/misc/boolreturn.cocci58
-rw-r--r--scripts/mod/modpost.c1
-rw-r--r--scripts/package/builddeb94
-rw-r--r--scripts/package/buildtar21
-rwxr-xr-xscripts/package/mkspec46
-rwxr-xr-xscripts/recordmcount.pl4
-rw-r--r--scripts/sortextable.c8
10 files changed, 468 insertions, 123 deletions
diff --git a/scripts/checkkconfigsymbols.sh b/scripts/checkkconfigsymbols.sh
index 2ca49bb31efc..ccb3391882d1 100755
--- a/scripts/checkkconfigsymbols.sh
+++ b/scripts/checkkconfigsymbols.sh
@@ -9,7 +9,7 @@ paths="$@"
9# Doing this once at the beginning saves a lot of time, on a cache-hot tree. 9# Doing this once at the beginning saves a lot of time, on a cache-hot tree.
10Kconfigs="`find . -name 'Kconfig' -o -name 'Kconfig*[^~]'`" 10Kconfigs="`find . -name 'Kconfig' -o -name 'Kconfig*[^~]'`"
11 11
12/bin/echo -e "File list \tundefined symbol used" 12printf "File list \tundefined symbol used\n"
13find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while read i 13find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while read i
14do 14do
15 # Output the bare Kconfig variable and the filename; the _MODULE part at 15 # Output the bare Kconfig variable and the filename; the _MODULE part at
@@ -54,6 +54,6 @@ while read symb files; do
54 # beyond the purpose of this script. 54 # beyond the purpose of this script.
55 symb_bare=`echo $symb | sed -e 's/_MODULE//'` 55 symb_bare=`echo $symb | sed -e 's/_MODULE//'`
56 if ! grep -q "\<$symb_bare\>" $Kconfigs; then 56 if ! grep -q "\<$symb_bare\>" $Kconfigs; then
57 /bin/echo -e "$files: \t$symb" 57 printf "$files: \t$symb\n"
58 fi 58 fi
59done|sort 59done|sort
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 2ee9eb750560..47016c304c84 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -31,12 +31,16 @@ my $show_types = 0;
31my $fix = 0; 31my $fix = 0;
32my $root; 32my $root;
33my %debug; 33my %debug;
34my %ignore_type = ();
35my %camelcase = (); 34my %camelcase = ();
35my %use_type = ();
36my @use = ();
37my %ignore_type = ();
36my @ignore = (); 38my @ignore = ();
37my $help = 0; 39my $help = 0;
38my $configuration_file = ".checkpatch.conf"; 40my $configuration_file = ".checkpatch.conf";
39my $max_line_length = 80; 41my $max_line_length = 80;
42my $ignore_perl_version = 0;
43my $minimum_perl_version = 5.10.0;
40 44
41sub help { 45sub help {
42 my ($exitcode) = @_; 46 my ($exitcode) = @_;
@@ -54,6 +58,7 @@ Options:
54 --terse one line per report 58 --terse one line per report
55 -f, --file treat FILE as regular source file 59 -f, --file treat FILE as regular source file
56 --subjective, --strict enable more subjective tests 60 --subjective, --strict enable more subjective tests
61 --types TYPE(,TYPE2...) show only these comma separated message types
57 --ignore TYPE(,TYPE2...) ignore various comma separated message types 62 --ignore TYPE(,TYPE2...) ignore various comma separated message types
58 --max-line-length=n set the maximum line length, if exceeded, warn 63 --max-line-length=n set the maximum line length, if exceeded, warn
59 --show-types show the message "types" in the output 64 --show-types show the message "types" in the output
@@ -71,6 +76,8 @@ Options:
71 "<inputfile>.EXPERIMENTAL-checkpatch-fixes" 76 "<inputfile>.EXPERIMENTAL-checkpatch-fixes"
72 with potential errors corrected to the preferred 77 with potential errors corrected to the preferred
73 checkpatch style 78 checkpatch style
79 --ignore-perl-version override checking of perl version. expect
80 runtime errors.
74 -h, --help, --version display this help and exit 81 -h, --help, --version display this help and exit
75 82
76When FILE is - read standard input. 83When FILE is - read standard input.
@@ -116,6 +123,7 @@ GetOptions(
116 'subjective!' => \$check, 123 'subjective!' => \$check,
117 'strict!' => \$check, 124 'strict!' => \$check,
118 'ignore=s' => \@ignore, 125 'ignore=s' => \@ignore,
126 'types=s' => \@use,
119 'show-types!' => \$show_types, 127 'show-types!' => \$show_types,
120 'max-line-length=i' => \$max_line_length, 128 'max-line-length=i' => \$max_line_length,
121 'root=s' => \$root, 129 'root=s' => \$root,
@@ -123,6 +131,7 @@ GetOptions(
123 'mailback!' => \$mailback, 131 'mailback!' => \$mailback,
124 'summary-file!' => \$summary_file, 132 'summary-file!' => \$summary_file,
125 'fix!' => \$fix, 133 'fix!' => \$fix,
134 'ignore-perl-version!' => \$ignore_perl_version,
126 'debug=s' => \%debug, 135 'debug=s' => \%debug,
127 'test-only=s' => \$tst_only, 136 'test-only=s' => \$tst_only,
128 'h|help' => \$help, 137 'h|help' => \$help,
@@ -133,24 +142,50 @@ help(0) if ($help);
133 142
134my $exit = 0; 143my $exit = 0;
135 144
145if ($^V && $^V lt $minimum_perl_version) {
146 printf "$P: requires at least perl version %vd\n", $minimum_perl_version;
147 if (!$ignore_perl_version) {
148 exit(1);
149 }
150}
151
136if ($#ARGV < 0) { 152if ($#ARGV < 0) {
137 print "$P: no input files\n"; 153 print "$P: no input files\n";
138 exit(1); 154 exit(1);
139} 155}
140 156
141@ignore = split(/,/, join(',',@ignore)); 157sub hash_save_array_words {
142foreach my $word (@ignore) { 158 my ($hashRef, $arrayRef) = @_;
143 $word =~ s/\s*\n?$//g; 159
144 $word =~ s/^\s*//g; 160 my @array = split(/,/, join(',', @$arrayRef));
145 $word =~ s/\s+/ /g; 161 foreach my $word (@array) {
146 $word =~ tr/[a-z]/[A-Z]/; 162 $word =~ s/\s*\n?$//g;
163 $word =~ s/^\s*//g;
164 $word =~ s/\s+/ /g;
165 $word =~ tr/[a-z]/[A-Z]/;
166
167 next if ($word =~ m/^\s*#/);
168 next if ($word =~ m/^\s*$/);
147 169
148 next if ($word =~ m/^\s*#/); 170 $hashRef->{$word}++;
149 next if ($word =~ m/^\s*$/); 171 }
172}
150 173
151 $ignore_type{$word}++; 174sub hash_show_words {
175 my ($hashRef, $prefix) = @_;
176
177 if ($quiet == 0 && keys %$hashRef) {
178 print "NOTE: $prefix message types:";
179 foreach my $word (sort keys %$hashRef) {
180 print " $word";
181 }
182 print "\n\n";
183 }
152} 184}
153 185
186hash_save_array_words(\%ignore_type, \@ignore);
187hash_save_array_words(\%use_type, \@use);
188
154my $dbg_values = 0; 189my $dbg_values = 0;
155my $dbg_possible = 0; 190my $dbg_possible = 0;
156my $dbg_type = 0; 191my $dbg_type = 0;
@@ -207,6 +242,8 @@ our $Sparse = qr{
207 __rcu 242 __rcu
208 }x; 243 }x;
209 244
245our $InitAttribute = qr{__(?:mem|cpu|dev|net_|)(?:initdata|initconst|init\b)};
246
210# Notes to $Attribute: 247# Notes to $Attribute:
211# We need \b after 'init' otherwise 'initconst' will cause a false positive in a check 248# We need \b after 'init' otherwise 'initconst' will cause a false positive in a check
212our $Attribute = qr{ 249our $Attribute = qr{
@@ -227,7 +264,7 @@ our $Attribute = qr{
227 __deprecated| 264 __deprecated|
228 __read_mostly| 265 __read_mostly|
229 __kprobes| 266 __kprobes|
230 __(?:mem|cpu|dev|)(?:initdata|initconst|init\b)| 267 $InitAttribute|
231 ____cacheline_aligned| 268 ____cacheline_aligned|
232 ____cacheline_aligned_in_smp| 269 ____cacheline_aligned_in_smp|
233 ____cacheline_internodealigned_in_smp| 270 ____cacheline_internodealigned_in_smp|
@@ -257,6 +294,7 @@ our $Operators = qr{
257 }x; 294 }x;
258 295
259our $NonptrType; 296our $NonptrType;
297our $NonptrTypeWithAttr;
260our $Type; 298our $Type;
261our $Declare; 299our $Declare;
262 300
@@ -319,6 +357,12 @@ our @typeList = (
319 qr{${Ident}_handler}, 357 qr{${Ident}_handler},
320 qr{${Ident}_handler_fn}, 358 qr{${Ident}_handler_fn},
321); 359);
360our @typeListWithAttr = (
361 @typeList,
362 qr{struct\s+$InitAttribute\s+$Ident},
363 qr{union\s+$InitAttribute\s+$Ident},
364);
365
322our @modifierList = ( 366our @modifierList = (
323 qr{fastcall}, 367 qr{fastcall},
324); 368);
@@ -332,6 +376,7 @@ our $allowed_asm_includes = qr{(?x:
332sub build_types { 376sub build_types {
333 my $mods = "(?x: \n" . join("|\n ", @modifierList) . "\n)"; 377 my $mods = "(?x: \n" . join("|\n ", @modifierList) . "\n)";
334 my $all = "(?x: \n" . join("|\n ", @typeList) . "\n)"; 378 my $all = "(?x: \n" . join("|\n ", @typeList) . "\n)";
379 my $allWithAttr = "(?x: \n" . join("|\n ", @typeListWithAttr) . "\n)";
335 $Modifier = qr{(?:$Attribute|$Sparse|$mods)}; 380 $Modifier = qr{(?:$Attribute|$Sparse|$mods)};
336 $NonptrType = qr{ 381 $NonptrType = qr{
337 (?:$Modifier\s+|const\s+)* 382 (?:$Modifier\s+|const\s+)*
@@ -342,6 +387,15 @@ sub build_types {
342 ) 387 )
343 (?:\s+$Modifier|\s+const)* 388 (?:\s+$Modifier|\s+const)*
344 }x; 389 }x;
390 $NonptrTypeWithAttr = qr{
391 (?:$Modifier\s+|const\s+)*
392 (?:
393 (?:typeof|__typeof__)\s*\([^\)]*\)|
394 (?:$typeTypedefs\b)|
395 (?:${allWithAttr}\b)
396 )
397 (?:\s+$Modifier|\s+const)*
398 }x;
345 $Type = qr{ 399 $Type = qr{
346 $NonptrType 400 $NonptrType
347 (?:(?:\s|\*|\[\])+\s*const|(?:\s|\*|\[\])+|(?:\s*\[\s*\])+)? 401 (?:(?:\s|\*|\[\])+\s*const|(?:\s|\*|\[\])+|(?:\s*\[\s*\])+)?
@@ -1355,7 +1409,9 @@ sub possible {
1355my $prefix = ''; 1409my $prefix = '';
1356 1410
1357sub show_type { 1411sub show_type {
1358 return !defined $ignore_type{$_[0]}; 1412 return defined $use_type{$_[0]} if (scalar keys %use_type > 0);
1413
1414 return !defined $ignore_type{$_[0]};
1359} 1415}
1360 1416
1361sub report { 1417sub report {
@@ -1435,7 +1491,23 @@ sub check_absolute_file {
1435sub trim { 1491sub trim {
1436 my ($string) = @_; 1492 my ($string) = @_;
1437 1493
1438 $string =~ s/(^\s+|\s+$)//g; 1494 $string =~ s/^\s+|\s+$//g;
1495
1496 return $string;
1497}
1498
1499sub ltrim {
1500 my ($string) = @_;
1501
1502 $string =~ s/^\s+//;
1503
1504 return $string;
1505}
1506
1507sub rtrim {
1508 my ($string) = @_;
1509
1510 $string =~ s/\s+$//;
1439 1511
1440 return $string; 1512 return $string;
1441} 1513}
@@ -1532,6 +1604,7 @@ sub process {
1532 my %suppress_export; 1604 my %suppress_export;
1533 my $suppress_statement = 0; 1605 my $suppress_statement = 0;
1534 1606
1607 my %signatures = ();
1535 1608
1536 # Pre-scan the patch sanitizing the lines. 1609 # Pre-scan the patch sanitizing the lines.
1537 # Pre-scan the patch looking for any __setup documentation. 1610 # Pre-scan the patch looking for any __setup documentation.
@@ -1624,6 +1697,8 @@ sub process {
1624 $linenr = 0; 1697 $linenr = 0;
1625 foreach my $line (@lines) { 1698 foreach my $line (@lines) {
1626 $linenr++; 1699 $linenr++;
1700 my $sline = $line; #copy of $line
1701 $sline =~ s/$;/ /g; #with comments as spaces
1627 1702
1628 my $rawline = $rawlines[$linenr - 1]; 1703 my $rawline = $rawlines[$linenr - 1];
1629 1704
@@ -1781,6 +1856,17 @@ sub process {
1781 "email address '$email' might be better as '$suggested_email$comment'\n" . $herecurr); 1856 "email address '$email' might be better as '$suggested_email$comment'\n" . $herecurr);
1782 } 1857 }
1783 } 1858 }
1859
1860# Check for duplicate signatures
1861 my $sig_nospace = $line;
1862 $sig_nospace =~ s/\s//g;
1863 $sig_nospace = lc($sig_nospace);
1864 if (defined $signatures{$sig_nospace}) {
1865 WARN("BAD_SIGN_OFF",
1866 "Duplicate signature\n" . $herecurr);
1867 } else {
1868 $signatures{$sig_nospace} = 1;
1869 }
1784 } 1870 }
1785 1871
1786# Check for wrappage within a valid hunk of the file 1872# Check for wrappage within a valid hunk of the file
@@ -1845,15 +1931,17 @@ sub process {
1845#trailing whitespace 1931#trailing whitespace
1846 if ($line =~ /^\+.*\015/) { 1932 if ($line =~ /^\+.*\015/) {
1847 my $herevet = "$here\n" . cat_vet($rawline) . "\n"; 1933 my $herevet = "$here\n" . cat_vet($rawline) . "\n";
1848 ERROR("DOS_LINE_ENDINGS", 1934 if (ERROR("DOS_LINE_ENDINGS",
1849 "DOS line endings\n" . $herevet); 1935 "DOS line endings\n" . $herevet) &&
1850 1936 $fix) {
1937 $fixed[$linenr - 1] =~ s/[\s\015]+$//;
1938 }
1851 } elsif ($rawline =~ /^\+.*\S\s+$/ || $rawline =~ /^\+\s+$/) { 1939 } elsif ($rawline =~ /^\+.*\S\s+$/ || $rawline =~ /^\+\s+$/) {
1852 my $herevet = "$here\n" . cat_vet($rawline) . "\n"; 1940 my $herevet = "$here\n" . cat_vet($rawline) . "\n";
1853 if (ERROR("TRAILING_WHITESPACE", 1941 if (ERROR("TRAILING_WHITESPACE",
1854 "trailing whitespace\n" . $herevet) && 1942 "trailing whitespace\n" . $herevet) &&
1855 $fix) { 1943 $fix) {
1856 $fixed[$linenr - 1] =~ s/^(\+.*?)\s+$/$1/; 1944 $fixed[$linenr - 1] =~ s/\s+$//;
1857 } 1945 }
1858 1946
1859 $rpt_cleaners = 1; 1947 $rpt_cleaners = 1;
@@ -2060,6 +2148,7 @@ sub process {
2060 if ($realfile =~ m@^(drivers/net/|net/)@ && 2148 if ($realfile =~ m@^(drivers/net/|net/)@ &&
2061 $prevrawline =~ /^\+[ \t]*\/\*/ && #starting /* 2149 $prevrawline =~ /^\+[ \t]*\/\*/ && #starting /*
2062 $prevrawline !~ /\*\/[ \t]*$/ && #no trailing */ 2150 $prevrawline !~ /\*\/[ \t]*$/ && #no trailing */
2151 $rawline =~ /^\+/ && #line is new
2063 $rawline !~ /^\+[ \t]*\*/) { #no leading * 2152 $rawline !~ /^\+[ \t]*\*/) { #no leading *
2064 WARN("NETWORKING_BLOCK_COMMENT_STYLE", 2153 WARN("NETWORKING_BLOCK_COMMENT_STYLE",
2065 "networking block comments start with * on subsequent lines\n" . $hereprev); 2154 "networking block comments start with * on subsequent lines\n" . $hereprev);
@@ -2126,7 +2215,7 @@ sub process {
2126 $realline_next); 2215 $realline_next);
2127#print "LINE<$line>\n"; 2216#print "LINE<$line>\n";
2128 if ($linenr >= $suppress_statement && 2217 if ($linenr >= $suppress_statement &&
2129 $realcnt && $line =~ /.\s*\S/) { 2218 $realcnt && $sline =~ /.\s*\S/) {
2130 ($stat, $cond, $line_nr_next, $remain_next, $off_next) = 2219 ($stat, $cond, $line_nr_next, $remain_next, $off_next) =
2131 ctx_statement_block($linenr, $realcnt, 0); 2220 ctx_statement_block($linenr, $realcnt, 0);
2132 $stat =~ s/\n./\n /g; 2221 $stat =~ s/\n./\n /g;
@@ -2486,16 +2575,22 @@ sub process {
2486 } 2575 }
2487 2576
2488# check for global initialisers. 2577# check for global initialisers.
2489 if ($line =~ /^.$Type\s*$Ident\s*(?:\s+$Modifier)*\s*=\s*(0|NULL|false)\s*;/) { 2578 if ($line =~ /^\+(\s*$Type\s*$Ident\s*(?:\s+$Modifier))*\s*=\s*(0|NULL|false)\s*;/) {
2490 ERROR("GLOBAL_INITIALISERS", 2579 if (ERROR("GLOBAL_INITIALISERS",
2491 "do not initialise globals to 0 or NULL\n" . 2580 "do not initialise globals to 0 or NULL\n" .
2492 $herecurr); 2581 $herecurr) &&
2582 $fix) {
2583 $fixed[$linenr - 1] =~ s/($Type\s*$Ident\s*(?:\s+$Modifier))*\s*=\s*(0|NULL|false)\s*;/$1;/;
2584 }
2493 } 2585 }
2494# check for static initialisers. 2586# check for static initialisers.
2495 if ($line =~ /\bstatic\s.*=\s*(0|NULL|false)\s*;/) { 2587 if ($line =~ /^\+.*\bstatic\s.*=\s*(0|NULL|false)\s*;/) {
2496 ERROR("INITIALISED_STATIC", 2588 if (ERROR("INITIALISED_STATIC",
2497 "do not initialise statics to 0 or NULL\n" . 2589 "do not initialise statics to 0 or NULL\n" .
2498 $herecurr); 2590 $herecurr) &&
2591 $fix) {
2592 $fixed[$linenr - 1] =~ s/(\bstatic\s.*?)\s*=\s*(0|NULL|false)\s*;/$1;/;
2593 }
2499 } 2594 }
2500 2595
2501# check for static const char * arrays. 2596# check for static const char * arrays.
@@ -2638,8 +2733,12 @@ sub process {
2638 } 2733 }
2639 2734
2640 if ($line =~ /\bpr_warning\s*\(/) { 2735 if ($line =~ /\bpr_warning\s*\(/) {
2641 WARN("PREFER_PR_LEVEL", 2736 if (WARN("PREFER_PR_LEVEL",
2642 "Prefer pr_warn(... to pr_warning(...\n" . $herecurr); 2737 "Prefer pr_warn(... to pr_warning(...\n" . $herecurr) &&
2738 $fix) {
2739 $fixed[$linenr - 1] =~
2740 s/\bpr_warning\b/pr_warn/;
2741 }
2643 } 2742 }
2644 2743
2645 if ($line =~ /\bdev_printk\s*\(\s*KERN_([A-Z]+)/) { 2744 if ($line =~ /\bdev_printk\s*\(\s*KERN_([A-Z]+)/) {
@@ -2759,6 +2858,7 @@ sub process {
2759 $off = 0; 2858 $off = 0;
2760 2859
2761 my $blank = copy_spacing($opline); 2860 my $blank = copy_spacing($opline);
2861 my $last_after = -1;
2762 2862
2763 for (my $n = 0; $n < $#elements; $n += 2) { 2863 for (my $n = 0; $n < $#elements; $n += 2) {
2764 2864
@@ -2824,7 +2924,7 @@ sub process {
2824 $cc !~ /^\\/ && $cc !~ /^;/) { 2924 $cc !~ /^\\/ && $cc !~ /^;/) {
2825 if (ERROR("SPACING", 2925 if (ERROR("SPACING",
2826 "space required after that '$op' $at\n" . $hereptr)) { 2926 "space required after that '$op' $at\n" . $hereptr)) {
2827 $good = trim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " "; 2927 $good = $fix_elements[$n] . trim($fix_elements[$n + 1]) . " ";
2828 $line_fixed = 1; 2928 $line_fixed = 1;
2829 } 2929 }
2830 } 2930 }
@@ -2839,11 +2939,11 @@ sub process {
2839 if ($ctx =~ /Wx.|.xW/) { 2939 if ($ctx =~ /Wx.|.xW/) {
2840 if (ERROR("SPACING", 2940 if (ERROR("SPACING",
2841 "spaces prohibited around that '$op' $at\n" . $hereptr)) { 2941 "spaces prohibited around that '$op' $at\n" . $hereptr)) {
2842 $good = trim($fix_elements[$n]) . trim($fix_elements[$n + 1]); 2942 $good = rtrim($fix_elements[$n]) . trim($fix_elements[$n + 1]);
2843 $line_fixed = 1;
2844 if (defined $fix_elements[$n + 2]) { 2943 if (defined $fix_elements[$n + 2]) {
2845 $fix_elements[$n + 2] =~ s/^\s+//; 2944 $fix_elements[$n + 2] =~ s/^\s+//;
2846 } 2945 }
2946 $line_fixed = 1;
2847 } 2947 }
2848 } 2948 }
2849 2949
@@ -2852,8 +2952,9 @@ sub process {
2852 if ($ctx !~ /.x[WEC]/ && $cc !~ /^}/) { 2952 if ($ctx !~ /.x[WEC]/ && $cc !~ /^}/) {
2853 if (ERROR("SPACING", 2953 if (ERROR("SPACING",
2854 "space required after that '$op' $at\n" . $hereptr)) { 2954 "space required after that '$op' $at\n" . $hereptr)) {
2855 $good = trim($fix_elements[$n]) . trim($fix_elements[$n + 1]) . " "; 2955 $good = $fix_elements[$n] . trim($fix_elements[$n + 1]) . " ";
2856 $line_fixed = 1; 2956 $line_fixed = 1;
2957 $last_after = $n;
2857 } 2958 }
2858 } 2959 }
2859 2960
@@ -2870,8 +2971,10 @@ sub process {
2870 if ($ctx !~ /[WEBC]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) { 2971 if ($ctx !~ /[WEBC]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) {
2871 if (ERROR("SPACING", 2972 if (ERROR("SPACING",
2872 "space required before that '$op' $at\n" . $hereptr)) { 2973 "space required before that '$op' $at\n" . $hereptr)) {
2873 $good = trim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]); 2974 if ($n != $last_after + 2) {
2874 $line_fixed = 1; 2975 $good = $fix_elements[$n] . " " . ltrim($fix_elements[$n + 1]);
2976 $line_fixed = 1;
2977 }
2875 } 2978 }
2876 } 2979 }
2877 if ($op eq '*' && $cc =~/\s*$Modifier\b/) { 2980 if ($op eq '*' && $cc =~/\s*$Modifier\b/) {
@@ -2880,12 +2983,11 @@ sub process {
2880 } elsif ($ctx =~ /.xW/) { 2983 } elsif ($ctx =~ /.xW/) {
2881 if (ERROR("SPACING", 2984 if (ERROR("SPACING",
2882 "space prohibited after that '$op' $at\n" . $hereptr)) { 2985 "space prohibited after that '$op' $at\n" . $hereptr)) {
2883 $fixed_line =~ s/\s+$//; 2986 $good = $fix_elements[$n] . rtrim($fix_elements[$n + 1]);
2884 $good = trim($fix_elements[$n]) . trim($fix_elements[$n + 1]);
2885 $line_fixed = 1;
2886 if (defined $fix_elements[$n + 2]) { 2987 if (defined $fix_elements[$n + 2]) {
2887 $fix_elements[$n + 2] =~ s/^\s+//; 2988 $fix_elements[$n + 2] =~ s/^\s+//;
2888 } 2989 }
2990 $line_fixed = 1;
2889 } 2991 }
2890 } 2992 }
2891 2993
@@ -2894,8 +2996,7 @@ sub process {
2894 if ($ctx !~ /[WEOBC]x[^W]/ && $ctx !~ /[^W]x[WOBEC]/) { 2996 if ($ctx !~ /[WEOBC]x[^W]/ && $ctx !~ /[^W]x[WOBEC]/) {
2895 if (ERROR("SPACING", 2997 if (ERROR("SPACING",
2896 "space required one side of that '$op' $at\n" . $hereptr)) { 2998 "space required one side of that '$op' $at\n" . $hereptr)) {
2897 $fixed_line =~ s/\s+$//; 2999 $good = $fix_elements[$n] . trim($fix_elements[$n + 1]) . " ";
2898 $good = trim($fix_elements[$n]) . trim($fix_elements[$n + 1]) . " ";
2899 $line_fixed = 1; 3000 $line_fixed = 1;
2900 } 3001 }
2901 } 3002 }
@@ -2903,20 +3004,18 @@ sub process {
2903 ($ctx =~ /Wx./ && $cc =~ /^;/)) { 3004 ($ctx =~ /Wx./ && $cc =~ /^;/)) {
2904 if (ERROR("SPACING", 3005 if (ERROR("SPACING",
2905 "space prohibited before that '$op' $at\n" . $hereptr)) { 3006 "space prohibited before that '$op' $at\n" . $hereptr)) {
2906 $fixed_line =~ s/\s+$//; 3007 $good = rtrim($fix_elements[$n]) . trim($fix_elements[$n + 1]);
2907 $good = trim($fix_elements[$n]) . trim($fix_elements[$n + 1]);
2908 $line_fixed = 1; 3008 $line_fixed = 1;
2909 } 3009 }
2910 } 3010 }
2911 if ($ctx =~ /ExW/) { 3011 if ($ctx =~ /ExW/) {
2912 if (ERROR("SPACING", 3012 if (ERROR("SPACING",
2913 "space prohibited after that '$op' $at\n" . $hereptr)) { 3013 "space prohibited after that '$op' $at\n" . $hereptr)) {
2914 $fixed_line =~ s/\s+$//; 3014 $good = $fix_elements[$n] . trim($fix_elements[$n + 1]);
2915 $good = trim($fix_elements[$n]) . trim($fix_elements[$n + 1]);
2916 $line_fixed = 1;
2917 if (defined $fix_elements[$n + 2]) { 3015 if (defined $fix_elements[$n + 2]) {
2918 $fix_elements[$n + 2] =~ s/^\s+//; 3016 $fix_elements[$n + 2] =~ s/^\s+//;
2919 } 3017 }
3018 $line_fixed = 1;
2920 } 3019 }
2921 } 3020 }
2922 3021
@@ -2930,8 +3029,10 @@ sub process {
2930 if ($ctx =~ /Wx[^WCE]|[^WCE]xW/) { 3029 if ($ctx =~ /Wx[^WCE]|[^WCE]xW/) {
2931 if (ERROR("SPACING", 3030 if (ERROR("SPACING",
2932 "need consistent spacing around '$op' $at\n" . $hereptr)) { 3031 "need consistent spacing around '$op' $at\n" . $hereptr)) {
2933 $fixed_line =~ s/\s+$//; 3032 $good = rtrim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " ";
2934 $good = trim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " "; 3033 if (defined $fix_elements[$n + 2]) {
3034 $fix_elements[$n + 2] =~ s/^\s+//;
3035 }
2935 $line_fixed = 1; 3036 $line_fixed = 1;
2936 } 3037 }
2937 } 3038 }
@@ -2942,7 +3043,7 @@ sub process {
2942 if ($ctx =~ /Wx./) { 3043 if ($ctx =~ /Wx./) {
2943 if (ERROR("SPACING", 3044 if (ERROR("SPACING",
2944 "space prohibited before that '$op' $at\n" . $hereptr)) { 3045 "space prohibited before that '$op' $at\n" . $hereptr)) {
2945 $good = trim($fix_elements[$n]) . trim($fix_elements[$n + 1]); 3046 $good = rtrim($fix_elements[$n]) . trim($fix_elements[$n + 1]);
2946 $line_fixed = 1; 3047 $line_fixed = 1;
2947 } 3048 }
2948 } 3049 }
@@ -2969,8 +3070,10 @@ sub process {
2969 if ($ok == 0) { 3070 if ($ok == 0) {
2970 if (ERROR("SPACING", 3071 if (ERROR("SPACING",
2971 "spaces required around that '$op' $at\n" . $hereptr)) { 3072 "spaces required around that '$op' $at\n" . $hereptr)) {
2972 $good = trim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " "; 3073 $good = rtrim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " ";
2973 $good = $fix_elements[$n] . " " . trim($fix_elements[$n + 1]) . " "; 3074 if (defined $fix_elements[$n + 2]) {
3075 $fix_elements[$n + 2] =~ s/^\s+//;
3076 }
2974 $line_fixed = 1; 3077 $line_fixed = 1;
2975 } 3078 }
2976 } 3079 }
@@ -3031,8 +3134,7 @@ sub process {
3031 if (ERROR("SPACING", 3134 if (ERROR("SPACING",
3032 "space required before the open brace '{'\n" . $herecurr) && 3135 "space required before the open brace '{'\n" . $herecurr) &&
3033 $fix) { 3136 $fix) {
3034 $fixed[$linenr - 1] =~ 3137 $fixed[$linenr - 1] =~ s/^(\+.*(?:do|\))){/$1 {/;
3035 s/^(\+.*(?:do|\))){/$1 {/;
3036 } 3138 }
3037 } 3139 }
3038 3140
@@ -3047,8 +3149,12 @@ sub process {
3047# closing brace should have a space following it when it has anything 3149# closing brace should have a space following it when it has anything
3048# on the line 3150# on the line
3049 if ($line =~ /}(?!(?:,|;|\)))\S/) { 3151 if ($line =~ /}(?!(?:,|;|\)))\S/) {
3050 ERROR("SPACING", 3152 if (ERROR("SPACING",
3051 "space required after that close brace '}'\n" . $herecurr); 3153 "space required after that close brace '}'\n" . $herecurr) &&
3154 $fix) {
3155 $fixed[$linenr - 1] =~
3156 s/}((?!(?:,|;|\)))\S)/} $1/;
3157 }
3052 } 3158 }
3053 3159
3054# check spacing on square brackets 3160# check spacing on square brackets
@@ -3271,8 +3377,13 @@ sub process {
3271 3377
3272#gcc binary extension 3378#gcc binary extension
3273 if ($var =~ /^$Binary$/) { 3379 if ($var =~ /^$Binary$/) {
3274 WARN("GCC_BINARY_CONSTANT", 3380 if (WARN("GCC_BINARY_CONSTANT",
3275 "Avoid gcc v4.3+ binary constant extension: <$var>\n" . $herecurr); 3381 "Avoid gcc v4.3+ binary constant extension: <$var>\n" . $herecurr) &&
3382 $fix) {
3383 my $hexval = sprintf("0x%x", oct($var));
3384 $fixed[$linenr - 1] =~
3385 s/\b$var\b/$hexval/;
3386 }
3276 } 3387 }
3277 3388
3278#CamelCase 3389#CamelCase
@@ -3282,19 +3393,26 @@ sub process {
3282 $var !~ /^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ && 3393 $var !~ /^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ &&
3283#Ignore SI style variants like nS, mV and dB (ie: max_uV, regulator_min_uA_show) 3394#Ignore SI style variants like nS, mV and dB (ie: max_uV, regulator_min_uA_show)
3284 $var !~ /^(?:[a-z_]*?)_?[a-z][A-Z](?:_[a-z_]+)?$/) { 3395 $var !~ /^(?:[a-z_]*?)_?[a-z][A-Z](?:_[a-z_]+)?$/) {
3285 seed_camelcase_includes() if ($check); 3396 while ($var =~ m{($Ident)}g) {
3286 if (!defined $camelcase{$var}) { 3397 my $word = $1;
3287 $camelcase{$var} = 1; 3398 next if ($word !~ /[A-Z][a-z]|[a-z][A-Z]/);
3288 CHK("CAMELCASE", 3399 seed_camelcase_includes() if ($check);
3289 "Avoid CamelCase: <$var>\n" . $herecurr); 3400 if (!defined $camelcase{$word}) {
3401 $camelcase{$word} = 1;
3402 CHK("CAMELCASE",
3403 "Avoid CamelCase: <$word>\n" . $herecurr);
3404 }
3290 } 3405 }
3291 } 3406 }
3292 } 3407 }
3293 3408
3294#no spaces allowed after \ in define 3409#no spaces allowed after \ in define
3295 if ($line=~/\#\s*define.*\\\s$/) { 3410 if ($line =~ /\#\s*define.*\\\s+$/) {
3296 WARN("WHITESPACE_AFTER_LINE_CONTINUATION", 3411 if (WARN("WHITESPACE_AFTER_LINE_CONTINUATION",
3297 "Whitepspace after \\ makes next lines useless\n" . $herecurr); 3412 "Whitespace after \\ makes next lines useless\n" . $herecurr) &&
3413 $fix) {
3414 $fixed[$linenr - 1] =~ s/\s+$//;
3415 }
3298 } 3416 }
3299 3417
3300#warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line) 3418#warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line)
@@ -3374,7 +3492,8 @@ sub process {
3374 $dstat !~ /^for\s*$Constant$/ && # for (...) 3492 $dstat !~ /^for\s*$Constant$/ && # for (...)
3375 $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar() 3493 $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar()
3376 $dstat !~ /^do\s*{/ && # do {... 3494 $dstat !~ /^do\s*{/ && # do {...
3377 $dstat !~ /^\({/) # ({... 3495 $dstat !~ /^\({/ && # ({...
3496 $ctx !~ /^.\s*#\s*define\s+TRACE_(?:SYSTEM|INCLUDE_FILE|INCLUDE_PATH)\b/)
3378 { 3497 {
3379 $ctx =~ s/\n*$//; 3498 $ctx =~ s/\n*$//;
3380 my $herectx = $here . "\n"; 3499 my $herectx = $here . "\n";
@@ -3606,6 +3725,32 @@ sub process {
3606 } 3725 }
3607 } 3726 }
3608 3727
3728sub string_find_replace {
3729 my ($string, $find, $replace) = @_;
3730
3731 $string =~ s/$find/$replace/g;
3732
3733 return $string;
3734}
3735
3736# check for bad placement of section $InitAttribute (e.g.: __initdata)
3737 if ($line =~ /(\b$InitAttribute\b)/) {
3738 my $attr = $1;
3739 if ($line =~ /^\+\s*static\s+(?:const\s+)?(?:$attr\s+)?($NonptrTypeWithAttr)\s+(?:$attr\s+)?($Ident(?:\[[^]]*\])?)\s*[=;]/) {
3740 my $ptr = $1;
3741 my $var = $2;
3742 if ((($ptr =~ /\b(union|struct)\s+$attr\b/ &&
3743 ERROR("MISPLACED_INIT",
3744 "$attr should be placed after $var\n" . $herecurr)) ||
3745 ($ptr !~ /\b(union|struct)\s+$attr\b/ &&
3746 WARN("MISPLACED_INIT",
3747 "$attr should be placed after $var\n" . $herecurr))) &&
3748 $fix) {
3749 $fixed[$linenr - 1] =~ s/(\bstatic\s+(?:const\s+)?)(?:$attr\s+)?($NonptrTypeWithAttr)\s+(?:$attr\s+)?($Ident(?:\[[^]]*\])?)\s*([=;])\s*/"$1" . trim(string_find_replace($2, "\\s*$attr\\s*", " ")) . " " . trim(string_find_replace($3, "\\s*$attr\\s*", "")) . " $attr" . ("$4" eq ";" ? ";" : " = ")/e;
3750 }
3751 }
3752 }
3753
3609# prefer usleep_range over udelay 3754# prefer usleep_range over udelay
3610 if ($line =~ /\budelay\s*\(\s*(\d+)\s*\)/) { 3755 if ($line =~ /\budelay\s*\(\s*(\d+)\s*\)/) {
3611 # ignore udelay's < 10, however 3756 # ignore udelay's < 10, however
@@ -3691,8 +3836,12 @@ sub process {
3691 3836
3692# Check for __inline__ and __inline, prefer inline 3837# Check for __inline__ and __inline, prefer inline
3693 if ($line =~ /\b(__inline__|__inline)\b/) { 3838 if ($line =~ /\b(__inline__|__inline)\b/) {
3694 WARN("INLINE", 3839 if (WARN("INLINE",
3695 "plain inline is preferred over $1\n" . $herecurr); 3840 "plain inline is preferred over $1\n" . $herecurr) &&
3841 $fix) {
3842 $fixed[$linenr - 1] =~ s/\b(__inline__|__inline)\b/inline/;
3843
3844 }
3696 } 3845 }
3697 3846
3698# Check for __attribute__ packed, prefer __packed 3847# Check for __attribute__ packed, prefer __packed
@@ -3709,14 +3858,21 @@ sub process {
3709 3858
3710# Check for __attribute__ format(printf, prefer __printf 3859# Check for __attribute__ format(printf, prefer __printf
3711 if ($line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf/) { 3860 if ($line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf/) {
3712 WARN("PREFER_PRINTF", 3861 if (WARN("PREFER_PRINTF",
3713 "__printf(string-index, first-to-check) is preferred over __attribute__((format(printf, string-index, first-to-check)))\n" . $herecurr); 3862 "__printf(string-index, first-to-check) is preferred over __attribute__((format(printf, string-index, first-to-check)))\n" . $herecurr) &&
3863 $fix) {
3864 $fixed[$linenr - 1] =~ s/\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf\s*,\s*(.*)\)\s*\)\s*\)/"__printf(" . trim($1) . ")"/ex;
3865
3866 }
3714 } 3867 }
3715 3868
3716# Check for __attribute__ format(scanf, prefer __scanf 3869# Check for __attribute__ format(scanf, prefer __scanf
3717 if ($line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*scanf\b/) { 3870 if ($line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*scanf\b/) {
3718 WARN("PREFER_SCANF", 3871 if (WARN("PREFER_SCANF",
3719 "__scanf(string-index, first-to-check) is preferred over __attribute__((format(scanf, string-index, first-to-check)))\n" . $herecurr); 3872 "__scanf(string-index, first-to-check) is preferred over __attribute__((format(scanf, string-index, first-to-check)))\n" . $herecurr) &&
3873 $fix) {
3874 $fixed[$linenr - 1] =~ s/\b__attribute__\s*\(\s*\(\s*format\s*\(\s*scanf\s*,\s*(.*)\)\s*\)\s*\)/"__scanf(" . trim($1) . ")"/ex;
3875 }
3720 } 3876 }
3721 3877
3722# check for sizeof(&) 3878# check for sizeof(&)
@@ -3727,8 +3883,11 @@ sub process {
3727 3883
3728# check for sizeof without parenthesis 3884# check for sizeof without parenthesis
3729 if ($line =~ /\bsizeof\s+((?:\*\s*|)$Lval|$Type(?:\s+$Lval|))/) { 3885 if ($line =~ /\bsizeof\s+((?:\*\s*|)$Lval|$Type(?:\s+$Lval|))/) {
3730 WARN("SIZEOF_PARENTHESIS", 3886 if (WARN("SIZEOF_PARENTHESIS",
3731 "sizeof $1 should be sizeof($1)\n" . $herecurr); 3887 "sizeof $1 should be sizeof($1)\n" . $herecurr) &&
3888 $fix) {
3889 $fixed[$linenr - 1] =~ s/\bsizeof\s+((?:\*\s*|)$Lval|$Type(?:\s+$Lval|))/"sizeof(" . trim($1) . ")"/ex;
3890 }
3732 } 3891 }
3733 3892
3734# check for line continuations in quoted strings with odd counts of " 3893# check for line continuations in quoted strings with odd counts of "
@@ -3747,8 +3906,11 @@ sub process {
3747 if ($line =~ /\bseq_printf\s*\(/) { 3906 if ($line =~ /\bseq_printf\s*\(/) {
3748 my $fmt = get_quoted_string($line, $rawline); 3907 my $fmt = get_quoted_string($line, $rawline);
3749 if ($fmt !~ /[^\\]\%/) { 3908 if ($fmt !~ /[^\\]\%/) {
3750 WARN("PREFER_SEQ_PUTS", 3909 if (WARN("PREFER_SEQ_PUTS",
3751 "Prefer seq_puts to seq_printf\n" . $herecurr); 3910 "Prefer seq_puts to seq_printf\n" . $herecurr) &&
3911 $fix) {
3912 $fixed[$linenr - 1] =~ s/\bseq_printf\b/seq_puts/;
3913 }
3752 } 3914 }
3753 } 3915 }
3754 3916
@@ -3810,6 +3972,16 @@ sub process {
3810 } 3972 }
3811 } 3973 }
3812 3974
3975# check for new externs in .h files.
3976 if ($realfile =~ /\.h$/ &&
3977 $line =~ /^\+\s*(extern\s+)$Type\s*$Ident\s*\(/s) {
3978 if (WARN("AVOID_EXTERNS",
3979 "extern prototypes should be avoided in .h files\n" . $herecurr) &&
3980 $fix) {
3981 $fixed[$linenr - 1] =~ s/(.*)\bextern\b\s*(.*)/$1$2/;
3982 }
3983 }
3984
3813# check for new externs in .c files. 3985# check for new externs in .c files.
3814 if ($realfile =~ /\.c$/ && defined $stat && 3986 if ($realfile =~ /\.c$/ && defined $stat &&
3815 $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s) 3987 $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s)
@@ -3879,8 +4051,11 @@ sub process {
3879 4051
3880# check for multiple semicolons 4052# check for multiple semicolons
3881 if ($line =~ /;\s*;\s*$/) { 4053 if ($line =~ /;\s*;\s*$/) {
3882 WARN("ONE_SEMICOLON", 4054 if (WARN("ONE_SEMICOLON",
3883 "Statements terminations use 1 semicolon\n" . $herecurr); 4055 "Statements terminations use 1 semicolon\n" . $herecurr) &&
4056 $fix) {
4057 $fixed[$linenr - 1] =~ s/(\s*;\s*){2,}$/;/g;
4058 }
3884 } 4059 }
3885 4060
3886# check for switch/default statements without a break; 4061# check for switch/default statements without a break;
@@ -3898,9 +4073,12 @@ sub process {
3898 } 4073 }
3899 4074
3900# check for gcc specific __FUNCTION__ 4075# check for gcc specific __FUNCTION__
3901 if ($line =~ /__FUNCTION__/) { 4076 if ($line =~ /\b__FUNCTION__\b/) {
3902 WARN("USE_FUNC", 4077 if (WARN("USE_FUNC",
3903 "__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr); 4078 "__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr) &&
4079 $fix) {
4080 $fixed[$linenr - 1] =~ s/\b__FUNCTION__\b/__func__/g;
4081 }
3904 } 4082 }
3905 4083
3906# check for use of yield() 4084# check for use of yield()
@@ -4105,13 +4283,8 @@ sub process {
4105 } 4283 }
4106 } 4284 }
4107 4285
4108 if ($quiet == 0 && keys %ignore_type) { 4286 hash_show_words(\%use_type, "Used");
4109 print "NOTE: Ignored message types:"; 4287 hash_show_words(\%ignore_type, "Ignored");
4110 foreach my $ignore (sort keys %ignore_type) {
4111 print " $ignore";
4112 }
4113 print "\n\n";
4114 }
4115 4288
4116 if ($clean == 0 && $fix && "@rawlines" ne "@fixed") { 4289 if ($clean == 0 && $fix && "@rawlines" ne "@fixed") {
4117 my $newfile = $filename . ".EXPERIMENTAL-checkpatch-fixes"; 4290 my $newfile = $filename . ".EXPERIMENTAL-checkpatch-fixes";
diff --git a/scripts/coccinelle/api/ptr_ret.cocci b/scripts/coccinelle/api/ptr_ret.cocci
index 2274638d005b..e18f8402e37c 100644
--- a/scripts/coccinelle/api/ptr_ret.cocci
+++ b/scripts/coccinelle/api/ptr_ret.cocci
@@ -1,5 +1,5 @@
1/// 1///
2/// Use PTR_RET rather than if(IS_ERR(...)) + PTR_ERR 2/// Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
3/// 3///
4// Confidence: High 4// Confidence: High
5// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. 5// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
@@ -7,7 +7,7 @@
7// URL: http://coccinelle.lip6.fr/ 7// URL: http://coccinelle.lip6.fr/
8// Options: --no-includes --include-headers 8// Options: --no-includes --include-headers
9// 9//
10// Keywords: ERR_PTR, PTR_ERR, PTR_RET 10// Keywords: ERR_PTR, PTR_ERR, PTR_RET, PTR_ERR_OR_ZERO
11// Version min: 2.6.39 11// Version min: 2.6.39
12// 12//
13 13
@@ -21,21 +21,21 @@ expression ptr;
21@@ 21@@
22 22
23- if (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0; 23- if (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0;
24+ return PTR_RET(ptr); 24+ return PTR_ERR_OR_ZERO(ptr);
25 25
26@depends on patch@ 26@depends on patch@
27expression ptr; 27expression ptr;
28@@ 28@@
29 29
30- if (IS_ERR(ptr)) return PTR_ERR(ptr); return 0; 30- if (IS_ERR(ptr)) return PTR_ERR(ptr); return 0;
31+ return PTR_RET(ptr); 31+ return PTR_ERR_OR_ZERO(ptr);
32 32
33@depends on patch@ 33@depends on patch@
34expression ptr; 34expression ptr;
35@@ 35@@
36 36
37- (IS_ERR(ptr) ? PTR_ERR(ptr) : 0) 37- (IS_ERR(ptr) ? PTR_ERR(ptr) : 0)
38+ PTR_RET(ptr) 38+ PTR_ERR_OR_ZERO(ptr)
39 39
40@r1 depends on !patch@ 40@r1 depends on !patch@
41expression ptr; 41expression ptr;
diff --git a/scripts/coccinelle/misc/boolreturn.cocci b/scripts/coccinelle/misc/boolreturn.cocci
new file mode 100644
index 000000000000..a43c7b0c36ef
--- /dev/null
+++ b/scripts/coccinelle/misc/boolreturn.cocci
@@ -0,0 +1,58 @@
1/// Return statements in functions returning bool should use
2/// true/false instead of 1/0.
3//
4// Confidence: High
5// Options: --no-includes --include-headers
6
7virtual patch
8virtual report
9virtual context
10
11@r1 depends on patch@
12identifier fn;
13typedef bool;
14symbol false;
15symbol true;
16@@
17
18bool fn ( ... )
19{
20<...
21return
22(
23- 0
24+ false
25|
26- 1
27+ true
28)
29 ;
30...>
31}
32
33@r2 depends on report || context@
34identifier fn;
35position p;
36@@
37
38bool fn ( ... )
39{
40<...
41return
42(
43* 0@p
44|
45* 1@p
46)
47 ;
48...>
49}
50
51
52@script:python depends on report@
53p << r2.p;
54fn << r2.fn;
55@@
56
57msg = "WARNING: return of 0/1 in function '%s' with return type bool" % fn
58coccilib.report.print_report(p[0], msg)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 62164348ecf7..8247979e8f64 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -821,6 +821,7 @@ static const char *section_white_list[] =
821{ 821{
822 ".comment*", 822 ".comment*",
823 ".debug*", 823 ".debug*",
824 ".cranges", /* sh64 */
824 ".zdebug*", /* Compressed debug sections. */ 825 ".zdebug*", /* Compressed debug sections. */
825 ".GCC-command-line", /* mn10300 */ 826 ".GCC-command-line", /* mn10300 */
826 ".GCC.command.line", /* record-gcc-switches, non mn10300 */ 827 ".GCC.command.line", /* record-gcc-switches, non mn10300 */
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index acb86507828a..90e521fde35f 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -41,9 +41,9 @@ create_package() {
41 parisc*) 41 parisc*)
42 debarch=hppa ;; 42 debarch=hppa ;;
43 mips*) 43 mips*)
44 debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y .config && echo el) ;; 44 debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo el) ;;
45 arm*) 45 arm*)
46 debarch=arm$(grep -q CONFIG_AEABI=y .config && echo el) ;; 46 debarch=arm$(grep -q CONFIG_AEABI=y $KCONFIG_CONFIG && echo el) ;;
47 *) 47 *)
48 echo "" >&2 48 echo "" >&2
49 echo "** ** ** WARNING ** ** **" >&2 49 echo "** ** ** WARNING ** ** **" >&2
@@ -78,17 +78,35 @@ tmpdir="$objtree/debian/tmp"
78fwdir="$objtree/debian/fwtmp" 78fwdir="$objtree/debian/fwtmp"
79kernel_headers_dir="$objtree/debian/hdrtmp" 79kernel_headers_dir="$objtree/debian/hdrtmp"
80libc_headers_dir="$objtree/debian/headertmp" 80libc_headers_dir="$objtree/debian/headertmp"
81dbg_dir="$objtree/debian/dbgtmp"
81packagename=linux-image-$version 82packagename=linux-image-$version
82fwpackagename=linux-firmware-image 83fwpackagename=linux-firmware-image-$version
83kernel_headers_packagename=linux-headers-$version 84kernel_headers_packagename=linux-headers-$version
84libc_headers_packagename=linux-libc-dev 85libc_headers_packagename=linux-libc-dev
86dbg_packagename=$packagename-dbg
85 87
86if [ "$ARCH" = "um" ] ; then 88if [ "$ARCH" = "um" ] ; then
87 packagename=user-mode-linux-$version 89 packagename=user-mode-linux-$version
88fi 90fi
89 91
92# Not all arches have the same installed path in debian
93# XXX: have each arch Makefile export a variable of the canonical image install
94# path instead
95case $ARCH in
96um)
97 installed_image_path="usr/bin/linux-$version"
98 ;;
99parisc|mips|powerpc)
100 installed_image_path="boot/vmlinux-$version"
101 ;;
102*)
103 installed_image_path="boot/vmlinuz-$version"
104esac
105
106BUILD_DEBUG="$(grep -s '^CONFIG_DEBUG_INFO=y' $KCONFIG_CONFIG || true)"
107
90# Setup the directory structure 108# Setup the directory structure
91rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" 109rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir"
92mkdir -m 755 -p "$tmpdir/DEBIAN" 110mkdir -m 755 -p "$tmpdir/DEBIAN"
93mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename" 111mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename"
94mkdir -m 755 -p "$fwdir/DEBIAN" 112mkdir -m 755 -p "$fwdir/DEBIAN"
@@ -101,26 +119,29 @@ mkdir -p "$kernel_headers_dir/lib/modules/$version/"
101if [ "$ARCH" = "um" ] ; then 119if [ "$ARCH" = "um" ] ; then
102 mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" 120 mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin"
103fi 121fi
122if [ -n "$BUILD_DEBUG" ] ; then
123 mkdir -p "$dbg_dir/usr/share/doc/$dbg_packagename"
124 mkdir -m 755 -p "$dbg_dir/DEBIAN"
125fi
104 126
105# Build and install the kernel 127# Build and install the kernel
106if [ "$ARCH" = "um" ] ; then 128if [ "$ARCH" = "um" ] ; then
107 $MAKE linux 129 $MAKE linux
108 cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map" 130 cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map"
109 cp .config "$tmpdir/usr/share/doc/$packagename/config" 131 cp $KCONFIG_CONFIG "$tmpdir/usr/share/doc/$packagename/config"
110 gzip "$tmpdir/usr/share/doc/$packagename/config" 132 gzip "$tmpdir/usr/share/doc/$packagename/config"
111 cp $KBUILD_IMAGE "$tmpdir/usr/bin/linux-$version"
112else 133else
113 cp System.map "$tmpdir/boot/System.map-$version" 134 cp System.map "$tmpdir/boot/System.map-$version"
114 cp .config "$tmpdir/boot/config-$version" 135 cp $KCONFIG_CONFIG "$tmpdir/boot/config-$version"
115 # Not all arches include the boot path in KBUILD_IMAGE 136fi
116 if [ -e $KBUILD_IMAGE ]; then 137# Not all arches include the boot path in KBUILD_IMAGE
117 cp $KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version" 138if [ -e $KBUILD_IMAGE ]; then
118 else 139 cp $KBUILD_IMAGE "$tmpdir/$installed_image_path"
119 cp arch/$ARCH/boot/$KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version" 140else
120 fi 141 cp arch/$ARCH/boot/$KBUILD_IMAGE "$tmpdir/$installed_image_path"
121fi 142fi
122 143
123if grep -q '^CONFIG_MODULES=y' .config ; then 144if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
124 INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_install 145 INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_install
125 rm -f "$tmpdir/lib/modules/$version/build" 146 rm -f "$tmpdir/lib/modules/$version/build"
126 rm -f "$tmpdir/lib/modules/$version/source" 147 rm -f "$tmpdir/lib/modules/$version/source"
@@ -128,6 +149,20 @@ if grep -q '^CONFIG_MODULES=y' .config ; then
128 mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/" 149 mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/"
129 rmdir "$tmpdir/lib/modules/$version" 150 rmdir "$tmpdir/lib/modules/$version"
130 fi 151 fi
152 if [ -n "$BUILD_DEBUG" ] ; then
153 (
154 cd $tmpdir
155 for module in $(find lib/modules/ -name *.ko); do
156 mkdir -p $(dirname $dbg_dir/usr/lib/debug/$module)
157 # only keep debug symbols in the debug file
158 objcopy --only-keep-debug $module $dbg_dir/usr/lib/debug/$module
159 # strip original module from debug symbols
160 objcopy --strip-debug $module
161 # then add a link to those
162 objcopy --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $module
163 done
164 )
165 fi
131fi 166fi
132 167
133if [ "$ARCH" != "um" ]; then 168if [ "$ARCH" != "um" ]; then
@@ -149,7 +184,7 @@ set -e
149# Pass maintainer script parameters to hook scripts 184# Pass maintainer script parameters to hook scripts
150export DEB_MAINT_PARAMS="\$*" 185export DEB_MAINT_PARAMS="\$*"
151 186
152test -d $debhookdir/$script.d && run-parts --arg="$version" $debhookdir/$script.d 187test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d
153exit 0 188exit 0
154EOF 189EOF
155 chmod 755 "$tmpdir/DEBIAN/$script" 190 chmod 755 "$tmpdir/DEBIAN/$script"
@@ -245,11 +280,12 @@ fi
245# Build header package 280# Build header package
246(cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl > "$objtree/debian/hdrsrcfiles") 281(cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl > "$objtree/debian/hdrsrcfiles")
247(cd $srctree; find arch/$SRCARCH/include include scripts -type f >> "$objtree/debian/hdrsrcfiles") 282(cd $srctree; find arch/$SRCARCH/include include scripts -type f >> "$objtree/debian/hdrsrcfiles")
248(cd $objtree; find arch/$SRCARCH/include .config Module.symvers include scripts -type f >> "$objtree/debian/hdrobjfiles") 283(cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f >> "$objtree/debian/hdrobjfiles")
249destdir=$kernel_headers_dir/usr/src/linux-headers-$version 284destdir=$kernel_headers_dir/usr/src/linux-headers-$version
250mkdir -p "$destdir" 285mkdir -p "$destdir"
251(cd $srctree; tar -c -f - -T "$objtree/debian/hdrsrcfiles") | (cd $destdir; tar -xf -) 286(cd $srctree; tar -c -f - -T "$objtree/debian/hdrsrcfiles") | (cd $destdir; tar -xf -)
252(cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -) 287(cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -)
288(cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be
253ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build" 289ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
254rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles" 290rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
255arch=$(dpkg --print-architecture) 291arch=$(dpkg --print-architecture)
@@ -299,4 +335,30 @@ fi
299 335
300create_package "$packagename" "$tmpdir" 336create_package "$packagename" "$tmpdir"
301 337
338if [ -n "$BUILD_DEBUG" ] ; then
339 # Build debug package
340 # Different tools want the image in different locations
341 # perf
342 mkdir -p $dbg_dir/usr/lib/debug/lib/modules/$version/
343 cp vmlinux $dbg_dir/usr/lib/debug/lib/modules/$version/
344 # systemtap
345 mkdir -p $dbg_dir/usr/lib/debug/boot/
346 ln -s ../lib/modules/$version/vmlinux $dbg_dir/usr/lib/debug/boot/vmlinux-$version
347 # kdump-tools
348 ln -s lib/modules/$version/vmlinux $dbg_dir/usr/lib/debug/vmlinux-$version
349
350 cat <<EOF >> debian/control
351
352Package: $dbg_packagename
353Section: debug
354Provides: linux-debug, linux-debug-$version
355Architecture: any
356Description: Linux kernel debugging symbols for $version
357 This package will come in handy if you need to debug the kernel. It provides
358 all the necessary debug symbols for the kernel and its modules.
359EOF
360
361 create_package "$dbg_packagename" "$dbg_dir"
362fi
363
302exit 0 364exit 0
diff --git a/scripts/package/buildtar b/scripts/package/buildtar
index cdd9bb909bcd..aa22f9447ddc 100644
--- a/scripts/package/buildtar
+++ b/scripts/package/buildtar
@@ -87,6 +87,27 @@ case "${ARCH}" in
87 [ -f "${objtree}/vmlinux.SYS" ] && cp -v -- "${objtree}/vmlinux.SYS" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.SYS" 87 [ -f "${objtree}/vmlinux.SYS" ] && cp -v -- "${objtree}/vmlinux.SYS" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.SYS"
88 [ -f "${objtree}/vmlinux.dsk" ] && cp -v -- "${objtree}/vmlinux.dsk" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.dsk" 88 [ -f "${objtree}/vmlinux.dsk" ] && cp -v -- "${objtree}/vmlinux.dsk" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.dsk"
89 ;; 89 ;;
90 mips)
91 if [ -f "${objtree}/arch/mips/boot/compressed/vmlinux.bin" ]; then
92 cp -v -- "${objtree}/arch/mips/boot/compressed/vmlinux.bin" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
93 elif [ -f "${objtree}/arch/mips/boot/compressed/vmlinux.ecoff" ]; then
94 cp -v -- "${objtree}/arch/mips/boot/compressed/vmlinux.ecoff" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
95 elif [ -f "${objtree}/arch/mips/boot/compressed/vmlinux.srec" ]; then
96 cp -v -- "${objtree}/arch/mips/boot/compressed/vmlinux.srec" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
97 elif [ -f "${objtree}/vmlinux.32" ]; then
98 cp -v -- "${objtree}/vmlinux.32" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
99 elif [ -f "${objtree}/vmlinux.64" ]; then
100 cp -v -- "${objtree}/vmlinux.64" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
101 elif [ -f "${objtree}/arch/mips/boot/vmlinux.bin" ]; then
102 cp -v -- "${objtree}/arch/mips/boot/vmlinux.bin" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
103 elif [ -f "${objtree}/arch/mips/boot/vmlinux.ecoff" ]; then
104 cp -v -- "${objtree}/arch/mips/boot/vmlinux.ecoff" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
105 elif [ -f "${objtree}/arch/mips/boot/vmlinux.srec" ]; then
106 cp -v -- "${objtree}/arch/mips/boot/vmlinux.srec" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
107 elif [ -f "${objtree}/vmlinux" ]; then
108 cp -v -- "${objtree}/vmlinux" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
109 fi
110 ;;
90 *) 111 *)
91 [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-kbuild-${KERNELRELEASE}" 112 [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-kbuild-${KERNELRELEASE}"
92 echo "" >&2 113 echo "" >&2
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index fdd3fbf4d4a4..13957602f7ca 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -1,7 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2# 2#
3# Output a simple RPM spec file that uses no fancy features requiring 3# Output a simple RPM spec file.
4# RPM v4. This is intended to work with any RPM distro. 4# This version assumes a minimum of RPM 4.0.3.
5# 5#
6# The only gothic bit here is redefining install_post to avoid 6# The only gothic bit here is redefining install_post to avoid
7# stripping the symbols from files in the kernel which we want 7# stripping the symbols from files in the kernel which we want
@@ -59,6 +59,14 @@ echo "header files define structures and constants that are needed for"
59echo "building most standard programs and are also needed for rebuilding the" 59echo "building most standard programs and are also needed for rebuilding the"
60echo "glibc package." 60echo "glibc package."
61echo "" 61echo ""
62echo "%package devel"
63echo "Summary: Development package for building kernel modules to match the $__KERNELRELEASE kernel"
64echo "Group: System Environment/Kernel"
65echo "AutoReqProv: no"
66echo "%description -n kernel-devel"
67echo "This package provides kernel headers and makefiles sufficient to build modules"
68echo "against the $__KERNELRELEASE kernel package."
69echo ""
62 70
63if ! $PREBUILT; then 71if ! $PREBUILT; then
64echo "%prep" 72echo "%prep"
@@ -77,13 +85,14 @@ echo "%install"
77echo 'KBUILD_IMAGE=$(make image_name)' 85echo 'KBUILD_IMAGE=$(make image_name)'
78echo "%ifarch ia64" 86echo "%ifarch ia64"
79echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules' 87echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules'
80echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
81echo "%else" 88echo "%else"
82echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules' 89echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules'
83echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
84echo "%endif" 90echo "%endif"
91echo 'mkdir -p $RPM_BUILD_ROOT'"/lib/firmware/$KERNELRELEASE"
85 92
86echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{?_smp_mflags} KBUILD_SRC= modules_install' 93echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{?_smp_mflags} KBUILD_SRC= mod-fw= modules_install'
94echo 'INSTALL_FW_PATH=$RPM_BUILD_ROOT'"/lib/firmware/$KERNELRELEASE"
95echo 'make INSTALL_FW_PATH=$INSTALL_FW_PATH' firmware_install
87echo "%ifarch ia64" 96echo "%ifarch ia64"
88echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" 97echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE"
89echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" 98echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/"
@@ -108,18 +117,43 @@ echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2"
108echo 'mv vmlinux.orig vmlinux' 117echo 'mv vmlinux.orig vmlinux'
109echo "%endif" 118echo "%endif"
110 119
120echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/{build,source}"
121echo "mkdir -p "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE"
122echo "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\""
123echo "tar "'$EXCLUDES'" -cf- . | (cd "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE;tar xvf -)"
124echo 'cd $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE"
125echo "ln -sf /usr/src/kernels/$KERNELRELEASE build"
126echo "ln -sf /usr/src/kernels/$KERNELRELEASE source"
127
111echo "" 128echo ""
112echo "%clean" 129echo "%clean"
113echo 'rm -rf $RPM_BUILD_ROOT' 130echo 'rm -rf $RPM_BUILD_ROOT'
114echo "" 131echo ""
132echo "%post"
133echo "if [ -x /sbin/installkernel -a -r /boot/vmlinuz-$KERNELRELEASE -a -r /boot/System.map-$KERNELRELEASE ]; then"
134echo "cp /boot/vmlinuz-$KERNELRELEASE /boot/vmlinuz-$KERNELRELEASE-rpm"
135echo "cp /boot/System.map-$KERNELRELEASE /boot/System.map-$KERNELRELEASE-rpm"
136echo "rm -f /boot/vmlinuz-$KERNELRELEASE /boot/System.map-$KERNELRELEASE"
137echo "/sbin/installkernel $KERNELRELEASE /boot/vmlinuz-$KERNELRELEASE-rpm /boot/System.map-$KERNELRELEASE-rpm"
138echo "rm -f /boot/vmlinuz-$KERNELRELEASE-rpm /boot/System.map-$KERNELRELEASE-rpm"
139echo "fi"
140echo ""
115echo "%files" 141echo "%files"
116echo '%defattr (-, root, root)' 142echo '%defattr (-, root, root)'
117echo "%dir /lib/modules" 143echo "%dir /lib/modules"
118echo "/lib/modules/$KERNELRELEASE" 144echo "/lib/modules/$KERNELRELEASE"
119echo "/lib/firmware" 145echo "%exclude /lib/modules/$KERNELRELEASE/build"
146echo "%exclude /lib/modules/$KERNELRELEASE/source"
147echo "/lib/firmware/$KERNELRELEASE"
120echo "/boot/*" 148echo "/boot/*"
121echo "" 149echo ""
122echo "%files headers" 150echo "%files headers"
123echo '%defattr (-, root, root)' 151echo '%defattr (-, root, root)'
124echo "/usr/include" 152echo "/usr/include"
125echo "" 153echo ""
154echo "%files devel"
155echo '%defattr (-, root, root)'
156echo "/usr/src/kernels/$KERNELRELEASE"
157echo "/lib/modules/$KERNELRELEASE/build"
158echo "/lib/modules/$KERNELRELEASE/source"
159echo ""
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
index 858966ab019c..a674fd5507c1 100755
--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -364,6 +364,10 @@ if ($arch eq "x86_64") {
364} elsif ($arch eq "blackfin") { 364} elsif ($arch eq "blackfin") {
365 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s__mcount\$"; 365 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s__mcount\$";
366 $mcount_adjust = -4; 366 $mcount_adjust = -4;
367} elsif ($arch eq "tilegx") {
368 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s__mcount\$";
369 $type = ".quad";
370 $alignment = 8;
367} else { 371} else {
368 die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD"; 372 die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD";
369} 373}
diff --git a/scripts/sortextable.c b/scripts/sortextable.c
index f9ce1160419b..7c2310c5b996 100644
--- a/scripts/sortextable.c
+++ b/scripts/sortextable.c
@@ -64,14 +64,6 @@ fail_file(void)
64 longjmp(jmpenv, SJ_FAIL); 64 longjmp(jmpenv, SJ_FAIL);
65} 65}
66 66
67static void __attribute__((noreturn))
68succeed_file(void)
69{
70 cleanup();
71 longjmp(jmpenv, SJ_SUCCEED);
72}
73
74
75/* 67/*
76 * Get the whole file as a programming convenience in order to avoid 68 * Get the whole file as a programming convenience in order to avoid
77 * malloc+lseek+read+free of many pieces. If successful, then mmap 69 * malloc+lseek+read+free of many pieces. If successful, then mmap