aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl189
-rw-r--r--scripts/gcc-goto.sh18
-rwxr-xr-xscripts/get_maintainer.pl11
-rw-r--r--scripts/kconfig/confdata.c26
-rwxr-xr-x[-rw-r--r--]scripts/kconfig/merge_config.sh15
-rw-r--r--scripts/kconfig/symbol.c9
-rwxr-xr-xscripts/kernel-doc3
-rw-r--r--scripts/mod/file2alias.c72
-rw-r--r--scripts/mod/modpost.c9
9 files changed, 285 insertions, 67 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e3bfcbe8a520..de639eeeed50 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -323,17 +323,22 @@ sub build_types {
323 }x; 323 }x;
324 $Type = qr{ 324 $Type = qr{
325 $NonptrType 325 $NonptrType
326 (?:[\s\*]+\s*const|[\s\*]+|(?:\s*\[\s*\])+)? 326 (?:(?:\s|\*|\[\])+\s*const|(?:\s|\*|\[\])+|(?:\s*\[\s*\])+)?
327 (?:\s+$Inline|\s+$Modifier)* 327 (?:\s+$Inline|\s+$Modifier)*
328 }x; 328 }x;
329 $Declare = qr{(?:$Storage\s+)?$Type}; 329 $Declare = qr{(?:$Storage\s+)?$Type};
330} 330}
331build_types(); 331build_types();
332 332
333our $match_balanced_parentheses = qr/(\((?:[^\(\)]+|(-1))*\))/;
334 333
335our $Typecast = qr{\s*(\(\s*$NonptrType\s*\)){0,1}\s*}; 334our $Typecast = qr{\s*(\(\s*$NonptrType\s*\)){0,1}\s*};
336our $LvalOrFunc = qr{($Lval)\s*($match_balanced_parentheses{0,1})\s*}; 335
336# Using $balanced_parens, $LvalOrFunc, or $FuncArg
337# requires at least perl version v5.10.0
338# Any use must be runtime checked with $^V
339
340our $balanced_parens = qr/(\((?:[^\(\)]++|(?-1))*\))/;
341our $LvalOrFunc = qr{($Lval)\s*($balanced_parens{0,1})\s*};
337our $FuncArg = qr{$Typecast{0,1}($LvalOrFunc|$Constant)}; 342our $FuncArg = qr{$Typecast{0,1}($LvalOrFunc|$Constant)};
338 343
339sub deparenthesize { 344sub deparenthesize {
@@ -1330,6 +1335,36 @@ sub check_absolute_file {
1330 } 1335 }
1331} 1336}
1332 1337
1338sub pos_last_openparen {
1339 my ($line) = @_;
1340
1341 my $pos = 0;
1342
1343 my $opens = $line =~ tr/\(/\(/;
1344 my $closes = $line =~ tr/\)/\)/;
1345
1346 my $last_openparen = 0;
1347
1348 if (($opens == 0) || ($closes >= $opens)) {
1349 return -1;
1350 }
1351
1352 my $len = length($line);
1353
1354 for ($pos = 0; $pos < $len; $pos++) {
1355 my $string = substr($line, $pos);
1356 if ($string =~ /^($FuncArg|$balanced_parens)/) {
1357 $pos += length($1) - 1;
1358 } elsif (substr($line, $pos, 1) eq '(') {
1359 $last_openparen = $pos;
1360 } elsif (index($string, '(') == -1) {
1361 last;
1362 }
1363 }
1364
1365 return $last_openparen + 1;
1366}
1367
1333sub process { 1368sub process {
1334 my $filename = shift; 1369 my $filename = shift;
1335 1370
@@ -1737,6 +1772,21 @@ sub process {
1737 "line over 80 characters\n" . $herecurr); 1772 "line over 80 characters\n" . $herecurr);
1738 } 1773 }
1739 1774
1775# Check for user-visible strings broken across lines, which breaks the ability
1776# to grep for the string. Limited to strings used as parameters (those
1777# following an open parenthesis), which almost completely eliminates false
1778# positives, as well as warning only once per parameter rather than once per
1779# line of the string. Make an exception when the previous string ends in a
1780# newline (multiple lines in one string constant) or \n\t (common in inline
1781# assembly to indent the instruction on the following line).
1782 if ($line =~ /^\+\s*"/ &&
1783 $prevline =~ /"\s*$/ &&
1784 $prevline =~ /\(/ &&
1785 $prevrawline !~ /\\n(?:\\t)*"\s*$/) {
1786 WARN("SPLIT_STRING",
1787 "quoted string split across lines\n" . $hereprev);
1788 }
1789
1740# check for spaces before a quoted newline 1790# check for spaces before a quoted newline
1741 if ($rawline =~ /^.*\".*\s\\n/) { 1791 if ($rawline =~ /^.*\".*\s\\n/) {
1742 WARN("QUOTED_WHITESPACE_BEFORE_NEWLINE", 1792 WARN("QUOTED_WHITESPACE_BEFORE_NEWLINE",
@@ -1783,6 +1833,48 @@ sub process {
1783 "please, no space before tabs\n" . $herevet); 1833 "please, no space before tabs\n" . $herevet);
1784 } 1834 }
1785 1835
1836# check for && or || at the start of a line
1837 if ($rawline =~ /^\+\s*(&&|\|\|)/) {
1838 CHK("LOGICAL_CONTINUATIONS",
1839 "Logical continuations should be on the previous line\n" . $hereprev);
1840 }
1841
1842# check multi-line statement indentation matches previous line
1843 if ($^V && $^V ge 5.10.0 &&
1844 $prevline =~ /^\+(\t*)(if \(|$Ident\().*(\&\&|\|\||,)\s*$/) {
1845 $prevline =~ /^\+(\t*)(.*)$/;
1846 my $oldindent = $1;
1847 my $rest = $2;
1848
1849 my $pos = pos_last_openparen($rest);
1850 if ($pos >= 0) {
1851 $line =~ /^\+([ \t]*)/;
1852 my $newindent = $1;
1853
1854 my $goodtabindent = $oldindent .
1855 "\t" x ($pos / 8) .
1856 " " x ($pos % 8);
1857 my $goodspaceindent = $oldindent . " " x $pos;
1858
1859 if ($newindent ne $goodtabindent &&
1860 $newindent ne $goodspaceindent) {
1861 CHK("PARENTHESIS_ALIGNMENT",
1862 "Alignment should match open parenthesis\n" . $hereprev);
1863 }
1864 }
1865 }
1866
1867 if ($line =~ /^\+.*\*[ \t]*\)[ \t]+/) {
1868 CHK("SPACING",
1869 "No space is necessary after a cast\n" . $hereprev);
1870 }
1871
1872 if ($rawline =~ /^\+[ \t]*\/\*[ \t]*$/ &&
1873 $prevrawline =~ /^\+[ \t]*$/) {
1874 CHK("BLOCK_COMMENT_STYLE",
1875 "Don't begin block comments with only a /* line, use /* comment...\n" . $hereprev);
1876 }
1877
1786# check for spaces at the beginning of a line. 1878# check for spaces at the beginning of a line.
1787# Exceptions: 1879# Exceptions:
1788# 1) within comments 1880# 1) within comments
@@ -1924,6 +2016,12 @@ sub process {
1924 my $pre_ctx = "$1$2"; 2016 my $pre_ctx = "$1$2";
1925 2017
1926 my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, 0); 2018 my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, 0);
2019
2020 if ($line =~ /^\+\t{6,}/) {
2021 WARN("DEEP_INDENTATION",
2022 "Too many leading tabs - consider code refactoring\n" . $herecurr);
2023 }
2024
1927 my $ctx_cnt = $realcnt - $#ctx - 1; 2025 my $ctx_cnt = $realcnt - $#ctx - 1;
1928 my $ctx = join("\n", @ctx); 2026 my $ctx = join("\n", @ctx);
1929 2027
@@ -2319,7 +2417,7 @@ sub process {
2319 my ($where, $prefix) = ($-[1], $1); 2417 my ($where, $prefix) = ($-[1], $1);
2320 if ($prefix !~ /$Type\s+$/ && 2418 if ($prefix !~ /$Type\s+$/ &&
2321 ($where != 0 || $prefix !~ /^.\s+$/) && 2419 ($where != 0 || $prefix !~ /^.\s+$/) &&
2322 $prefix !~ /{\s+$/) { 2420 $prefix !~ /[{,]\s+$/) {
2323 ERROR("BRACKET_SPACE", 2421 ERROR("BRACKET_SPACE",
2324 "space prohibited before open square bracket '['\n" . $herecurr); 2422 "space prohibited before open square bracket '['\n" . $herecurr);
2325 } 2423 }
@@ -2822,6 +2920,12 @@ sub process {
2822 { 2920 {
2823 } 2921 }
2824 2922
2923 # Flatten any obvious string concatentation.
2924 while ($dstat =~ s/("X*")\s*$Ident/$1/ ||
2925 $dstat =~ s/$Ident\s*("X*")/$1/)
2926 {
2927 }
2928
2825 my $exceptions = qr{ 2929 my $exceptions = qr{
2826 $Declare| 2930 $Declare|
2827 module_param_named| 2931 module_param_named|
@@ -2838,7 +2942,8 @@ sub process {
2838 if ($dstat ne '' && 2942 if ($dstat ne '' &&
2839 $dstat !~ /^(?:$Ident|-?$Constant),$/ && # 10, // foo(), 2943 $dstat !~ /^(?:$Ident|-?$Constant),$/ && # 10, // foo(),
2840 $dstat !~ /^(?:$Ident|-?$Constant);$/ && # foo(); 2944 $dstat !~ /^(?:$Ident|-?$Constant);$/ && # foo();
2841 $dstat !~ /^(?:$Ident|-?$Constant)$/ && # 10 // foo() 2945 $dstat !~ /^[!~-]?(?:$Ident|$Constant)$/ && # 10 // foo() // !foo // ~foo // -foo
2946 $dstat !~ /^'X'$/ && # character constants
2842 $dstat !~ /$exceptions/ && 2947 $dstat !~ /$exceptions/ &&
2843 $dstat !~ /^\.$Ident\s*=/ && # .foo = 2948 $dstat !~ /^\.$Ident\s*=/ && # .foo =
2844 $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (...) 2949 $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (...)
@@ -2882,7 +2987,8 @@ sub process {
2882 #print "chunks<$#chunks> linenr<$linenr> endln<$endln> level<$level>\n"; 2987 #print "chunks<$#chunks> linenr<$linenr> endln<$endln> level<$level>\n";
2883 #print "APW: <<$chunks[1][0]>><<$chunks[1][1]>>\n"; 2988 #print "APW: <<$chunks[1][0]>><<$chunks[1][1]>>\n";
2884 if ($#chunks > 0 && $level == 0) { 2989 if ($#chunks > 0 && $level == 0) {
2885 my $allowed = 0; 2990 my @allowed = ();
2991 my $allow = 0;
2886 my $seen = 0; 2992 my $seen = 0;
2887 my $herectx = $here . "\n"; 2993 my $herectx = $here . "\n";
2888 my $ln = $linenr - 1; 2994 my $ln = $linenr - 1;
@@ -2893,6 +2999,7 @@ sub process {
2893 my ($whitespace) = ($cond =~ /^((?:\s*\n[+-])*\s*)/s); 2999 my ($whitespace) = ($cond =~ /^((?:\s*\n[+-])*\s*)/s);
2894 my $offset = statement_rawlines($whitespace) - 1; 3000 my $offset = statement_rawlines($whitespace) - 1;
2895 3001
3002 $allowed[$allow] = 0;
2896 #print "COND<$cond> whitespace<$whitespace> offset<$offset>\n"; 3003 #print "COND<$cond> whitespace<$whitespace> offset<$offset>\n";
2897 3004
2898 # We have looked at and allowed this specific line. 3005 # We have looked at and allowed this specific line.
@@ -2905,23 +3012,34 @@ sub process {
2905 3012
2906 $seen++ if ($block =~ /^\s*{/); 3013 $seen++ if ($block =~ /^\s*{/);
2907 3014
2908 #print "cond<$cond> block<$block> allowed<$allowed>\n"; 3015 #print "cond<$cond> block<$block> allowed<$allowed[$allow]>\n";
2909 if (statement_lines($cond) > 1) { 3016 if (statement_lines($cond) > 1) {
2910 #print "APW: ALLOWED: cond<$cond>\n"; 3017 #print "APW: ALLOWED: cond<$cond>\n";
2911 $allowed = 1; 3018 $allowed[$allow] = 1;
2912 } 3019 }
2913 if ($block =~/\b(?:if|for|while)\b/) { 3020 if ($block =~/\b(?:if|for|while)\b/) {
2914 #print "APW: ALLOWED: block<$block>\n"; 3021 #print "APW: ALLOWED: block<$block>\n";
2915 $allowed = 1; 3022 $allowed[$allow] = 1;
2916 } 3023 }
2917 if (statement_block_size($block) > 1) { 3024 if (statement_block_size($block) > 1) {
2918 #print "APW: ALLOWED: lines block<$block>\n"; 3025 #print "APW: ALLOWED: lines block<$block>\n";
2919 $allowed = 1; 3026 $allowed[$allow] = 1;
2920 } 3027 }
3028 $allow++;
2921 } 3029 }
2922 if ($seen && !$allowed) { 3030 if ($seen) {
2923 WARN("BRACES", 3031 my $sum_allowed = 0;
2924 "braces {} are not necessary for any arm of this statement\n" . $herectx); 3032 foreach (@allowed) {
3033 $sum_allowed += $_;
3034 }
3035 if ($sum_allowed == 0) {
3036 WARN("BRACES",
3037 "braces {} are not necessary for any arm of this statement\n" . $herectx);
3038 } elsif ($sum_allowed != $allow &&
3039 $seen != $allow) {
3040 CHK("BRACES",
3041 "braces {} should be used on all arms of this statement\n" . $herectx);
3042 }
2925 } 3043 }
2926 } 3044 }
2927 } 3045 }
@@ -3117,6 +3235,12 @@ sub process {
3117 "__printf(string-index, first-to-check) is preferred over __attribute__((format(printf, string-index, first-to-check)))\n" . $herecurr); 3235 "__printf(string-index, first-to-check) is preferred over __attribute__((format(printf, string-index, first-to-check)))\n" . $herecurr);
3118 } 3236 }
3119 3237
3238# Check for __attribute__ format(scanf, prefer __scanf
3239 if ($line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*scanf\b/) {
3240 WARN("PREFER_SCANF",
3241 "__scanf(string-index, first-to-check) is preferred over __attribute__((format(scanf, string-index, first-to-check)))\n" . $herecurr);
3242 }
3243
3120# check for sizeof(&) 3244# check for sizeof(&)
3121 if ($line =~ /\bsizeof\s*\(\s*\&/) { 3245 if ($line =~ /\bsizeof\s*\(\s*\&/) {
3122 WARN("SIZEOF_ADDRESS", 3246 WARN("SIZEOF_ADDRESS",
@@ -3130,12 +3254,13 @@ sub process {
3130 } 3254 }
3131 3255
3132# Check for misused memsets 3256# Check for misused memsets
3133 if (defined $stat && 3257 if ($^V && $^V ge 5.10.0 &&
3258 defined $stat &&
3134 $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*$FuncArg\s*\)/s) { 3259 $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*$FuncArg\s*\)/s) {
3135 3260
3136 my $ms_addr = $2; 3261 my $ms_addr = $2;
3137 my $ms_val = $8; 3262 my $ms_val = $7;
3138 my $ms_size = $14; 3263 my $ms_size = $12;
3139 3264
3140 if ($ms_size =~ /^(0x|)0$/i) { 3265 if ($ms_size =~ /^(0x|)0$/i) {
3141 ERROR("MEMSET", 3266 ERROR("MEMSET",
@@ -3147,17 +3272,18 @@ sub process {
3147 } 3272 }
3148 3273
3149# typecasts on min/max could be min_t/max_t 3274# typecasts on min/max could be min_t/max_t
3150 if (defined $stat && 3275 if ($^V && $^V ge 5.10.0 &&
3276 defined $stat &&
3151 $stat =~ /^\+(?:.*?)\b(min|max)\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\)/) { 3277 $stat =~ /^\+(?:.*?)\b(min|max)\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\)/) {
3152 if (defined $2 || defined $8) { 3278 if (defined $2 || defined $7) {
3153 my $call = $1; 3279 my $call = $1;
3154 my $cast1 = deparenthesize($2); 3280 my $cast1 = deparenthesize($2);
3155 my $arg1 = $3; 3281 my $arg1 = $3;
3156 my $cast2 = deparenthesize($8); 3282 my $cast2 = deparenthesize($7);
3157 my $arg2 = $9; 3283 my $arg2 = $8;
3158 my $cast; 3284 my $cast;
3159 3285
3160 if ($cast1 ne "" && $cast2 ne "") { 3286 if ($cast1 ne "" && $cast2 ne "" && $cast1 ne $cast2) {
3161 $cast = "$cast1 or $cast2"; 3287 $cast = "$cast1 or $cast2";
3162 } elsif ($cast1 ne "") { 3288 } elsif ($cast1 ne "") {
3163 $cast = $cast1; 3289 $cast = $cast1;
@@ -3227,22 +3353,30 @@ sub process {
3227 "__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr); 3353 "__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr);
3228 } 3354 }
3229 3355
3356# check for use of yield()
3357 if ($line =~ /\byield\s*\(\s*\)/) {
3358 WARN("YIELD",
3359 "Using yield() is generally wrong. See yield() kernel-doc (sched/core.c)\n" . $herecurr);
3360 }
3361
3230# check for semaphores initialized locked 3362# check for semaphores initialized locked
3231 if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) { 3363 if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) {
3232 WARN("CONSIDER_COMPLETION", 3364 WARN("CONSIDER_COMPLETION",
3233 "consider using a completion\n" . $herecurr); 3365 "consider using a completion\n" . $herecurr);
3234
3235 } 3366 }
3367
3236# recommend kstrto* over simple_strto* and strict_strto* 3368# recommend kstrto* over simple_strto* and strict_strto*
3237 if ($line =~ /\b((simple|strict)_(strto(l|ll|ul|ull)))\s*\(/) { 3369 if ($line =~ /\b((simple|strict)_(strto(l|ll|ul|ull)))\s*\(/) {
3238 WARN("CONSIDER_KSTRTO", 3370 WARN("CONSIDER_KSTRTO",
3239 "$1 is obsolete, use k$3 instead\n" . $herecurr); 3371 "$1 is obsolete, use k$3 instead\n" . $herecurr);
3240 } 3372 }
3373
3241# check for __initcall(), use device_initcall() explicitly please 3374# check for __initcall(), use device_initcall() explicitly please
3242 if ($line =~ /^.\s*__initcall\s*\(/) { 3375 if ($line =~ /^.\s*__initcall\s*\(/) {
3243 WARN("USE_DEVICE_INITCALL", 3376 WARN("USE_DEVICE_INITCALL",
3244 "please use device_initcall() instead of __initcall()\n" . $herecurr); 3377 "please use device_initcall() instead of __initcall()\n" . $herecurr);
3245 } 3378 }
3379
3246# check for various ops structs, ensure they are const. 3380# check for various ops structs, ensure they are const.
3247 my $struct_ops = qr{acpi_dock_ops| 3381 my $struct_ops = qr{acpi_dock_ops|
3248 address_space_operations| 3382 address_space_operations|
@@ -3379,6 +3513,12 @@ sub process {
3379 } 3513 }
3380 3514
3381 if ($quiet == 0) { 3515 if ($quiet == 0) {
3516
3517 if ($^V lt 5.10.0) {
3518 print("NOTE: perl $^V is not modern enough to detect all possible issues.\n");
3519 print("An upgrade to at least perl v5.10.0 is suggested.\n\n");
3520 }
3521
3382 # If there were whitespace errors which cleanpatch can fix 3522 # If there were whitespace errors which cleanpatch can fix
3383 # then suggest that. 3523 # then suggest that.
3384 if ($rpt_cleaners) { 3524 if ($rpt_cleaners) {
@@ -3388,13 +3528,12 @@ sub process {
3388 } 3528 }
3389 } 3529 }
3390 3530
3391 if (keys %ignore_type) { 3531 if ($quiet == 0 && keys %ignore_type) {
3392 print "NOTE: Ignored message types:"; 3532 print "NOTE: Ignored message types:";
3393 foreach my $ignore (sort keys %ignore_type) { 3533 foreach my $ignore (sort keys %ignore_type) {
3394 print " $ignore"; 3534 print " $ignore";
3395 } 3535 }
3396 print "\n"; 3536 print "\n\n";
3397 print "\n" if ($quiet == 0);
3398 } 3537 }
3399 3538
3400 if ($clean == 1 && $quiet == 0) { 3539 if ($clean == 1 && $quiet == 0) {
diff --git a/scripts/gcc-goto.sh b/scripts/gcc-goto.sh
index 98cffcb941ea..a2af2e88daf3 100644
--- a/scripts/gcc-goto.sh
+++ b/scripts/gcc-goto.sh
@@ -2,4 +2,20 @@
2# Test for gcc 'asm goto' support 2# Test for gcc 'asm goto' support
3# Copyright (C) 2010, Jason Baron <jbaron@redhat.com> 3# Copyright (C) 2010, Jason Baron <jbaron@redhat.com>
4 4
5echo "int main(void) { entry: asm goto (\"\"::::entry); return 0; }" | $@ -x c - -c -o /dev/null >/dev/null 2>&1 && echo "y" 5cat << "END" | $@ -x c - -c -o /dev/null >/dev/null 2>&1 && echo "y"
6int main(void)
7{
8#ifdef __arm__
9 /*
10 * Not related to asm goto, but used by jump label
11 * and broken on some ARM GCC versions (see GCC Bug 48637).
12 */
13 static struct { int dummy; int state; } tp;
14 asm (".long %c0" :: "i" (&tp.state));
15#endif
16
17entry:
18 asm goto ("" :::: entry);
19 return 0;
20}
21END
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index f32a04c4c5bc..0948c6b5a321 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -931,7 +931,7 @@ sub get_maintainer_role {
931 my $start = find_starting_index($index); 931 my $start = find_starting_index($index);
932 my $end = find_ending_index($index); 932 my $end = find_ending_index($index);
933 933
934 my $role; 934 my $role = "unknown";
935 my $subsystem = $typevalue[$start]; 935 my $subsystem = $typevalue[$start];
936 if (length($subsystem) > 20) { 936 if (length($subsystem) > 20) {
937 $subsystem = substr($subsystem, 0, 17); 937 $subsystem = substr($subsystem, 0, 17);
@@ -1027,8 +1027,13 @@ sub add_categories {
1027 if ($email_list) { 1027 if ($email_list) {
1028 if (!$hash_list_to{lc($list_address)}) { 1028 if (!$hash_list_to{lc($list_address)}) {
1029 $hash_list_to{lc($list_address)} = 1; 1029 $hash_list_to{lc($list_address)} = 1;
1030 push(@list_to, [$list_address, 1030 if ($list_additional =~ m/moderated/) {
1031 "open list${list_role}"]); 1031 push(@list_to, [$list_address,
1032 "moderated list${list_role}"]);
1033 } else {
1034 push(@list_to, [$list_address,
1035 "open list${list_role}"]);
1036 }
1032 } 1037 }
1033 } 1038 }
1034 } 1039 }
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 7c7a5a6cc3f5..0586085136d1 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -344,10 +344,8 @@ setsym:
344 344
345int conf_read(const char *name) 345int conf_read(const char *name)
346{ 346{
347 struct symbol *sym, *choice_sym; 347 struct symbol *sym;
348 struct property *prop; 348 int i;
349 struct expr *e;
350 int i, flags;
351 349
352 sym_set_change_count(0); 350 sym_set_change_count(0);
353 351
@@ -357,7 +355,7 @@ int conf_read(const char *name)
357 for_all_symbols(i, sym) { 355 for_all_symbols(i, sym) {
358 sym_calc_value(sym); 356 sym_calc_value(sym);
359 if (sym_is_choice(sym) || (sym->flags & SYMBOL_AUTO)) 357 if (sym_is_choice(sym) || (sym->flags & SYMBOL_AUTO))
360 goto sym_ok; 358 continue;
361 if (sym_has_value(sym) && (sym->flags & SYMBOL_WRITE)) { 359 if (sym_has_value(sym) && (sym->flags & SYMBOL_WRITE)) {
362 /* check that calculated value agrees with saved value */ 360 /* check that calculated value agrees with saved value */
363 switch (sym->type) { 361 switch (sym->type) {
@@ -366,30 +364,18 @@ int conf_read(const char *name)
366 if (sym->def[S_DEF_USER].tri != sym_get_tristate_value(sym)) 364 if (sym->def[S_DEF_USER].tri != sym_get_tristate_value(sym))
367 break; 365 break;
368 if (!sym_is_choice(sym)) 366 if (!sym_is_choice(sym))
369 goto sym_ok; 367 continue;
370 /* fall through */ 368 /* fall through */
371 default: 369 default:
372 if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val)) 370 if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val))
373 goto sym_ok; 371 continue;
374 break; 372 break;
375 } 373 }
376 } else if (!sym_has_value(sym) && !(sym->flags & SYMBOL_WRITE)) 374 } else if (!sym_has_value(sym) && !(sym->flags & SYMBOL_WRITE))
377 /* no previous value and not saved */ 375 /* no previous value and not saved */
378 goto sym_ok; 376 continue;
379 conf_unsaved++; 377 conf_unsaved++;
380 /* maybe print value in verbose mode... */ 378 /* maybe print value in verbose mode... */
381 sym_ok:
382 if (!sym_is_choice(sym))
383 continue;
384 /* The choice symbol only has a set value (and thus is not new)
385 * if all its visible childs have values.
386 */
387 prop = sym_get_choice_prop(sym);
388 flags = sym->flags;
389 expr_list_for_each_sym(prop->expr, e, choice_sym)
390 if (choice_sym->visible != no)
391 flags &= choice_sym->flags;
392 sym->flags &= flags | ~SYMBOL_DEF_USER;
393 } 379 }
394 380
395 for_all_symbols(i, sym) { 381 for_all_symbols(i, sym) {
diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
index ceadf0e150cf..974d5cb7e30a 100644..100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -31,10 +31,12 @@ usage() {
31 echo " -h display this help text" 31 echo " -h display this help text"
32 echo " -m only merge the fragments, do not execute the make command" 32 echo " -m only merge the fragments, do not execute the make command"
33 echo " -n use allnoconfig instead of alldefconfig" 33 echo " -n use allnoconfig instead of alldefconfig"
34 echo " -r list redundant entries when merging fragments"
34} 35}
35 36
36MAKE=true 37MAKE=true
37ALLTARGET=alldefconfig 38ALLTARGET=alldefconfig
39WARNREDUN=false
38 40
39while true; do 41while true; do
40 case $1 in 42 case $1 in
@@ -52,18 +54,27 @@ while true; do
52 usage 54 usage
53 exit 55 exit
54 ;; 56 ;;
57 "-r")
58 WARNREDUN=true
59 shift
60 continue
61 ;;
55 *) 62 *)
56 break 63 break
57 ;; 64 ;;
58 esac 65 esac
59done 66done
60 67
61 68INITFILE=$1
69shift;
62 70
63MERGE_LIST=$* 71MERGE_LIST=$*
64SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p" 72SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p"
65TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX) 73TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX)
66 74
75echo "Using $INITFILE as base"
76cat $INITFILE > $TMP_FILE
77
67# Merge files, printing warnings on overrided values 78# Merge files, printing warnings on overrided values
68for MERGE_FILE in $MERGE_LIST ; do 79for MERGE_FILE in $MERGE_LIST ; do
69 echo "Merging $MERGE_FILE" 80 echo "Merging $MERGE_FILE"
@@ -79,6 +90,8 @@ for MERGE_FILE in $MERGE_LIST ; do
79 echo Previous value: $PREV_VAL 90 echo Previous value: $PREV_VAL
80 echo New value: $NEW_VAL 91 echo New value: $NEW_VAL
81 echo 92 echo
93 elif [ "$WARNREDUN" = "true" ]; then
94 echo Value of $CFG is redundant by fragment $MERGE_FILE:
82 fi 95 fi
83 sed -i "/$CFG[ =]/d" $TMP_FILE 96 sed -i "/$CFG[ =]/d" $TMP_FILE
84 fi 97 fi
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 071f00c3046e..22a3c400fc41 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -262,11 +262,18 @@ static struct symbol *sym_calc_choice(struct symbol *sym)
262 struct symbol *def_sym; 262 struct symbol *def_sym;
263 struct property *prop; 263 struct property *prop;
264 struct expr *e; 264 struct expr *e;
265 int flags;
265 266
266 /* first calculate all choice values' visibilities */ 267 /* first calculate all choice values' visibilities */
268 flags = sym->flags;
267 prop = sym_get_choice_prop(sym); 269 prop = sym_get_choice_prop(sym);
268 expr_list_for_each_sym(prop->expr, e, def_sym) 270 expr_list_for_each_sym(prop->expr, e, def_sym) {
269 sym_calc_visibility(def_sym); 271 sym_calc_visibility(def_sym);
272 if (def_sym->visible != no)
273 flags &= def_sym->flags;
274 }
275
276 sym->flags &= flags | ~SYMBOL_DEF_USER;
270 277
271 /* is the user choice visible? */ 278 /* is the user choice visible? */
272 def_sym = sym->def[S_DEF_USER].val; 279 def_sym = sym->def[S_DEF_USER].val;
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index d793001929cf..9b0c0b8b4ab4 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -5,7 +5,7 @@ use strict;
5## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ## 5## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ##
6## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ## 6## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ##
7## Copyright (C) 2001 Simon Huggins ## 7## Copyright (C) 2001 Simon Huggins ##
8## Copyright (C) 2005-2010 Randy Dunlap ## 8## Copyright (C) 2005-2012 Randy Dunlap ##
9## ## 9## ##
10## #define enhancements by Armin Kuster <akuster@mvista.com> ## 10## #define enhancements by Armin Kuster <akuster@mvista.com> ##
11## Copyright (c) 2000 MontaVista Software, Inc. ## 11## Copyright (c) 2000 MontaVista Software, Inc. ##
@@ -1785,6 +1785,7 @@ sub dump_function($$) {
1785 $prototype =~ s/__devinit +//; 1785 $prototype =~ s/__devinit +//;
1786 $prototype =~ s/__init +//; 1786 $prototype =~ s/__init +//;
1787 $prototype =~ s/__init_or_module +//; 1787 $prototype =~ s/__init_or_module +//;
1788 $prototype =~ s/__must_check +//;
1788 $prototype =~ s/^#\s*define\s+//; #ak added 1789 $prototype =~ s/^#\s*define\s+//; #ak added
1789 $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//; 1790 $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//;
1790 1791
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index c0e14b3f2306..8e730ccc3f2b 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -46,11 +46,37 @@ struct devtable {
46 void *function; 46 void *function;
47}; 47};
48 48
49#define ___cat(a,b) a ## b
50#define __cat(a,b) ___cat(a,b)
51
52/* we need some special handling for this host tool running eventually on
53 * Darwin. The Mach-O section handling is a bit different than ELF section
54 * handling. The differnces in detail are:
55 * a) we have segments which have sections
56 * b) we need a API call to get the respective section symbols */
57#if defined(__MACH__)
58#include <mach-o/getsect.h>
59
60#define INIT_SECTION(name) do { \
61 unsigned long name ## _len; \
62 char *__cat(pstart_,name) = getsectdata("__TEXT", \
63 #name, &__cat(name,_len)); \
64 char *__cat(pstop_,name) = __cat(pstart_,name) + \
65 __cat(name, _len); \
66 __cat(__start_,name) = (void *)__cat(pstart_,name); \
67 __cat(__stop_,name) = (void *)__cat(pstop_,name); \
68 } while (0)
69#define SECTION(name) __attribute__((section("__TEXT, " #name)))
70
71struct devtable **__start___devtable, **__stop___devtable;
72#else
73#define INIT_SECTION(name) /* no-op for ELF */
74#define SECTION(name) __attribute__((section(#name)))
75
49/* We construct a table of pointers in an ELF section (pointers generally 76/* We construct a table of pointers in an ELF section (pointers generally
50 * go unpadded by gcc). ld creates boundary syms for us. */ 77 * go unpadded by gcc). ld creates boundary syms for us. */
51extern struct devtable *__start___devtable[], *__stop___devtable[]; 78extern struct devtable *__start___devtable[], *__stop___devtable[];
52#define ___cat(a,b) a ## b 79#endif /* __MACH__ */
53#define __cat(a,b) ___cat(a,b)
54 80
55#if __GNUC__ == 3 && __GNUC_MINOR__ < 3 81#if __GNUC__ == 3 && __GNUC_MINOR__ < 3
56# define __used __attribute__((__unused__)) 82# define __used __attribute__((__unused__))
@@ -65,8 +91,8 @@ extern struct devtable *__start___devtable[], *__stop___devtable[];
65 (type *)NULL, \ 91 (type *)NULL, \
66 (char *)NULL)), \ 92 (char *)NULL)), \
67 sizeof(type), (function) }; \ 93 sizeof(type), (function) }; \
68 static struct devtable *__attribute__((section("__devtable"))) \ 94 static struct devtable *SECTION(__devtable) __used \
69 __used __cat(devtable_ptr,__LINE__) = &__cat(devtable,__LINE__) 95 __cat(devtable_ptr,__LINE__) = &__cat(devtable,__LINE__)
70 96
71#define ADD(str, sep, cond, field) \ 97#define ADD(str, sep, cond, field) \
72do { \ 98do { \
@@ -823,16 +849,6 @@ static int do_spi_entry(const char *filename, struct spi_device_id *id,
823} 849}
824ADD_TO_DEVTABLE("spi", struct spi_device_id, do_spi_entry); 850ADD_TO_DEVTABLE("spi", struct spi_device_id, do_spi_entry);
825 851
826/* Looks like: mcp:S */
827static int do_mcp_entry(const char *filename, struct mcp_device_id *id,
828 char *alias)
829{
830 sprintf(alias, MCP_MODULE_PREFIX "%s", id->name);
831
832 return 1;
833}
834ADD_TO_DEVTABLE("mcp", struct mcp_device_id, do_mcp_entry);
835
836static const struct dmifield { 852static const struct dmifield {
837 const char *prefix; 853 const char *prefix;
838 int field; 854 int field;
@@ -942,7 +958,7 @@ static int do_isapnp_entry(const char *filename,
942 (id->function >> 12) & 0x0f, (id->function >> 8) & 0x0f); 958 (id->function >> 12) & 0x0f, (id->function >> 8) & 0x0f);
943 return 1; 959 return 1;
944} 960}
945ADD_TO_DEVTABLE("isa", struct isapnp_device_id, do_isapnp_entry); 961ADD_TO_DEVTABLE("isapnp", struct isapnp_device_id, do_isapnp_entry);
946 962
947/* 963/*
948 * Append a match expression for a single masked hex digit. 964 * Append a match expression for a single masked hex digit.
@@ -1013,6 +1029,31 @@ static int do_amba_entry(const char *filename,
1013} 1029}
1014ADD_TO_DEVTABLE("amba", struct amba_id, do_amba_entry); 1030ADD_TO_DEVTABLE("amba", struct amba_id, do_amba_entry);
1015 1031
1032/* LOOKS like x86cpu:vendor:VVVV:family:FFFF:model:MMMM:feature:*,FEAT,*
1033 * All fields are numbers. It would be nicer to use strings for vendor
1034 * and feature, but getting those out of the build system here is too
1035 * complicated.
1036 */
1037
1038static int do_x86cpu_entry(const char *filename, struct x86_cpu_id *id,
1039 char *alias)
1040{
1041 id->feature = TO_NATIVE(id->feature);
1042 id->family = TO_NATIVE(id->family);
1043 id->model = TO_NATIVE(id->model);
1044 id->vendor = TO_NATIVE(id->vendor);
1045
1046 strcpy(alias, "x86cpu:");
1047 ADD(alias, "vendor:", id->vendor != X86_VENDOR_ANY, id->vendor);
1048 ADD(alias, ":family:", id->family != X86_FAMILY_ANY, id->family);
1049 ADD(alias, ":model:", id->model != X86_MODEL_ANY, id->model);
1050 strcat(alias, ":feature:*");
1051 if (id->feature != X86_FEATURE_ANY)
1052 sprintf(alias + strlen(alias), "%04X*", id->feature);
1053 return 1;
1054}
1055ADD_TO_DEVTABLE("x86cpu", struct x86_cpu_id, do_x86cpu_entry);
1056
1016/* Does namelen bytes of name exactly match the symbol? */ 1057/* Does namelen bytes of name exactly match the symbol? */
1017static bool sym_is(const char *name, unsigned namelen, const char *symbol) 1058static bool sym_is(const char *name, unsigned namelen, const char *symbol)
1018{ 1059{
@@ -1090,6 +1131,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
1090 do_pnp_card_entries(symval, sym->st_size, mod); 1131 do_pnp_card_entries(symval, sym->st_size, mod);
1091 else { 1132 else {
1092 struct devtable **p; 1133 struct devtable **p;
1134 INIT_SECTION(__devtable);
1093 1135
1094 for (p = __start___devtable; p < __stop___devtable; p++) { 1136 for (p = __start___devtable; p < __stop___devtable; p++) {
1095 if (sym_is(name, namelen, (*p)->device_id)) { 1137 if (sym_is(name, namelen, (*p)->device_id)) {
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 2bd594e6d1b4..9adb667dd31a 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1494,6 +1494,13 @@ static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
1494 return 0; 1494 return 0;
1495} 1495}
1496 1496
1497#ifndef R_ARM_CALL
1498#define R_ARM_CALL 28
1499#endif
1500#ifndef R_ARM_JUMP24
1501#define R_ARM_JUMP24 29
1502#endif
1503
1497static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) 1504static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
1498{ 1505{
1499 unsigned int r_typ = ELF_R_TYPE(r->r_info); 1506 unsigned int r_typ = ELF_R_TYPE(r->r_info);
@@ -1505,6 +1512,8 @@ static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
1505 (elf->symtab_start + ELF_R_SYM(r->r_info)); 1512 (elf->symtab_start + ELF_R_SYM(r->r_info));
1506 break; 1513 break;
1507 case R_ARM_PC24: 1514 case R_ARM_PC24:
1515 case R_ARM_CALL:
1516 case R_ARM_JUMP24:
1508 /* From ARM ABI: ((S + A) | T) - P */ 1517 /* From ARM ABI: ((S + A) | T) - P */
1509 r->r_addend = (int)(long)(elf->hdr + 1518 r->r_addend = (int)(long)(elf->hdr +
1510 sechdr->sh_offset + 1519 sechdr->sh_offset +