aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/Lindent18
-rw-r--r--scripts/Makefile.build6
-rw-r--r--scripts/Makefile.clean2
-rw-r--r--scripts/Makefile.host12
-rw-r--r--scripts/Makefile.modpost8
-rwxr-xr-xscripts/checkpatch.pl157
-rw-r--r--scripts/gen_initramfs_list.sh2
-rw-r--r--scripts/kallsyms.c6
-rw-r--r--scripts/kconfig/Makefile4
-rw-r--r--scripts/kconfig/lex.zconf.c_shipped25
-rw-r--r--scripts/kconfig/lkc_proto.h2
-rw-r--r--scripts/kconfig/lxdialog/check-lxdialog.sh6
-rw-r--r--scripts/kconfig/lxdialog/inputbox.c2
-rw-r--r--scripts/kconfig/menu.c64
-rw-r--r--scripts/kconfig/symbol.c118
-rw-r--r--scripts/kconfig/zconf.tab.c_shipped301
-rw-r--r--scripts/kconfig/zconf.y13
-rwxr-xr-xscripts/kernel-doc25
-rw-r--r--scripts/mod/file2alias.c70
-rw-r--r--scripts/mod/modpost.c27
20 files changed, 540 insertions, 328 deletions
diff --git a/scripts/Lindent b/scripts/Lindent
index 9468ec7971db..9c4b3e2b7098 100755
--- a/scripts/Lindent
+++ b/scripts/Lindent
@@ -1,2 +1,18 @@
1#!/bin/sh 1#!/bin/sh
2indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs -cp1 "$@" 2PARAM="-npro -kr -i8 -ts8 -sob -l80 -ss -ncs -cp1"
3RES=`indent --version`
4V1=`echo $RES | cut -d' ' -f3 | cut -d'.' -f1`
5V2=`echo $RES | cut -d' ' -f3 | cut -d'.' -f2`
6V3=`echo $RES | cut -d' ' -f3 | cut -d'.' -f3`
7if [ $V1 -gt 2 ]; then
8 PARAM="$PARAM -il0"
9elif [ $V1 -eq 2 ]; then
10 if [ $V2 -gt 2 ]; then
11 PARAM="$PARAM -il0";
12 elif [ $V2 -eq 2 ]; then
13 if [ $V3 -ge 10 ]; then
14 PARAM="$PARAM -il0"
15 fi
16 fi
17fi
18indent $PARAM "$@"
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 67fb4530a6ff..277cfe0b7100 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -27,12 +27,12 @@ ccflags-y :=
27cppflags-y := 27cppflags-y :=
28ldflags-y := 28ldflags-y :=
29 29
30# Read .config if it exist, otherwise ignore 30# Read auto.conf if it exists, otherwise ignore
31-include include/config/auto.conf 31-include include/config/auto.conf
32 32
33include scripts/Kbuild.include 33include scripts/Kbuild.include
34 34
35# For backward compatibility check that these variables does not change 35# For backward compatibility check that these variables do not change
36save-cflags := $(CFLAGS) 36save-cflags := $(CFLAGS)
37 37
38# The filename Kbuild has precedence over Makefile 38# The filename Kbuild has precedence over Makefile
@@ -55,7 +55,7 @@ hostprogs-y += $(host-progs)
55endif 55endif
56endif 56endif
57 57
58# Do not include host rules unles needed 58# Do not include host rules unless needed
59ifneq ($(hostprogs-y)$(hostprogs-m),) 59ifneq ($(hostprogs-y)$(hostprogs-m),)
60include scripts/Makefile.host 60include scripts/Makefile.host
61endif 61endif
diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean
index 2c647107c9cc..6f89fbb56256 100644
--- a/scripts/Makefile.clean
+++ b/scripts/Makefile.clean
@@ -37,7 +37,7 @@ subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-))
37 37
38subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn)) 38subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn))
39 39
40# build a list of files to remove, usually releative to the current 40# build a list of files to remove, usually relative to the current
41# directory 41# directory
42 42
43__clean-files := $(extra-y) $(always) \ 43__clean-files := $(extra-y) $(always) \
diff --git a/scripts/Makefile.host b/scripts/Makefile.host
index 6943a7a5bb98..1ac414fd5030 100644
--- a/scripts/Makefile.host
+++ b/scripts/Makefile.host
@@ -3,9 +3,9 @@
3# Binaries are used during the compilation of the kernel, for example 3# Binaries are used during the compilation of the kernel, for example
4# to preprocess a data file. 4# to preprocess a data file.
5# 5#
6# Both C and C++ is supported, but preferred language is C for such utilities. 6# Both C and C++ are supported, but preferred language is C for such utilities.
7# 7#
8# Samle syntax (see Documentation/kbuild/makefile.txt for reference) 8# Sample syntax (see Documentation/kbuild/makefiles.txt for reference)
9# hostprogs-y := bin2hex 9# hostprogs-y := bin2hex
10# Will compile bin2hex.c and create an executable named bin2hex 10# Will compile bin2hex.c and create an executable named bin2hex
11# 11#
@@ -23,10 +23,10 @@
23# hostprogs-y := conf 23# hostprogs-y := conf
24# conf-objs := conf.o libkconfig.so 24# conf-objs := conf.o libkconfig.so
25# libkconfig-objs := expr.o type.o 25# libkconfig-objs := expr.o type.o
26# Will create a shared library named libkconfig.so that consist of 26# Will create a shared library named libkconfig.so that consists of
27# expr.o and type.o (they are both compiled as C code and the object file 27# expr.o and type.o (they are both compiled as C code and the object files
28# are made as position independent code). 28# are made as position independent code).
29# conf.c is compiled as a c program, and conf.o is linked together with 29# conf.c is compiled as a C program, and conf.o is linked together with
30# libkconfig.so as the executable conf. 30# libkconfig.so as the executable conf.
31# Note: Shared libraries consisting of C++ files are not supported 31# Note: Shared libraries consisting of C++ files are not supported
32 32
@@ -61,7 +61,7 @@ host-cobjs := $(filter-out %.so,$(host-cobjs))
61host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs)))) 61host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs))))
62 62
63# output directory for programs/.o files 63# output directory for programs/.o files
64# hostprogs-y := tools/build may have been specified. Retreive directory 64# hostprogs-y := tools/build may have been specified. Retrieve directory
65host-objdirs := $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f)))) 65host-objdirs := $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f))))
66# directory of .o files from prog-objs notation 66# directory of .o files from prog-objs notation
67host-objdirs += $(foreach f,$(host-cmulti), \ 67host-objdirs += $(foreach f,$(host-cmulti), \
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 2d20640854b7..a098a0454dc8 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -42,6 +42,13 @@ _modpost: __modpost
42 42
43include include/config/auto.conf 43include include/config/auto.conf
44include scripts/Kbuild.include 44include scripts/Kbuild.include
45
46ifneq ($(KBUILD_EXTMOD),)
47# Include the module's Makefile to find KBUILD_EXTRA_SYMBOLS
48include $(if $(wildcard $(KBUILD_EXTMOD)/Kbuild), \
49 $(KBUILD_EXTMOD)/Kbuild, $(KBUILD_EXTMOD)/Makefile)
50endif
51
45include scripts/Makefile.lib 52include scripts/Makefile.lib
46 53
47kernelsymfile := $(objtree)/Module.symvers 54kernelsymfile := $(objtree)/Module.symvers
@@ -69,6 +76,7 @@ modpost = scripts/mod/modpost \
69 $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \ 76 $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \
70 $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \ 77 $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
71 $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \ 78 $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
79 $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(EXTRA_SYMBOLS))) \
72 $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ 80 $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
73 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ 81 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \
74 $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \ 82 $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 58a94947d655..b6bbbcdc557e 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -9,7 +9,7 @@ use strict;
9my $P = $0; 9my $P = $0;
10$P =~ s@.*/@@g; 10$P =~ s@.*/@@g;
11 11
12my $V = '0.16'; 12my $V = '0.18';
13 13
14use Getopt::Long qw(:config no_auto_abbrev); 14use Getopt::Long qw(:config no_auto_abbrev);
15 15
@@ -131,6 +131,17 @@ our $NonptrType;
131our $Type; 131our $Type;
132our $Declare; 132our $Declare;
133 133
134our $UTF8 = qr {
135 [\x09\x0A\x0D\x20-\x7E] # ASCII
136 | [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
137 | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
138 | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
139 | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
140 | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
141 | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
142 | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
143}x;
144
134our @typeList = ( 145our @typeList = (
135 qr{void}, 146 qr{void},
136 qr{char}, 147 qr{char},
@@ -692,7 +703,7 @@ sub annotate_values {
692 while (length($cur)) { 703 while (length($cur)) {
693 @av_paren_type = ('E') if ($#av_paren_type < 0); 704 @av_paren_type = ('E') if ($#av_paren_type < 0);
694 print " <" . join('', @av_paren_type) . 705 print " <" . join('', @av_paren_type) .
695 "> <$type> " if ($dbg_values > 1); 706 "> <$type> <$av_pending>" if ($dbg_values > 1);
696 if ($cur =~ /^(\s+)/o) { 707 if ($cur =~ /^(\s+)/o) {
697 print "WS($1)\n" if ($dbg_values > 1); 708 print "WS($1)\n" if ($dbg_values > 1);
698 if ($1 =~ /\n/ && $av_preprocessor) { 709 if ($1 =~ /\n/ && $av_preprocessor) {
@@ -705,9 +716,18 @@ sub annotate_values {
705 $type = 'T'; 716 $type = 'T';
706 717
707 } elsif ($cur =~ /^(#\s*define\s*$Ident)(\(?)/o) { 718 } elsif ($cur =~ /^(#\s*define\s*$Ident)(\(?)/o) {
708 print "DEFINE($1)\n" if ($dbg_values > 1); 719 print "DEFINE($1,$2)\n" if ($dbg_values > 1);
709 $av_preprocessor = 1; 720 $av_preprocessor = 1;
710 $av_pending = 'N'; 721 push(@av_paren_type, $type);
722 if ($2 ne '') {
723 $av_pending = 'N';
724 }
725 $type = 'E';
726
727 } elsif ($cur =~ /^(#\s*undef\s*$Ident)/o) {
728 print "UNDEF($1)\n" if ($dbg_values > 1);
729 $av_preprocessor = 1;
730 push(@av_paren_type, $type);
711 731
712 } elsif ($cur =~ /^(#\s*(?:ifdef|ifndef|if))/o) { 732 } elsif ($cur =~ /^(#\s*(?:ifdef|ifndef|if))/o) {
713 print "PRE_START($1)\n" if ($dbg_values > 1); 733 print "PRE_START($1)\n" if ($dbg_values > 1);
@@ -715,7 +735,7 @@ sub annotate_values {
715 735
716 push(@av_paren_type, $type); 736 push(@av_paren_type, $type);
717 push(@av_paren_type, $type); 737 push(@av_paren_type, $type);
718 $type = 'N'; 738 $type = 'E';
719 739
720 } elsif ($cur =~ /^(#\s*(?:else|elif))/o) { 740 } elsif ($cur =~ /^(#\s*(?:else|elif))/o) {
721 print "PRE_RESTART($1)\n" if ($dbg_values > 1); 741 print "PRE_RESTART($1)\n" if ($dbg_values > 1);
@@ -723,7 +743,7 @@ sub annotate_values {
723 743
724 push(@av_paren_type, $av_paren_type[$#av_paren_type]); 744 push(@av_paren_type, $av_paren_type[$#av_paren_type]);
725 745
726 $type = 'N'; 746 $type = 'E';
727 747
728 } elsif ($cur =~ /^(#\s*(?:endif))/o) { 748 } elsif ($cur =~ /^(#\s*(?:endif))/o) {
729 print "PRE_END($1)\n" if ($dbg_values > 1); 749 print "PRE_END($1)\n" if ($dbg_values > 1);
@@ -734,11 +754,16 @@ sub annotate_values {
734 # one does, and continue as if the #endif was not here. 754 # one does, and continue as if the #endif was not here.
735 pop(@av_paren_type); 755 pop(@av_paren_type);
736 push(@av_paren_type, $type); 756 push(@av_paren_type, $type);
737 $type = 'N'; 757 $type = 'E';
738 758
739 } elsif ($cur =~ /^(\\\n)/o) { 759 } elsif ($cur =~ /^(\\\n)/o) {
740 print "PRECONT($1)\n" if ($dbg_values > 1); 760 print "PRECONT($1)\n" if ($dbg_values > 1);
741 761
762 } elsif ($cur =~ /^(__attribute__)\s*\(?/o) {
763 print "ATTR($1)\n" if ($dbg_values > 1);
764 $av_pending = $type;
765 $type = 'N';
766
742 } elsif ($cur =~ /^(sizeof)\s*(\()?/o) { 767 } elsif ($cur =~ /^(sizeof)\s*(\()?/o) {
743 print "SIZEOF($1)\n" if ($dbg_values > 1); 768 print "SIZEOF($1)\n" if ($dbg_values > 1);
744 if (defined $2) { 769 if (defined $2) {
@@ -930,7 +955,7 @@ sub process {
930 # edge is a close comment then we must be in a comment 955 # edge is a close comment then we must be in a comment
931 # at context start. 956 # at context start.
932 my $edge; 957 my $edge;
933 for (my $ln = $linenr; $ln < ($linenr + $realcnt); $ln++) { 958 for (my $ln = $linenr + 1; $ln < ($linenr + $realcnt); $ln++) {
934 next if ($line =~ /^-/); 959 next if ($line =~ /^-/);
935 ($edge) = ($rawlines[$ln - 1] =~ m@(/\*|\*/)@); 960 ($edge) = ($rawlines[$ln - 1] =~ m@(/\*|\*/)@);
936 last if (defined $edge); 961 last if (defined $edge);
@@ -951,9 +976,9 @@ sub process {
951 ##print "COMMENT:$in_comment edge<$edge> $rawline\n"; 976 ##print "COMMENT:$in_comment edge<$edge> $rawline\n";
952 sanitise_line_reset($in_comment); 977 sanitise_line_reset($in_comment);
953 978
954 } elsif ($realcnt) { 979 } elsif ($realcnt && $rawline =~ /^(?:\+| |$)/) {
955 # Standardise the strings and chars within the input to 980 # Standardise the strings and chars within the input to
956 # simplify matching. 981 # simplify matching -- only bother with positive lines.
957 $line = sanitise_line($rawline); 982 $line = sanitise_line($rawline);
958 } 983 }
959 push(@lines, $line); 984 push(@lines, $line);
@@ -1066,17 +1091,14 @@ sub process {
1066 1091
1067# UTF-8 regex found at http://www.w3.org/International/questions/qa-forms-utf-8.en.php 1092# UTF-8 regex found at http://www.w3.org/International/questions/qa-forms-utf-8.en.php
1068 if (($realfile =~ /^$/ || $line =~ /^\+/) && 1093 if (($realfile =~ /^$/ || $line =~ /^\+/) &&
1069 !($rawline =~ m/^( 1094 $rawline !~ m/^$UTF8*$/) {
1070 [\x09\x0A\x0D\x20-\x7E] # ASCII 1095 my ($utf8_prefix) = ($rawline =~ /^($UTF8*)/);
1071 | [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte 1096
1072 | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs 1097 my $blank = copy_spacing($rawline);
1073 | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte 1098 my $ptr = substr($blank, 0, length($utf8_prefix)) . "^";
1074 | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates 1099 my $hereptr = "$hereline$ptr\n";
1075 | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 1100
1076 | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 1101 ERROR("Invalid UTF-8, patch and commit message should be encoded in UTF-8\n" . $hereptr);
1077 | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
1078 )*$/x )) {
1079 ERROR("Invalid UTF-8, patch and commit message should be encoded in UTF-8\n" . $herecurr);
1080 } 1102 }
1081 1103
1082#ignore lines being removed 1104#ignore lines being removed
@@ -1112,7 +1134,7 @@ sub process {
1112 if ($rawline =~ /^\+\s* \t\s*\S/ || 1134 if ($rawline =~ /^\+\s* \t\s*\S/ ||
1113 $rawline =~ /^\+\s* \s*/) { 1135 $rawline =~ /^\+\s* \s*/) {
1114 my $herevet = "$here\n" . cat_vet($rawline) . "\n"; 1136 my $herevet = "$here\n" . cat_vet($rawline) . "\n";
1115 ERROR("use tabs not spaces\n" . $herevet); 1137 ERROR("code indent should use tabs where possible\n" . $herevet);
1116 } 1138 }
1117 1139
1118# check for RCS/CVS revision markers 1140# check for RCS/CVS revision markers
@@ -1121,35 +1143,40 @@ sub process {
1121 } 1143 }
1122 1144
1123# Check for potential 'bare' types 1145# Check for potential 'bare' types
1124 if ($realcnt) { 1146 my ($stat, $cond);
1125 my ($s, $c) = ctx_statement_block($linenr, $realcnt, 0); 1147 if ($realcnt && $line =~ /.\s*\S/) {
1126 $s =~ s/\n./ /g; 1148 ($stat, $cond) = ctx_statement_block($linenr,
1127 $s =~ s/{.*$//; 1149 $realcnt, 0);
1150 $stat =~ s/\n./\n /g;
1151 $cond =~ s/\n./\n /g;
1152
1153 my $s = $stat;
1154 $s =~ s/{.*$//s;
1128 1155
1129 # Ignore goto labels. 1156 # Ignore goto labels.
1130 if ($s =~ /$Ident:\*$/) { 1157 if ($s =~ /$Ident:\*$/s) {
1131 1158
1132 # Ignore functions being called 1159 # Ignore functions being called
1133 } elsif ($s =~ /^.\s*$Ident\s*\(/) { 1160 } elsif ($s =~ /^.\s*$Ident\s*\(/s) {
1134 1161
1135 # definitions in global scope can only start with types 1162 # definitions in global scope can only start with types
1136 } elsif ($s =~ /^.(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?($Ident)\b/) { 1163 } elsif ($s =~ /^.(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?($Ident)\b/s) {
1137 possible($1, $s); 1164 possible($1, $s);
1138 1165
1139 # declarations always start with types 1166 # declarations always start with types
1140 } elsif ($prev_values eq 'E' && $s =~ /^.\s*(?:$Storage\s+)?(?:const\s+)?($Ident)\b(:?\s+$Sparse)?\s*\**\s*$Ident\s*(?:;|=|,)/) { 1167 } elsif ($prev_values eq 'E' && $s =~ /^.\s*(?:$Storage\s+)?(?:const\s+)?($Ident)\b(:?\s+$Sparse)?\s*\**\s*$Ident\s*(?:;|=|,)/s) {
1141 possible($1, $s); 1168 possible($1, $s);
1142 } 1169 }
1143 1170
1144 # any (foo ... *) is a pointer cast, and foo is a type 1171 # any (foo ... *) is a pointer cast, and foo is a type
1145 while ($s =~ /\(($Ident)(?:\s+$Sparse)*\s*\*+\s*\)/g) { 1172 while ($s =~ /\(($Ident)(?:\s+$Sparse)*\s*\*+\s*\)/sg) {
1146 possible($1, $s); 1173 possible($1, $s);
1147 } 1174 }
1148 1175
1149 # Check for any sort of function declaration. 1176 # Check for any sort of function declaration.
1150 # int foo(something bar, other baz); 1177 # int foo(something bar, other baz);
1151 # void (*store_gdt)(x86_descr_ptr *); 1178 # void (*store_gdt)(x86_descr_ptr *);
1152 if ($prev_values eq 'E' && $s =~ /^(.(?:typedef\s*)?(?:(?:$Storage|$Inline)\s*)*\s*$Type\s*(?:\b$Ident|\(\*\s*$Ident\))\s*)\(/) { 1179 if ($prev_values eq 'E' && $s =~ /^(.(?:typedef\s*)?(?:(?:$Storage|$Inline)\s*)*\s*$Type\s*(?:\b$Ident|\(\*\s*$Ident\))\s*)\(/s) {
1153 my ($name_len) = length($1); 1180 my ($name_len) = length($1);
1154 1181
1155 my $ctx = $s; 1182 my $ctx = $s;
@@ -1282,18 +1309,19 @@ sub process {
1282 ($prevline !~ /^ }/) && 1309 ($prevline !~ /^ }/) &&
1283 ($prevline !~ /^.DECLARE_$Ident\(\Q$name\E\)/) && 1310 ($prevline !~ /^.DECLARE_$Ident\(\Q$name\E\)/) &&
1284 ($prevline !~ /^.LIST_HEAD\(\Q$name\E\)/) && 1311 ($prevline !~ /^.LIST_HEAD\(\Q$name\E\)/) &&
1312 ($prevline !~ /^.$Type\s*\(\s*\*\s*\Q$name\E\s*\)\s*\(/) &&
1285 ($prevline !~ /\b\Q$name\E(?:\s+$Attribute)?\s*(?:;|=|\[)/)) { 1313 ($prevline !~ /\b\Q$name\E(?:\s+$Attribute)?\s*(?:;|=|\[)/)) {
1286 WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr); 1314 WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr);
1287 } 1315 }
1288 } 1316 }
1289 1317
1290# check for external initialisers. 1318# check for external initialisers.
1291 if ($line =~ /^.$Type\s*$Ident\s*=\s*(0|NULL);/) { 1319 if ($line =~ /^.$Type\s*$Ident\s*=\s*(0|NULL|false)\s*;/) {
1292 ERROR("do not initialise externals to 0 or NULL\n" . 1320 ERROR("do not initialise externals to 0 or NULL\n" .
1293 $herecurr); 1321 $herecurr);
1294 } 1322 }
1295# check for static initialisers. 1323# check for static initialisers.
1296 if ($line =~ /\s*static\s.*=\s*(0|NULL);/) { 1324 if ($line =~ /\s*static\s.*=\s*(0|NULL|false)\s*;/) {
1297 ERROR("do not initialise statics to 0 or NULL\n" . 1325 ERROR("do not initialise statics to 0 or NULL\n" .
1298 $herecurr); 1326 $herecurr);
1299 } 1327 }
@@ -1512,7 +1540,10 @@ sub process {
1512 if ($ctx !~ /[WEBC]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) { 1540 if ($ctx !~ /[WEBC]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) {
1513 ERROR("space required before that '$op' $at\n" . $hereptr); 1541 ERROR("space required before that '$op' $at\n" . $hereptr);
1514 } 1542 }
1515 if ($ctx =~ /.xW/) { 1543 if ($op eq '*' && $cc =~/\s*const\b/) {
1544 # A unary '*' may be const
1545
1546 } elsif ($ctx =~ /.xW/) {
1516 ERROR("space prohibited after that '$op' $at\n" . $hereptr); 1547 ERROR("space prohibited after that '$op' $at\n" . $hereptr);
1517 } 1548 }
1518 1549
@@ -1617,7 +1648,7 @@ sub process {
1617 1648
1618# Check for illegal assignment in if conditional. 1649# Check for illegal assignment in if conditional.
1619 if ($line =~ /\bif\s*\(/) { 1650 if ($line =~ /\bif\s*\(/) {
1620 my ($s, $c) = ctx_statement_block($linenr, $realcnt, 0); 1651 my ($s, $c) = ($stat, $cond);
1621 1652
1622 if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/) { 1653 if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/) {
1623 ERROR("do not use assignment in if condition\n" . $herecurr); 1654 ERROR("do not use assignment in if condition\n" . $herecurr);
@@ -1695,7 +1726,7 @@ sub process {
1695#warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line) 1726#warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line)
1696 if ($tree && $rawline =~ m{^.\#\s*include\s*\<asm\/(.*)\.h\>}) { 1727 if ($tree && $rawline =~ m{^.\#\s*include\s*\<asm\/(.*)\.h\>}) {
1697 my $checkfile = "$root/include/linux/$1.h"; 1728 my $checkfile = "$root/include/linux/$1.h";
1698 if (-f $checkfile && $1 ne 'irq.h') { 1729 if (-f $checkfile && $1 ne 'irq') {
1699 WARN("Use #include <linux/$1.h> instead of <asm/$1.h>\n" . 1730 WARN("Use #include <linux/$1.h> instead of <asm/$1.h>\n" .
1700 $herecurr); 1731 $herecurr);
1701 } 1732 }
@@ -1889,6 +1920,13 @@ sub process {
1889 WARN("kfree(NULL) is safe this check is probabally not required\n" . $hereprev); 1920 WARN("kfree(NULL) is safe this check is probabally not required\n" . $hereprev);
1890 } 1921 }
1891 } 1922 }
1923# check for needless usb_free_urb() checks
1924 if ($prevline =~ /\bif\s*\(([^\)]*)\)/) {
1925 my $expr = $1;
1926 if ($line =~ /\busb_free_urb\(\Q$expr\E\);/) {
1927 WARN("usb_free_urb(NULL) is safe this check is probabally not required\n" . $hereprev);
1928 }
1929 }
1892 1930
1893# warn about #ifdefs in C files 1931# warn about #ifdefs in C files
1894# if ($line =~ /^.#\s*if(|n)def/ && ($realfile =~ /\.c$/)) { 1932# if ($line =~ /^.#\s*if(|n)def/ && ($realfile =~ /\.c$/)) {
@@ -1903,7 +1941,8 @@ sub process {
1903 } 1941 }
1904 1942
1905# check for spinlock_t definitions without a comment. 1943# check for spinlock_t definitions without a comment.
1906 if ($line =~ /^.\s*(struct\s+mutex|spinlock_t)\s+\S+;/) { 1944 if ($line =~ /^.\s*(struct\s+mutex|spinlock_t)\s+\S+;/ ||
1945 $line =~ /^.\s*(DEFINE_MUTEX)\s*\(/) {
1907 my $which = $1; 1946 my $which = $1;
1908 if (!ctx_has_comment($first_line, $linenr)) { 1947 if (!ctx_has_comment($first_line, $linenr)) {
1909 CHK("$1 definition without comment\n" . $herecurr); 1948 CHK("$1 definition without comment\n" . $herecurr);
@@ -1933,7 +1972,26 @@ sub process {
1933 } 1972 }
1934 1973
1935# check for new externs in .c files. 1974# check for new externs in .c files.
1936 if ($line =~ /^.\s*extern\s/ && ($realfile =~ /\.c$/)) { 1975 if ($realfile =~ /\.c$/ && defined $stat &&
1976 $stat =~ /^.\s*(?:extern\s+)?$Type\s+$Ident(\s*)\(/s)
1977 {
1978 my $paren_space = $1;
1979
1980 my $s = $stat;
1981 if (defined $cond) {
1982 substr($s, 0, length($cond), '');
1983 }
1984 if ($s =~ /^\s*;/) {
1985 WARN("externs should be avoided in .c files\n" . $herecurr);
1986 }
1987
1988 if ($paren_space =~ /\n/) {
1989 WARN("arguments for function declarations should follow identifier\n" . $herecurr);
1990 }
1991
1992 } elsif ($realfile =~ /\.c$/ && defined $stat &&
1993 $stat =~ /^.\s*extern\s+/)
1994 {
1937 WARN("externs should be avoided in .c files\n" . $herecurr); 1995 WARN("externs should be avoided in .c files\n" . $herecurr);
1938 } 1996 }
1939 1997
@@ -1957,11 +2015,11 @@ sub process {
1957 } 2015 }
1958 2016
1959# check for semaphores used as mutexes 2017# check for semaphores used as mutexes
1960 if ($line =~ /\b(DECLARE_MUTEX|init_MUTEX)\s*\(/) { 2018 if ($line =~ /^.\s*(DECLARE_MUTEX|init_MUTEX)\s*\(/) {
1961 WARN("mutexes are preferred for single holder semaphores\n" . $herecurr); 2019 WARN("mutexes are preferred for single holder semaphores\n" . $herecurr);
1962 } 2020 }
1963# check for semaphores used as mutexes 2021# check for semaphores used as mutexes
1964 if ($line =~ /\binit_MUTEX_LOCKED\s*\(/) { 2022 if ($line =~ /^.\s*init_MUTEX_LOCKED\s*\(/) {
1965 WARN("consider using a completion\n" . $herecurr); 2023 WARN("consider using a completion\n" . $herecurr);
1966 } 2024 }
1967# recommend strict_strto* over simple_strto* 2025# recommend strict_strto* over simple_strto*
@@ -1972,11 +2030,24 @@ sub process {
1972# use of NR_CPUS is usually wrong 2030# use of NR_CPUS is usually wrong
1973# ignore definitions of NR_CPUS and usage to define arrays as likely right 2031# ignore definitions of NR_CPUS and usage to define arrays as likely right
1974 if ($line =~ /\bNR_CPUS\b/ && 2032 if ($line =~ /\bNR_CPUS\b/ &&
1975 $line !~ /^.#\s*define\s+NR_CPUS\s+/ && 2033 $line !~ /^.#\s*if\b.*\bNR_CPUS\b/ &&
1976 $line !~ /^.\s*$Declare\s.*\[[^\]]*NR_CPUS[^\]]*\]/) 2034 $line !~ /^.#\s*define\b.*\bNR_CPUS\b/ &&
2035 $line !~ /^.\s*$Declare\s.*\[[^\]]*NR_CPUS[^\]]*\]/ &&
2036 $line !~ /\[[^\]]*\.\.\.[^\]]*NR_CPUS[^\]]*\]/ &&
2037 $line !~ /\[[^\]]*NR_CPUS[^\]]*\.\.\.[^\]]*\]/)
1977 { 2038 {
1978 WARN("usage of NR_CPUS is often wrong - consider using cpu_possible(), num_possible_cpus(), for_each_possible_cpu(), etc\n" . $herecurr); 2039 WARN("usage of NR_CPUS is often wrong - consider using cpu_possible(), num_possible_cpus(), for_each_possible_cpu(), etc\n" . $herecurr);
1979 } 2040 }
2041
2042# check for %L{u,d,i} in strings
2043 my $string;
2044 while ($line =~ /(?:^|")([X\t]*)(?:"|$)/g) {
2045 $string = substr($rawline, $-[1], $+[1] - $-[1]);
2046 if ($string =~ /(?<!%)%L[udi]/) {
2047 WARN("\%Ld/%Lu are not-standard C, use %lld/%llu\n" . $herecurr);
2048 last;
2049 }
2050 }
1980 } 2051 }
1981 2052
1982 # If we have no input at all, then there is nothing to report on 2053 # If we have no input at all, then there is nothing to report on
diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
index 684fb9cdc055..5f3415f28736 100644
--- a/scripts/gen_initramfs_list.sh
+++ b/scripts/gen_initramfs_list.sh
@@ -135,7 +135,7 @@ parse() {
135 str="${ftype} ${name} ${str} ${dev} ${maj} ${min}" 135 str="${ftype} ${name} ${str} ${dev} ${maj} ${min}"
136 ;; 136 ;;
137 "slink") 137 "slink")
138 local target=`field 11 $(LC_ALL=C ls -l "${location}")` 138 local target=`readlink "${location}"`
139 str="${ftype} ${name} ${target} ${str}" 139 str="${ftype} ${name} ${target} ${str}"
140 ;; 140 ;;
141 *) 141 *)
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index c912137f80e2..5d20a2e24cd1 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -7,12 +7,6 @@
7 * 7 *
8 * Usage: nm -n vmlinux | scripts/kallsyms [--all-symbols] > symbols.S 8 * Usage: nm -n vmlinux | scripts/kallsyms [--all-symbols] > symbols.S
9 * 9 *
10 * ChangeLog:
11 *
12 * (25/Aug/2004) Paulo Marques <pmarques@grupopie.com>
13 * Changed the compression method from stem compression to "table lookup"
14 * compression
15 *
16 * Table compression uses all the unused char codes on the symbols and 10 * Table compression uses all the unused char codes on the symbols and
17 * maps these to the most used substrings (tokens). For instance, it might 11 * maps these to the most used substrings (tokens). For instance, it might
18 * map char code 0xF7 to represent "write_" and then in every symbol where 12 * map char code 0xF7 to represent "write_" and then in every symbol where
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 32e8c5a227c3..fa1a7d565903 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -36,10 +36,10 @@ update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
36 --output $(obj)/config.pot 36 --output $(obj)/config.pot
37 $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot 37 $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot
38 $(Q)ln -fs Kconfig.i386 arch/um/Kconfig.arch 38 $(Q)ln -fs Kconfig.i386 arch/um/Kconfig.arch
39 $(Q)(for i in `ls arch/`; \ 39 $(Q)(for i in `ls arch/*/Kconfig`; \
40 do \ 40 do \
41 echo " GEN $$i"; \ 41 echo " GEN $$i"; \
42 $(obj)/kxgettext arch/$$i/Kconfig \ 42 $(obj)/kxgettext $$i \
43 >> $(obj)/config.pot; \ 43 >> $(obj)/config.pot; \
44 done ) 44 done )
45 $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \ 45 $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \
diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped
index bed0f4e2d2f7..6a61cee4a32c 100644
--- a/scripts/kconfig/lex.zconf.c_shipped
+++ b/scripts/kconfig/lex.zconf.c_shipped
@@ -5,25 +5,6 @@
5 5
6/* A lexical scanner generated by flex */ 6/* A lexical scanner generated by flex */
7 7
8#define yy_create_buffer zconf_create_buffer
9#define yy_delete_buffer zconf_delete_buffer
10#define yy_flex_debug zconf_flex_debug
11#define yy_init_buffer zconf_init_buffer
12#define yy_flush_buffer zconf_flush_buffer
13#define yy_load_buffer_state zconf_load_buffer_state
14#define yy_switch_to_buffer zconf_switch_to_buffer
15#define yyin zconfin
16#define yyleng zconfleng
17#define yylex zconflex
18#define yylineno zconflineno
19#define yyout zconfout
20#define yyrestart zconfrestart
21#define yytext zconftext
22#define yywrap zconfwrap
23#define yyalloc zconfalloc
24#define yyrealloc zconfrealloc
25#define yyfree zconffree
26
27#define FLEX_SCANNER 8#define FLEX_SCANNER
28#define YY_FLEX_MAJOR_VERSION 2 9#define YY_FLEX_MAJOR_VERSION 2
29#define YY_FLEX_MINOR_VERSION 5 10#define YY_FLEX_MINOR_VERSION 5
@@ -354,7 +335,7 @@ void zconffree (void * );
354 335
355/* Begin user sect3 */ 336/* Begin user sect3 */
356 337
357#define zconfwrap(n) 1 338#define zconfwrap() 1
358#define YY_SKIP_YYWRAP 339#define YY_SKIP_YYWRAP
359 340
360typedef unsigned char YY_CHAR; 341typedef unsigned char YY_CHAR;
@@ -1535,7 +1516,7 @@ static int yy_get_next_buffer (void)
1535 1516
1536 /* Read in more data. */ 1517 /* Read in more data. */
1537 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 1518 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1538 (yy_n_chars), num_to_read ); 1519 (yy_n_chars), (size_t) num_to_read );
1539 1520
1540 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1521 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1541 } 1522 }
@@ -2007,7 +1988,7 @@ YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size )
2007 1988
2008/** Setup the input buffer state to scan a string. The next call to zconflex() will 1989/** Setup the input buffer state to scan a string. The next call to zconflex() will
2009 * scan from a @e copy of @a str. 1990 * scan from a @e copy of @a str.
2010 * @param str a NUL-terminated string to scan 1991 * @param yystr a NUL-terminated string to scan
2011 * 1992 *
2012 * @return the newly allocated buffer state object. 1993 * @return the newly allocated buffer state object.
2013 * @note If you want to scan bytes that may contain NUL values, then use 1994 * @note If you want to scan bytes that may contain NUL values, then use
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h
index 4d09f6ddefe3..8e69461313d1 100644
--- a/scripts/kconfig/lkc_proto.h
+++ b/scripts/kconfig/lkc_proto.h
@@ -21,7 +21,7 @@ P(menu_get_help,const char *,(struct menu *menu));
21/* symbol.c */ 21/* symbol.c */
22P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); 22P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]);
23 23
24P(sym_lookup,struct symbol *,(const char *name, int isconst)); 24P(sym_lookup,struct symbol *,(const char *name, int flags));
25P(sym_find,struct symbol *,(const char *name)); 25P(sym_find,struct symbol *,(const char *name));
26P(sym_re_search,struct symbol **,(const char *pattern)); 26P(sym_re_search,struct symbol **,(const char *pattern));
27P(sym_type_name,const char *,(enum symbol_type type)); 27P(sym_type_name,const char *,(enum symbol_type type));
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh
index 62e1e02126e6..5552154cbedb 100644
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
@@ -36,8 +36,10 @@ trap "rm -f $tmp" 0 1 2 3 15
36 36
37# Check if we can link to ncurses 37# Check if we can link to ncurses
38check() { 38check() {
39 echo -e " #include CURSES_LOC \n main() {}" | 39 $cc -xc - -o $tmp 2>/dev/null <<'EOF'
40 $cc -xc - -o $tmp 2> /dev/null 40#include CURSES_LOC
41main() {}
42EOF
41 if [ $? != 0 ]; then 43 if [ $? != 0 ]; then
42 echo " *** Unable to find the ncurses libraries or the" 1>&2 44 echo " *** Unable to find the ncurses libraries or the" 1>&2
43 echo " *** required header files." 1>&2 45 echo " *** required header files." 1>&2
diff --git a/scripts/kconfig/lxdialog/inputbox.c b/scripts/kconfig/lxdialog/inputbox.c
index 4946bd02b46d..616c60138183 100644
--- a/scripts/kconfig/lxdialog/inputbox.c
+++ b/scripts/kconfig/lxdialog/inputbox.c
@@ -89,7 +89,7 @@ do_resize:
89 box_y = y + 2; 89 box_y = y + 2;
90 box_x = (width - box_width) / 2; 90 box_x = (width - box_width) / 2;
91 draw_box(dialog, y + 1, box_x - 1, 3, box_width + 2, 91 draw_box(dialog, y + 1, box_x - 1, 3, box_width + 2,
92 dlg.border.atr, dlg.dialog.atr); 92 dlg.dialog.atr, dlg.border.atr);
93 93
94 print_buttons(dialog, height, width, 0); 94 print_buttons(dialog, height, width, 0);
95 95
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 606ceb9e746e..07ff8d105c9d 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -235,18 +235,22 @@ void menu_finalize(struct menu *parent)
235 sym = parent->sym; 235 sym = parent->sym;
236 if (parent->list) { 236 if (parent->list) {
237 if (sym && sym_is_choice(sym)) { 237 if (sym && sym_is_choice(sym)) {
238 /* find the first choice value and find out choice type */ 238 if (sym->type == S_UNKNOWN) {
239 for (menu = parent->list; menu; menu = menu->next) { 239 /* find the first choice value to find out choice type */
240 if (menu->sym) { 240 current_entry = parent;
241 current_entry = parent; 241 for (menu = parent->list; menu; menu = menu->next) {
242 if (sym->type == S_UNKNOWN) 242 if (menu->sym && menu->sym->type != S_UNKNOWN) {
243 menu_set_type(menu->sym->type); 243 menu_set_type(menu->sym->type);
244 current_entry = menu; 244 break;
245 if (menu->sym->type == S_UNKNOWN) 245 }
246 menu_set_type(sym->type);
247 break;
248 } 246 }
249 } 247 }
248 /* set the type of the remaining choice values */
249 for (menu = parent->list; menu; menu = menu->next) {
250 current_entry = menu;
251 if (menu->sym && menu->sym->type == S_UNKNOWN)
252 menu_set_type(sym->type);
253 }
250 parentdep = expr_alloc_symbol(sym); 254 parentdep = expr_alloc_symbol(sym);
251 } else if (parent->prompt) 255 } else if (parent->prompt)
252 parentdep = parent->prompt->visible.expr; 256 parentdep = parent->prompt->visible.expr;
@@ -313,50 +317,36 @@ void menu_finalize(struct menu *parent)
313 } 317 }
314 } 318 }
315 for (menu = parent->list; menu; menu = menu->next) { 319 for (menu = parent->list; menu; menu = menu->next) {
316 if (sym && sym_is_choice(sym) && menu->sym) { 320 if (sym && sym_is_choice(sym) &&
321 menu->sym && !sym_is_choice_value(menu->sym)) {
322 current_entry = menu;
317 menu->sym->flags |= SYMBOL_CHOICEVAL; 323 menu->sym->flags |= SYMBOL_CHOICEVAL;
318 if (!menu->prompt) 324 if (!menu->prompt)
319 menu_warn(menu, "choice value must have a prompt"); 325 menu_warn(menu, "choice value must have a prompt");
320 for (prop = menu->sym->prop; prop; prop = prop->next) { 326 for (prop = menu->sym->prop; prop; prop = prop->next) {
321 if (prop->type == P_PROMPT && prop->menu != menu) {
322 prop_warn(prop, "choice values "
323 "currently only support a "
324 "single prompt");
325 }
326 if (prop->type == P_DEFAULT) 327 if (prop->type == P_DEFAULT)
327 prop_warn(prop, "defaults for choice " 328 prop_warn(prop, "defaults for choice "
328 "values not supported"); 329 "values not supported");
330 if (prop->menu == menu)
331 continue;
332 if (prop->type == P_PROMPT &&
333 prop->menu->parent->sym != sym)
334 prop_warn(prop, "choice value used outside its choice group");
329 } 335 }
330 current_entry = menu;
331 if (menu->sym->type == S_UNKNOWN)
332 menu_set_type(sym->type);
333 /* Non-tristate choice values of tristate choices must 336 /* Non-tristate choice values of tristate choices must
334 * depend on the choice being set to Y. The choice 337 * depend on the choice being set to Y. The choice
335 * values' dependencies were propagated to their 338 * values' dependencies were propagated to their
336 * properties above, so the change here must be re- 339 * properties above, so the change here must be re-
337 * propagated. */ 340 * propagated.
341 */
338 if (sym->type == S_TRISTATE && menu->sym->type != S_TRISTATE) { 342 if (sym->type == S_TRISTATE && menu->sym->type != S_TRISTATE) {
339 basedep = expr_alloc_comp(E_EQUAL, sym, &symbol_yes); 343 basedep = expr_alloc_comp(E_EQUAL, sym, &symbol_yes);
340 basedep = expr_alloc_and(basedep, menu->dep); 344 menu->dep = expr_alloc_and(basedep, menu->dep);
341 basedep = expr_eliminate_dups(basedep);
342 menu->dep = basedep;
343 for (prop = menu->sym->prop; prop; prop = prop->next) { 345 for (prop = menu->sym->prop; prop; prop = prop->next) {
344 if (prop->menu != menu) 346 if (prop->menu != menu)
345 continue; 347 continue;
346 dep = expr_alloc_and(expr_copy(basedep), 348 prop->visible.expr = expr_alloc_and(expr_copy(basedep),
347 prop->visible.expr); 349 prop->visible.expr);
348 dep = expr_eliminate_dups(dep);
349 dep = expr_trans_bool(dep);
350 prop->visible.expr = dep;
351 if (prop->type == P_SELECT) {
352 struct symbol *es = prop_get_symbol(prop);
353 dep2 = expr_alloc_symbol(menu->sym);
354 dep = expr_alloc_and(dep2,
355 expr_copy(dep));
356 dep = expr_alloc_or(es->rev_dep.expr, dep);
357 dep = expr_eliminate_dups(dep);
358 es->rev_dep.expr = dep;
359 }
360 } 350 }
361 } 351 }
362 menu_add_symbol(P_CHOICE, sym, NULL); 352 menu_add_symbol(P_CHOICE, sym, NULL);
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 4a03191ad176..18f3e5c33634 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -40,7 +40,7 @@ void sym_add_default(struct symbol *sym, const char *def)
40{ 40{
41 struct property *prop = prop_alloc(P_DEFAULT, sym); 41 struct property *prop = prop_alloc(P_DEFAULT, sym);
42 42
43 prop->expr = expr_alloc_symbol(sym_lookup(def, 1)); 43 prop->expr = expr_alloc_symbol(sym_lookup(def, SYMBOL_CONST));
44} 44}
45 45
46void sym_init(void) 46void sym_init(void)
@@ -350,9 +350,6 @@ void sym_calc_value(struct symbol *sym)
350 ; 350 ;
351 } 351 }
352 352
353 if (sym->flags & SYMBOL_AUTO)
354 sym->flags &= ~SYMBOL_WRITE;
355
356 sym->curr = newval; 353 sym->curr = newval;
357 if (sym_is_choice(sym) && newval.tri == yes) 354 if (sym_is_choice(sym) && newval.tri == yes)
358 sym->curr.val = sym_calc_choice(sym); 355 sym->curr.val = sym_calc_choice(sym);
@@ -377,6 +374,9 @@ void sym_calc_value(struct symbol *sym)
377 sym_set_changed(choice_sym); 374 sym_set_changed(choice_sym);
378 } 375 }
379 } 376 }
377
378 if (sym->flags & SYMBOL_AUTO)
379 sym->flags &= ~SYMBOL_WRITE;
380} 380}
381 381
382void sym_clear_all_valid(void) 382void sym_clear_all_valid(void)
@@ -651,7 +651,7 @@ bool sym_is_changable(struct symbol *sym)
651 return sym->visible > sym->rev_dep.tri; 651 return sym->visible > sym->rev_dep.tri;
652} 652}
653 653
654struct symbol *sym_lookup(const char *name, int isconst) 654struct symbol *sym_lookup(const char *name, int flags)
655{ 655{
656 struct symbol *symbol; 656 struct symbol *symbol;
657 const char *ptr; 657 const char *ptr;
@@ -671,11 +671,10 @@ struct symbol *sym_lookup(const char *name, int isconst)
671 hash &= 0xff; 671 hash &= 0xff;
672 672
673 for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) { 673 for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) {
674 if (!strcmp(symbol->name, name)) { 674 if (!strcmp(symbol->name, name) &&
675 if ((isconst && symbol->flags & SYMBOL_CONST) || 675 (flags ? symbol->flags & flags
676 (!isconst && !(symbol->flags & SYMBOL_CONST))) 676 : !(symbol->flags & (SYMBOL_CONST|SYMBOL_CHOICE))))
677 return symbol; 677 return symbol;
678 }
679 } 678 }
680 new_name = strdup(name); 679 new_name = strdup(name);
681 } else { 680 } else {
@@ -687,8 +686,7 @@ struct symbol *sym_lookup(const char *name, int isconst)
687 memset(symbol, 0, sizeof(*symbol)); 686 memset(symbol, 0, sizeof(*symbol));
688 symbol->name = new_name; 687 symbol->name = new_name;
689 symbol->type = S_UNKNOWN; 688 symbol->type = S_UNKNOWN;
690 if (isconst) 689 symbol->flags |= flags;
691 symbol->flags |= SYMBOL_CONST;
692 690
693 symbol->next = symbol_hash[hash]; 691 symbol->next = symbol_hash[hash];
694 symbol_hash[hash] = symbol; 692 symbol_hash[hash] = symbol;
@@ -762,8 +760,6 @@ struct symbol **sym_re_search(const char *pattern)
762} 760}
763 761
764 762
765struct symbol *sym_check_deps(struct symbol *sym);
766
767static struct symbol *sym_check_expr_deps(struct expr *e) 763static struct symbol *sym_check_expr_deps(struct expr *e)
768{ 764{
769 struct symbol *sym; 765 struct symbol *sym;
@@ -795,40 +791,100 @@ static struct symbol *sym_check_expr_deps(struct expr *e)
795} 791}
796 792
797/* return NULL when dependencies are OK */ 793/* return NULL when dependencies are OK */
798struct symbol *sym_check_deps(struct symbol *sym) 794static struct symbol *sym_check_sym_deps(struct symbol *sym)
799{ 795{
800 struct symbol *sym2; 796 struct symbol *sym2;
801 struct property *prop; 797 struct property *prop;
802 798
803 if (sym->flags & SYMBOL_CHECK) {
804 fprintf(stderr, "%s:%d:error: found recursive dependency: %s",
805 sym->prop->file->name, sym->prop->lineno, sym->name);
806 return sym;
807 }
808 if (sym->flags & SYMBOL_CHECKED)
809 return NULL;
810
811 sym->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED);
812 sym2 = sym_check_expr_deps(sym->rev_dep.expr); 799 sym2 = sym_check_expr_deps(sym->rev_dep.expr);
813 if (sym2) 800 if (sym2)
814 goto out; 801 return sym2;
815 802
816 for (prop = sym->prop; prop; prop = prop->next) { 803 for (prop = sym->prop; prop; prop = prop->next) {
817 if (prop->type == P_CHOICE || prop->type == P_SELECT) 804 if (prop->type == P_CHOICE || prop->type == P_SELECT)
818 continue; 805 continue;
819 sym2 = sym_check_expr_deps(prop->visible.expr); 806 sym2 = sym_check_expr_deps(prop->visible.expr);
820 if (sym2) 807 if (sym2)
821 goto out; 808 break;
822 if (prop->type != P_DEFAULT || sym_is_choice(sym)) 809 if (prop->type != P_DEFAULT || sym_is_choice(sym))
823 continue; 810 continue;
824 sym2 = sym_check_expr_deps(prop->expr); 811 sym2 = sym_check_expr_deps(prop->expr);
825 if (sym2) 812 if (sym2)
826 goto out; 813 break;
827 } 814 }
828out: 815
816 return sym2;
817}
818
819static struct symbol *sym_check_choice_deps(struct symbol *choice)
820{
821 struct symbol *sym, *sym2;
822 struct property *prop;
823 struct expr *e;
824
825 prop = sym_get_choice_prop(choice);
826 expr_list_for_each_sym(prop->expr, e, sym)
827 sym->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED);
828
829 choice->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED);
830 sym2 = sym_check_sym_deps(choice);
831 choice->flags &= ~SYMBOL_CHECK;
829 if (sym2) 832 if (sym2)
830 fprintf(stderr, " -> %s%s", sym->name, sym2 == sym? "\n": ""); 833 goto out;
831 sym->flags &= ~SYMBOL_CHECK; 834
835 expr_list_for_each_sym(prop->expr, e, sym) {
836 sym2 = sym_check_sym_deps(sym);
837 if (sym2) {
838 fprintf(stderr, " -> %s", sym->name);
839 break;
840 }
841 }
842out:
843 expr_list_for_each_sym(prop->expr, e, sym)
844 sym->flags &= ~SYMBOL_CHECK;
845
846 if (sym2 && sym_is_choice_value(sym2) &&
847 prop_get_symbol(sym_get_choice_prop(sym2)) == choice)
848 sym2 = choice;
849
850 return sym2;
851}
852
853struct symbol *sym_check_deps(struct symbol *sym)
854{
855 struct symbol *sym2;
856 struct property *prop;
857
858 if (sym->flags & SYMBOL_CHECK) {
859 fprintf(stderr, "%s:%d:error: found recursive dependency: %s",
860 sym->prop->file->name, sym->prop->lineno,
861 sym->name ? sym->name : "<choice>");
862 return sym;
863 }
864 if (sym->flags & SYMBOL_CHECKED)
865 return NULL;
866
867 if (sym_is_choice_value(sym)) {
868 /* for choice groups start the check with main choice symbol */
869 prop = sym_get_choice_prop(sym);
870 sym2 = sym_check_deps(prop_get_symbol(prop));
871 } else if (sym_is_choice(sym)) {
872 sym2 = sym_check_choice_deps(sym);
873 } else {
874 sym->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED);
875 sym2 = sym_check_sym_deps(sym);
876 sym->flags &= ~SYMBOL_CHECK;
877 }
878
879 if (sym2) {
880 fprintf(stderr, " -> %s", sym->name ? sym->name : "<choice>");
881 if (sym2 == sym) {
882 fprintf(stderr, "\n");
883 zconfnerrs++;
884 sym2 = NULL;
885 }
886 }
887
832 return sym2; 888 return sym2;
833} 889}
834 890
@@ -904,7 +960,7 @@ void prop_add_env(const char *env)
904 } 960 }
905 961
906 prop = prop_alloc(P_ENV, sym); 962 prop = prop_alloc(P_ENV, sym);
907 prop->expr = expr_alloc_symbol(sym_lookup(env, 1)); 963 prop->expr = expr_alloc_symbol(sym_lookup(env, SYMBOL_CONST));
908 964
909 sym_env_list = expr_alloc_one(E_LIST, sym_env_list); 965 sym_env_list = expr_alloc_one(E_LIST, sym_env_list);
910 sym_env_list->right.sym = sym; 966 sym_env_list->right.sym = sym;
diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped
index d22d92496f25..95df833b5a9d 100644
--- a/scripts/kconfig/zconf.tab.c_shipped
+++ b/scripts/kconfig/zconf.tab.c_shipped
@@ -446,16 +446,16 @@ union yyalloc
446/* YYFINAL -- State number of the termination state. */ 446/* YYFINAL -- State number of the termination state. */
447#define YYFINAL 3 447#define YYFINAL 3
448/* YYLAST -- Last index in YYTABLE. */ 448/* YYLAST -- Last index in YYTABLE. */
449#define YYLAST 258 449#define YYLAST 259
450 450
451/* YYNTOKENS -- Number of terminals. */ 451/* YYNTOKENS -- Number of terminals. */
452#define YYNTOKENS 35 452#define YYNTOKENS 35
453/* YYNNTS -- Number of nonterminals. */ 453/* YYNNTS -- Number of nonterminals. */
454#define YYNNTS 45 454#define YYNNTS 46
455/* YYNRULES -- Number of rules. */ 455/* YYNRULES -- Number of rules. */
456#define YYNRULES 108 456#define YYNRULES 110
457/* YYNRULES -- Number of states. */ 457/* YYNRULES -- Number of states. */
458#define YYNSTATES 178 458#define YYNSTATES 180
459 459
460/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 460/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
461#define YYUNDEFTOK 2 461#define YYUNDEFTOK 2
@@ -507,13 +507,14 @@ static const yytype_uint16 yyprhs[] =
507 28, 33, 37, 39, 41, 43, 45, 47, 49, 51, 507 28, 33, 37, 39, 41, 43, 45, 47, 49, 51,
508 53, 55, 57, 59, 61, 63, 67, 70, 74, 77, 508 53, 55, 57, 59, 61, 63, 67, 70, 74, 77,
509 81, 84, 85, 88, 91, 94, 97, 100, 103, 107, 509 81, 84, 85, 88, 91, 94, 97, 100, 103, 107,
510 112, 117, 122, 128, 132, 133, 137, 138, 141, 144, 510 112, 117, 122, 128, 132, 133, 137, 138, 141, 145,
511 147, 149, 153, 154, 157, 160, 163, 166, 169, 174, 511 148, 150, 154, 155, 158, 161, 164, 167, 170, 175,
512 178, 181, 186, 187, 190, 194, 196, 200, 201, 204, 512 179, 182, 187, 188, 191, 195, 197, 201, 202, 205,
513 207, 210, 214, 217, 219, 223, 224, 227, 230, 233, 513 208, 211, 215, 218, 220, 224, 225, 228, 231, 234,
514 237, 241, 244, 247, 250, 251, 254, 257, 260, 265, 514 238, 242, 245, 248, 251, 252, 255, 258, 261, 266,
515 266, 269, 271, 273, 276, 279, 282, 284, 287, 288, 515 267, 270, 272, 274, 277, 280, 283, 285, 288, 289,
516 291, 293, 297, 301, 305, 308, 312, 316, 318 516 292, 294, 298, 302, 306, 309, 313, 317, 319, 321,
517 322
517}; 518};
518 519
519/* YYRHS -- A `-1'-separated list of the rules' RHS. */ 520/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -533,24 +534,25 @@ static const yytype_int8 yyrhs[] =
533 30, -1, 20, 78, 77, 30, -1, 21, 25, 77, 534 30, -1, 20, 78, 77, 30, -1, 21, 25, 77,
534 30, -1, 22, 79, 79, 77, 30, -1, 23, 48, 535 30, -1, 22, 79, 79, 77, 30, -1, 23, 48,
535 30, -1, -1, 48, 25, 49, -1, -1, 33, 74, 536 30, -1, -1, 48, 25, 49, -1, -1, 33, 74,
536 -1, 7, 30, -1, 50, 54, -1, 75, -1, 51, 537 -1, 7, 80, 30, -1, 50, 54, -1, 75, -1,
537 56, 52, -1, -1, 54, 55, -1, 54, 72, -1, 538 51, 56, 52, -1, -1, 54, 55, -1, 54, 72,
538 54, 70, -1, 54, 30, -1, 54, 40, -1, 18, 539 -1, 54, 70, -1, 54, 30, -1, 54, 40, -1,
539 74, 77, 30, -1, 19, 73, 30, -1, 17, 30, 540 18, 74, 77, 30, -1, 19, 73, 30, -1, 17,
540 -1, 20, 25, 77, 30, -1, -1, 56, 39, -1, 541 30, -1, 20, 25, 77, 30, -1, -1, 56, 39,
541 14, 78, 76, -1, 75, -1, 57, 60, 58, -1, 542 -1, 14, 78, 76, -1, 75, -1, 57, 60, 58,
542 -1, 60, 39, -1, 60, 64, -1, 60, 53, -1, 543 -1, -1, 60, 39, -1, 60, 64, -1, 60, 53,
543 4, 74, 30, -1, 61, 71, -1, 75, -1, 62, 544 -1, 4, 74, 30, -1, 61, 71, -1, 75, -1,
544 65, 63, -1, -1, 65, 39, -1, 65, 64, -1, 545 62, 65, 63, -1, -1, 65, 39, -1, 65, 64,
545 65, 53, -1, 6, 74, 30, -1, 9, 74, 30, 546 -1, 65, 53, -1, 6, 74, 30, -1, 9, 74,
546 -1, 67, 71, -1, 12, 30, -1, 69, 13, -1, 547 30, -1, 67, 71, -1, 12, 30, -1, 69, 13,
547 -1, 71, 72, -1, 71, 30, -1, 71, 40, -1, 548 -1, -1, 71, 72, -1, 71, 30, -1, 71, 40,
548 16, 24, 78, 30, -1, -1, 74, 77, -1, 25, 549 -1, 16, 24, 78, 30, -1, -1, 74, 77, -1,
549 -1, 26, -1, 5, 30, -1, 8, 30, -1, 15, 550 25, -1, 26, -1, 5, 30, -1, 8, 30, -1,
550 30, -1, 30, -1, 76, 30, -1, -1, 14, 78, 551 15, 30, -1, 30, -1, 76, 30, -1, -1, 14,
551 -1, 79, -1, 79, 33, 79, -1, 79, 27, 79, 552 78, -1, 79, -1, 79, 33, 79, -1, 79, 27,
552 -1, 29, 78, 28, -1, 34, 78, -1, 78, 31, 553 79, -1, 29, 78, 28, -1, 34, 78, -1, 78,
553 78, -1, 78, 32, 78, -1, 25, -1, 26, -1 554 31, 78, -1, 78, 32, 78, -1, 25, -1, 26,
555 -1, -1, 25, -1
554}; 556};
555 557
556/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 558/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -566,7 +568,8 @@ static const yytype_uint16 yyrline[] =
566 339, 344, 351, 356, 364, 367, 369, 370, 371, 374, 568 339, 344, 351, 356, 364, 367, 369, 370, 371, 374,
567 382, 389, 396, 402, 409, 411, 412, 413, 416, 424, 569 382, 389, 396, 402, 409, 411, 412, 413, 416, 424,
568 426, 431, 432, 435, 436, 437, 441, 442, 445, 446, 570 426, 431, 432, 435, 436, 437, 441, 442, 445, 446,
569 449, 450, 451, 452, 453, 454, 455, 458, 459 571 449, 450, 451, 452, 453, 454, 455, 458, 459, 462,
572 463
570}; 573};
571#endif 574#endif
572 575
@@ -590,7 +593,8 @@ static const char *const yytname[] =
590 "if_entry", "if_end", "if_stmt", "if_block", "menu", "menu_entry", 593 "if_entry", "if_end", "if_stmt", "if_block", "menu", "menu_entry",
591 "menu_end", "menu_stmt", "menu_block", "source_stmt", "comment", 594 "menu_end", "menu_stmt", "menu_block", "source_stmt", "comment",
592 "comment_stmt", "help_start", "help", "depends_list", "depends", 595 "comment_stmt", "help_start", "help", "depends_list", "depends",
593 "prompt_stmt_opt", "prompt", "end", "nl", "if_expr", "expr", "symbol", 0 596 "prompt_stmt_opt", "prompt", "end", "nl", "if_expr", "expr", "symbol",
597 "word_opt", 0
594}; 598};
595#endif 599#endif
596 600
@@ -619,7 +623,8 @@ static const yytype_uint8 yyr1[] =
619 60, 61, 62, 63, 64, 65, 65, 65, 65, 66, 623 60, 61, 62, 63, 64, 65, 65, 65, 65, 66,
620 67, 68, 69, 70, 71, 71, 71, 71, 72, 73, 624 67, 68, 69, 70, 71, 71, 71, 71, 72, 73,
621 73, 74, 74, 75, 75, 75, 76, 76, 77, 77, 625 73, 74, 74, 75, 75, 75, 76, 76, 77, 77,
622 78, 78, 78, 78, 78, 78, 78, 79, 79 626 78, 78, 78, 78, 78, 78, 78, 79, 79, 80,
627 80
623}; 628};
624 629
625/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 630/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -629,13 +634,14 @@ static const yytype_uint8 yyr2[] =
629 4, 3, 1, 1, 1, 1, 1, 1, 1, 1, 634 4, 3, 1, 1, 1, 1, 1, 1, 1, 1,
630 1, 1, 1, 1, 1, 3, 2, 3, 2, 3, 635 1, 1, 1, 1, 1, 3, 2, 3, 2, 3,
631 2, 0, 2, 2, 2, 2, 2, 2, 3, 4, 636 2, 0, 2, 2, 2, 2, 2, 2, 3, 4,
632 4, 4, 5, 3, 0, 3, 0, 2, 2, 2, 637 4, 4, 5, 3, 0, 3, 0, 2, 3, 2,
633 1, 3, 0, 2, 2, 2, 2, 2, 4, 3, 638 1, 3, 0, 2, 2, 2, 2, 2, 4, 3,
634 2, 4, 0, 2, 3, 1, 3, 0, 2, 2, 639 2, 4, 0, 2, 3, 1, 3, 0, 2, 2,
635 2, 3, 2, 1, 3, 0, 2, 2, 2, 3, 640 2, 3, 2, 1, 3, 0, 2, 2, 2, 3,
636 3, 2, 2, 2, 0, 2, 2, 2, 4, 0, 641 3, 2, 2, 2, 0, 2, 2, 2, 4, 0,
637 2, 1, 1, 2, 2, 2, 1, 2, 0, 2, 642 2, 1, 1, 2, 2, 2, 1, 2, 0, 2,
638 1, 3, 3, 3, 2, 3, 3, 1, 1 643 1, 3, 3, 3, 2, 3, 3, 1, 1, 0,
644 1
639}; 645};
640 646
641/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 647/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -643,69 +649,69 @@ static const yytype_uint8 yyr2[] =
643 means the default is an error. */ 649 means the default is an error. */
644static const yytype_uint8 yydefact[] = 650static const yytype_uint8 yydefact[] =
645{ 651{
646 3, 0, 0, 1, 0, 0, 0, 0, 0, 0, 652 3, 0, 0, 1, 0, 0, 0, 0, 0, 109,
647 0, 0, 0, 0, 0, 0, 12, 16, 13, 14, 653 0, 0, 0, 0, 0, 0, 12, 16, 13, 14,
648 18, 15, 17, 0, 19, 0, 4, 31, 22, 31, 654 18, 15, 17, 0, 19, 0, 4, 31, 22, 31,
649 23, 52, 62, 5, 67, 20, 84, 75, 6, 24, 655 23, 52, 62, 5, 67, 20, 84, 75, 6, 24,
650 84, 21, 8, 11, 91, 92, 0, 0, 93, 0, 656 84, 21, 8, 11, 91, 92, 0, 0, 93, 0,
651 48, 94, 0, 0, 0, 107, 108, 0, 0, 0, 657 110, 0, 94, 0, 0, 0, 107, 108, 0, 0,
652 100, 95, 0, 0, 0, 0, 0, 0, 0, 0, 658 0, 100, 95, 0, 0, 0, 0, 0, 0, 0,
653 0, 0, 96, 7, 71, 79, 80, 27, 29, 0, 659 0, 0, 0, 96, 7, 71, 79, 48, 80, 27,
654 104, 0, 0, 64, 0, 0, 9, 10, 0, 0, 660 29, 0, 104, 0, 0, 64, 0, 0, 9, 10,
655 0, 0, 89, 0, 0, 0, 44, 0, 37, 36, 661 0, 0, 0, 0, 89, 0, 0, 0, 44, 0,
656 32, 33, 0, 35, 34, 0, 0, 89, 0, 56, 662 37, 36, 32, 33, 0, 35, 34, 0, 0, 89,
657 57, 53, 55, 54, 63, 51, 50, 68, 70, 66, 663 0, 56, 57, 53, 55, 54, 63, 51, 50, 68,
658 69, 65, 86, 87, 85, 76, 78, 74, 77, 73, 664 70, 66, 69, 65, 86, 87, 85, 76, 78, 74,
659 97, 103, 105, 106, 102, 101, 26, 82, 0, 98, 665 77, 73, 97, 103, 105, 106, 102, 101, 26, 82,
660 0, 98, 98, 98, 0, 0, 0, 83, 60, 98, 666 0, 98, 0, 98, 98, 98, 0, 0, 0, 83,
661 0, 98, 0, 0, 0, 38, 90, 0, 0, 98, 667 60, 98, 0, 98, 0, 0, 0, 38, 90, 0,
662 46, 43, 25, 0, 59, 0, 88, 99, 39, 40, 668 0, 98, 46, 43, 25, 0, 59, 0, 88, 99,
663 41, 0, 0, 45, 58, 61, 42, 47 669 39, 40, 41, 0, 0, 45, 58, 61, 42, 47
664}; 670};
665 671
666/* YYDEFGOTO[NTERM-NUM]. */ 672/* YYDEFGOTO[NTERM-NUM]. */
667static const yytype_int16 yydefgoto[] = 673static const yytype_int16 yydefgoto[] =
668{ 674{
669 -1, 1, 2, 25, 26, 99, 27, 28, 29, 30, 675 -1, 1, 2, 25, 26, 101, 27, 28, 29, 30,
670 64, 100, 101, 145, 173, 31, 32, 115, 33, 66, 676 65, 102, 103, 147, 175, 31, 32, 117, 33, 67,
671 111, 67, 34, 119, 35, 68, 36, 37, 127, 38, 677 113, 68, 34, 121, 35, 69, 36, 37, 129, 38,
672 70, 39, 40, 41, 102, 103, 69, 104, 140, 141, 678 71, 39, 40, 41, 104, 105, 70, 106, 142, 143,
673 42, 73, 154, 59, 60 679 42, 74, 156, 60, 61, 51
674}; 680};
675 681
676/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 682/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
677 STATE-NUM. */ 683 STATE-NUM. */
678#define YYPACT_NINF -78 684#define YYPACT_NINF -80
679static const yytype_int16 yypact[] = 685static const yytype_int16 yypact[] =
680{ 686{
681 -78, 33, 130, -78, -28, 73, 73, 7, 73, 36, 687 -80, 2, 132, -80, -13, -1, -1, -2, -1, 9,
682 41, 73, 26, 52, -4, 58, -78, -78, -78, -78, 688 33, -1, 27, 40, -3, 38, -80, -80, -80, -80,
683 -78, -78, -78, 90, -78, 94, -78, -78, -78, -78, 689 -80, -80, -80, 71, -80, 77, -80, -80, -80, -80,
684 -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, 690 -80, -80, -80, -80, -80, -80, -80, -80, -80, -80,
685 -78, -78, -78, -78, -78, -78, 74, 85, -78, 96, 691 -80, -80, -80, -80, -80, -80, 57, 61, -80, 63,
686 -78, -78, 131, 134, 147, -78, -78, -4, -4, 193, 692 -80, 76, -80, 87, 101, 133, -80, -80, -3, -3,
687 -10, -78, 162, 164, 38, 102, 64, 148, 5, 192, 693 195, -6, -80, 136, 149, 39, 104, 65, 150, 5,
688 5, 165, -78, 174, -78, -78, -78, -78, -78, 65, 694 194, 5, 167, -80, 176, -80, -80, -80, -80, -80,
689 -78, -4, -4, 174, 103, 103, -78, -78, 175, 185, 695 -80, 68, -80, -3, -3, 176, 72, 72, -80, -80,
690 197, 73, 73, -4, 194, 103, -78, 231, -78, -78, 696 177, 187, 78, -1, -1, -3, 196, 72, -80, 222,
691 -78, -78, 220, -78, -78, 204, 73, 73, 210, -78, 697 -80, -80, -80, -80, 221, -80, -80, 205, -1, -1,
692 -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, 698 211, -80, -80, -80, -80, -80, -80, -80, -80, -80,
693 -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, 699 -80, -80, -80, -80, -80, -80, -80, -80, -80, -80,
694 -78, -78, 205, -78, -78, -78, -78, -78, -4, 222, 700 -80, -80, -80, -80, 206, -80, -80, -80, -80, -80,
695 208, 222, 195, 222, 103, 2, 209, -78, -78, 222, 701 -3, 223, 209, 223, 197, 223, 72, 7, 210, -80,
696 211, 222, 199, -4, 212, -78, -78, 213, 214, 222, 702 -80, 223, 212, 223, 201, -3, 213, -80, -80, 214,
697 207, -78, -78, 215, -78, 216, -78, 111, -78, -78, 703 215, 223, 208, -80, -80, 216, -80, 217, -80, 113,
698 -78, 217, 73, -78, -78, -78, -78, -78 704 -80, -80, -80, 218, -1, -80, -80, -80, -80, -80
699}; 705};
700 706
701/* YYPGOTO[NTERM-NUM]. */ 707/* YYPGOTO[NTERM-NUM]. */
702static const yytype_int16 yypgoto[] = 708static const yytype_int16 yypgoto[] =
703{ 709{
704 -78, -78, -78, -78, 121, -35, -78, -78, -78, -78, 710 -80, -80, -80, -80, 122, -34, -80, -80, -80, -80,
705 219, -78, -78, -78, -78, -78, -78, -78, -44, -78, 711 220, -80, -80, -80, -80, -80, -80, -80, 59, -80,
706 -78, -78, -78, -78, -78, -78, -78, -78, -78, -6, 712 -80, -80, -80, -80, -80, -80, -80, -80, -80, 125,
707 -78, -78, -78, -78, -78, 183, 218, 21, 143, -5, 713 -80, -80, -80, -80, -80, 183, 219, 22, 142, -5,
708 146, 196, 69, -53, -77 714 147, 192, 69, -54, -79, -80
709}; 715};
710 716
711/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 717/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -715,62 +721,62 @@ static const yytype_int16 yypgoto[] =
715#define YYTABLE_NINF -82 721#define YYTABLE_NINF -82
716static const yytype_int16 yytable[] = 722static const yytype_int16 yytable[] =
717{ 723{
718 46, 47, 43, 49, 79, 80, 52, 134, 135, 6, 724 46, 47, 3, 49, 81, 82, 53, 136, 137, 6,
719 7, 8, 9, 10, 11, 12, 13, 84, 144, 14, 725 7, 8, 9, 10, 11, 12, 13, 43, 146, 14,
720 15, 55, 56, 85, 118, 57, 126, 160, 132, 133, 726 15, 86, 56, 57, 44, 45, 58, 87, 48, 134,
721 58, 110, 161, 3, 123, 24, 123, 48, -28, 88, 727 135, 59, 162, 112, 50, 24, 125, 163, 125, -28,
722 142, -28, -28, -28, -28, -28, -28, -28, -28, -28, 728 90, 144, -28, -28, -28, -28, -28, -28, -28, -28,
723 89, 53, -28, -28, 90, -28, 91, 92, 93, 94, 729 -28, 91, 54, -28, -28, 92, -28, 93, 94, 95,
724 95, 96, 120, 97, 128, 88, 50, 159, 98, -49, 730 96, 97, 98, 52, 99, 55, 90, 161, 62, 100,
725 -49, 51, -49, -49, -49, -49, 89, 54, -49, -49, 731 -49, -49, 63, -49, -49, -49, -49, 91, 64, -49,
726 90, 105, 106, 107, 108, 152, 139, 113, 61, 97, 732 -49, 92, 107, 108, 109, 110, 154, 73, 141, 115,
727 124, 62, 124, 131, 109, 63, 81, 82, 44, 45, 733 99, 75, 126, 76, 126, 111, 133, 56, 57, 83,
728 167, 149, -30, 88, 72, -30, -30, -30, -30, -30, 734 84, 169, 140, 151, -30, 90, 77, -30, -30, -30,
729 -30, -30, -30, -30, 89, 74, -30, -30, 90, -30, 735 -30, -30, -30, -30, -30, -30, 91, 78, -30, -30,
730 91, 92, 93, 94, 95, 96, 75, 97, 55, 56, 736 92, -30, 93, 94, 95, 96, 97, 98, 120, 99,
731 -2, 4, 98, 5, 6, 7, 8, 9, 10, 11, 737 128, 79, -2, 4, 100, 5, 6, 7, 8, 9,
732 12, 13, 81, 82, 14, 15, 16, 17, 18, 19, 738 10, 11, 12, 13, 83, 84, 14, 15, 16, 17,
733 20, 21, 22, 7, 8, 23, 10, 11, 12, 13, 739 18, 19, 20, 21, 22, 7, 8, 23, 10, 11,
734 24, 76, 14, 15, 77, -81, 88, 177, -81, -81, 740 12, 13, 24, 80, 14, 15, 88, -81, 90, 179,
735 -81, -81, -81, -81, -81, -81, -81, 78, 24, -81, 741 -81, -81, -81, -81, -81, -81, -81, -81, -81, 89,
736 -81, 90, -81, -81, -81, -81, -81, -81, 114, 117, 742 24, -81, -81, 92, -81, -81, -81, -81, -81, -81,
737 97, 125, 86, 88, 87, 122, -72, -72, -72, -72, 743 116, 119, 99, 127, 122, 90, 130, 124, -72, -72,
738 -72, -72, -72, -72, 130, 136, -72, -72, 90, 153, 744 -72, -72, -72, -72, -72, -72, 132, 138, -72, -72,
739 156, 157, 158, 116, 121, 137, 129, 97, 163, 143, 745 92, 155, 158, 159, 160, 118, 123, 139, 131, 99,
740 165, 138, 122, 72, 81, 82, 81, 82, 171, 166, 746 165, 145, 167, 148, 124, 73, 83, 84, 83, 84,
741 81, 82, 146, 147, 148, 151, 153, 82, 155, 162, 747 173, 168, 83, 84, 149, 150, 153, 155, 84, 157,
742 172, 164, 168, 169, 170, 174, 175, 176, 65, 112, 748 164, 174, 166, 170, 171, 172, 176, 177, 178, 66,
743 150, 0, 0, 0, 0, 83, 0, 0, 71 749 114, 152, 85, 0, 0, 0, 0, 0, 0, 72
744}; 750};
745 751
746static const yytype_int16 yycheck[] = 752static const yytype_int16 yycheck[] =
747{ 753{
748 5, 6, 30, 8, 57, 58, 11, 84, 85, 4, 754 5, 6, 0, 8, 58, 59, 11, 86, 87, 4,
749 5, 6, 7, 8, 9, 10, 11, 27, 95, 14, 755 5, 6, 7, 8, 9, 10, 11, 30, 97, 14,
750 15, 25, 26, 33, 68, 29, 70, 25, 81, 82, 756 15, 27, 25, 26, 25, 26, 29, 33, 30, 83,
751 34, 66, 30, 0, 69, 30, 71, 30, 0, 1, 757 84, 34, 25, 67, 25, 30, 70, 30, 72, 0,
752 93, 3, 4, 5, 6, 7, 8, 9, 10, 11, 758 1, 95, 3, 4, 5, 6, 7, 8, 9, 10,
753 12, 25, 14, 15, 16, 17, 18, 19, 20, 21, 759 11, 12, 25, 14, 15, 16, 17, 18, 19, 20,
754 22, 23, 68, 25, 70, 1, 30, 144, 30, 5, 760 21, 22, 23, 30, 25, 25, 1, 146, 30, 30,
755 6, 30, 8, 9, 10, 11, 12, 25, 14, 15, 761 5, 6, 1, 8, 9, 10, 11, 12, 1, 14,
756 16, 17, 18, 19, 20, 138, 91, 66, 30, 25, 762 15, 16, 17, 18, 19, 20, 140, 30, 93, 67,
757 69, 1, 71, 28, 30, 1, 31, 32, 25, 26, 763 25, 30, 70, 30, 72, 30, 28, 25, 26, 31,
758 153, 106, 0, 1, 30, 3, 4, 5, 6, 7, 764 32, 155, 24, 108, 0, 1, 30, 3, 4, 5,
759 8, 9, 10, 11, 12, 30, 14, 15, 16, 17, 765 6, 7, 8, 9, 10, 11, 12, 30, 14, 15,
760 18, 19, 20, 21, 22, 23, 30, 25, 25, 26, 766 16, 17, 18, 19, 20, 21, 22, 23, 69, 25,
761 0, 1, 30, 3, 4, 5, 6, 7, 8, 9, 767 71, 30, 0, 1, 30, 3, 4, 5, 6, 7,
762 10, 11, 31, 32, 14, 15, 16, 17, 18, 19, 768 8, 9, 10, 11, 31, 32, 14, 15, 16, 17,
763 20, 21, 22, 5, 6, 25, 8, 9, 10, 11, 769 18, 19, 20, 21, 22, 5, 6, 25, 8, 9,
764 30, 30, 14, 15, 30, 0, 1, 172, 3, 4, 770 10, 11, 30, 30, 14, 15, 30, 0, 1, 174,
765 5, 6, 7, 8, 9, 10, 11, 30, 30, 14, 771 3, 4, 5, 6, 7, 8, 9, 10, 11, 30,
766 15, 16, 17, 18, 19, 20, 21, 22, 67, 68, 772 30, 14, 15, 16, 17, 18, 19, 20, 21, 22,
767 25, 70, 30, 1, 30, 30, 4, 5, 6, 7, 773 68, 69, 25, 71, 69, 1, 71, 30, 4, 5,
768 8, 9, 10, 11, 30, 30, 14, 15, 16, 14, 774 6, 7, 8, 9, 10, 11, 30, 30, 14, 15,
769 141, 142, 143, 67, 68, 30, 70, 25, 149, 25, 775 16, 14, 143, 144, 145, 68, 69, 30, 71, 25,
770 151, 24, 30, 30, 31, 32, 31, 32, 159, 30, 776 151, 25, 153, 1, 30, 30, 31, 32, 31, 32,
771 31, 32, 1, 13, 30, 25, 14, 32, 30, 30, 777 161, 30, 31, 32, 13, 30, 25, 14, 32, 30,
772 33, 30, 30, 30, 30, 30, 30, 30, 29, 66, 778 30, 33, 30, 30, 30, 30, 30, 30, 30, 29,
773 107, -1, -1, -1, -1, 59, -1, -1, 40 779 67, 109, 60, -1, -1, -1, -1, -1, -1, 40
774}; 780};
775 781
776/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 782/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -782,19 +788,19 @@ static const yytype_uint8 yystos[] =
782 20, 21, 22, 25, 30, 38, 39, 41, 42, 43, 788 20, 21, 22, 25, 30, 38, 39, 41, 42, 43,
783 44, 50, 51, 53, 57, 59, 61, 62, 64, 66, 789 44, 50, 51, 53, 57, 59, 61, 62, 64, 66,
784 67, 68, 75, 30, 25, 26, 74, 74, 30, 74, 790 67, 68, 75, 30, 25, 26, 74, 74, 30, 74,
785 30, 30, 74, 25, 25, 25, 26, 29, 34, 78, 791 25, 80, 30, 74, 25, 25, 25, 26, 29, 34,
786 79, 30, 1, 1, 45, 45, 54, 56, 60, 71, 792 78, 79, 30, 1, 1, 45, 45, 54, 56, 60,
787 65, 71, 30, 76, 30, 30, 30, 30, 30, 78, 793 71, 65, 71, 30, 76, 30, 30, 30, 30, 30,
788 78, 31, 32, 76, 27, 33, 30, 30, 1, 12, 794 30, 78, 78, 31, 32, 76, 27, 33, 30, 30,
789 16, 18, 19, 20, 21, 22, 23, 25, 30, 40, 795 1, 12, 16, 18, 19, 20, 21, 22, 23, 25,
790 46, 47, 69, 70, 72, 17, 18, 19, 20, 30, 796 30, 40, 46, 47, 69, 70, 72, 17, 18, 19,
791 40, 55, 70, 72, 39, 52, 75, 39, 53, 58, 797 20, 30, 40, 55, 70, 72, 39, 52, 75, 39,
792 64, 75, 30, 40, 72, 39, 53, 63, 64, 75, 798 53, 58, 64, 75, 30, 40, 72, 39, 53, 63,
793 30, 28, 78, 78, 79, 79, 30, 30, 24, 74, 799 64, 75, 30, 28, 78, 78, 79, 79, 30, 30,
794 73, 74, 78, 25, 79, 48, 1, 13, 30, 74, 800 24, 74, 73, 74, 78, 25, 79, 48, 1, 13,
795 73, 25, 78, 14, 77, 30, 77, 77, 77, 79, 801 30, 74, 73, 25, 78, 14, 77, 30, 77, 77,
796 25, 30, 30, 77, 30, 77, 30, 78, 30, 30, 802 77, 79, 25, 30, 30, 77, 30, 77, 30, 78,
797 30, 77, 33, 49, 30, 30, 30, 74 803 30, 30, 30, 77, 33, 49, 30, 30, 30, 74
798}; 804};
799 805
800#define yyerrok (yyerrstatus = 0) 806#define yyerrok (yyerrstatus = 0)
@@ -1781,8 +1787,8 @@ yyreduce:
1781 case 48: 1787 case 48:
1782 1788
1783 { 1789 {
1784 struct symbol *sym = sym_lookup(NULL, 0); 1790 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), SYMBOL_CHOICE);
1785 sym->flags |= SYMBOL_CHOICE; 1791 sym->flags |= SYMBOL_AUTO;
1786 menu_add_entry(sym); 1792 menu_add_entry(sym);
1787 menu_add_expr(P_CHOICE, NULL, NULL); 1793 menu_add_expr(P_CHOICE, NULL, NULL);
1788 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno()); 1794 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
@@ -2014,7 +2020,12 @@ yyreduce:
2014 2020
2015 case 108: 2021 case 108:
2016 2022
2017 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 1); free((yyvsp[(1) - (1)].string)); ;} 2023 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), SYMBOL_CONST); free((yyvsp[(1) - (1)].string)); ;}
2024 break;
2025
2026 case 109:
2027
2028 { (yyval.string) = NULL; ;}
2018 break; 2029 break;
2019 2030
2020 2031
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index d9b96ba8e38c..9710b82466f2 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -91,7 +91,7 @@ static struct menu *current_menu, *current_entry;
91%type <id> end 91%type <id> end
92%type <id> option_name 92%type <id> option_name
93%type <menu> if_entry menu_entry choice_entry 93%type <menu> if_entry menu_entry choice_entry
94%type <string> symbol_option_arg 94%type <string> symbol_option_arg word_opt
95 95
96%destructor { 96%destructor {
97 fprintf(stderr, "%s:%d: missing end statement for this entry\n", 97 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
@@ -239,10 +239,10 @@ symbol_option_arg:
239 239
240/* choice entry */ 240/* choice entry */
241 241
242choice: T_CHOICE T_EOL 242choice: T_CHOICE word_opt T_EOL
243{ 243{
244 struct symbol *sym = sym_lookup(NULL, 0); 244 struct symbol *sym = sym_lookup($2, SYMBOL_CHOICE);
245 sym->flags |= SYMBOL_CHOICE; 245 sym->flags |= SYMBOL_AUTO;
246 menu_add_entry(sym); 246 menu_add_entry(sym);
247 menu_add_expr(P_CHOICE, NULL, NULL); 247 menu_add_expr(P_CHOICE, NULL, NULL);
248 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno()); 248 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
@@ -456,9 +456,12 @@ expr: symbol { $$ = expr_alloc_symbol($1); }
456; 456;
457 457
458symbol: T_WORD { $$ = sym_lookup($1, 0); free($1); } 458symbol: T_WORD { $$ = sym_lookup($1, 0); free($1); }
459 | T_WORD_QUOTE { $$ = sym_lookup($1, 1); free($1); } 459 | T_WORD_QUOTE { $$ = sym_lookup($1, SYMBOL_CONST); free($1); }
460; 460;
461 461
462word_opt: /* empty */ { $$ = NULL; }
463 | T_WORD
464
462%% 465%%
463 466
464void conf_parse(const char *name) 467void conf_parse(const char *name)
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 263d04ab2d94..83cee18a02e9 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-2007 Randy Dunlap ## 8## Copyright (C) 2005-2008 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. ##
@@ -366,6 +366,7 @@ foreach my $pattern (keys %highlights) {
366# dumps section contents to arrays/hashes intended for that purpose. 366# dumps section contents to arrays/hashes intended for that purpose.
367# 367#
368sub dump_section { 368sub dump_section {
369 my $file = shift;
369 my $name = shift; 370 my $name = shift;
370 my $contents = join "\n", @_; 371 my $contents = join "\n", @_;
371 372
@@ -379,6 +380,10 @@ sub dump_section {
379 $parameterdescs{$name} = $contents; 380 $parameterdescs{$name} = $contents;
380 } else { 381 } else {
381# print STDERR "other section '$name' = '$contents'\n"; 382# print STDERR "other section '$name' = '$contents'\n";
383 if (defined($sections{$name}) && ($sections{$name} ne "")) {
384 print STDERR "Error(${file}:$.): duplicate section name '$name'\n";
385 ++$errors;
386 }
382 $sections{$name} = $contents; 387 $sections{$name} = $contents;
383 push @sectionlist, $name; 388 push @sectionlist, $name;
384 } 389 }
@@ -388,6 +393,7 @@ sub dump_section {
388# dump DOC: section after checking that it should go out 393# dump DOC: section after checking that it should go out
389# 394#
390sub dump_doc_section { 395sub dump_doc_section {
396 my $file = shift;
391 my $name = shift; 397 my $name = shift;
392 my $contents = join "\n", @_; 398 my $contents = join "\n", @_;
393 399
@@ -399,7 +405,7 @@ sub dump_doc_section {
399 ( $function_only == 1 && defined($function_table{$name})) || 405 ( $function_only == 1 && defined($function_table{$name})) ||
400 ( $function_only == 2 && !defined($function_table{$name}))) 406 ( $function_only == 2 && !defined($function_table{$name})))
401 { 407 {
402 dump_section $name, $contents; 408 dump_section($file, $name, $contents);
403 output_blockhead({'sectionlist' => \@sectionlist, 409 output_blockhead({'sectionlist' => \@sectionlist,
404 'sections' => \%sections, 410 'sections' => \%sections,
405 'module' => $modulename, 411 'module' => $modulename,
@@ -1923,7 +1929,7 @@ sub process_file($) {
1923 print STDERR "Warning(${file}:$.): contents before sections\n"; 1929 print STDERR "Warning(${file}:$.): contents before sections\n";
1924 ++$warnings; 1930 ++$warnings;
1925 } 1931 }
1926 dump_section($section, xml_escape($contents)); 1932 dump_section($file, $section, xml_escape($contents));
1927 $section = $section_default; 1933 $section = $section_default;
1928 } 1934 }
1929 1935
@@ -1940,10 +1946,15 @@ sub process_file($) {
1940 } elsif (/$doc_end/) { 1946 } elsif (/$doc_end/) {
1941 1947
1942 if ($contents ne "") { 1948 if ($contents ne "") {
1943 dump_section($section, xml_escape($contents)); 1949 dump_section($file, $section, xml_escape($contents));
1944 $section = $section_default; 1950 $section = $section_default;
1945 $contents = ""; 1951 $contents = "";
1946 } 1952 }
1953 # look for doc_com + <text> + doc_end:
1954 if ($_ =~ m'\s*\*\s*[a-zA-Z_0-9:\.]+\*/') {
1955 print STDERR "Warning(${file}:$.): suspicious ending line: $_";
1956 ++$warnings;
1957 }
1947 1958
1948 $prototype = ""; 1959 $prototype = "";
1949 $state = 3; 1960 $state = 3;
@@ -1954,7 +1965,7 @@ sub process_file($) {
1954 # @parameter line to signify start of description 1965 # @parameter line to signify start of description
1955 if ($1 eq "" && 1966 if ($1 eq "" &&
1956 ($section =~ m/^@/ || $section eq $section_context)) { 1967 ($section =~ m/^@/ || $section eq $section_context)) {
1957 dump_section($section, xml_escape($contents)); 1968 dump_section($file, $section, xml_escape($contents));
1958 $section = $section_default; 1969 $section = $section_default;
1959 $contents = ""; 1970 $contents = "";
1960 } else { 1971 } else {
@@ -1974,7 +1985,7 @@ sub process_file($) {
1974 } elsif ($state == 4) { 1985 } elsif ($state == 4) {
1975 # Documentation block 1986 # Documentation block
1976 if (/$doc_block/) { 1987 if (/$doc_block/) {
1977 dump_doc_section($section, xml_escape($contents)); 1988 dump_doc_section($file, $section, xml_escape($contents));
1978 $contents = ""; 1989 $contents = "";
1979 $function = ""; 1990 $function = "";
1980 %constants = (); 1991 %constants = ();
@@ -1992,7 +2003,7 @@ sub process_file($) {
1992 } 2003 }
1993 elsif (/$doc_end/) 2004 elsif (/$doc_end/)
1994 { 2005 {
1995 dump_doc_section($section, xml_escape($contents)); 2006 dump_doc_section($file, $section, xml_escape($contents));
1996 $contents = ""; 2007 $contents = "";
1997 $function = ""; 2008 $function = "";
1998 %constants = (); 2009 %constants = ();
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 348d8687b7c9..e04c4218cb52 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -328,19 +328,52 @@ static int do_pnp_entry(const char *filename,
328 return 1; 328 return 1;
329} 329}
330 330
331/* looks like: "pnp:cCdD..." */ 331/* looks like: "pnp:dD" for every device of the card */
332static int do_pnp_card_entry(const char *filename, 332static void do_pnp_card_entries(void *symval, unsigned long size,
333 struct pnp_card_device_id *id, char *alias) 333 struct module *mod)
334{ 334{
335 int i; 335 const unsigned long id_size = sizeof(struct pnp_card_device_id);
336 const unsigned int count = (size / id_size)-1;
337 const struct pnp_card_device_id *cards = symval;
338 unsigned int i;
336 339
337 sprintf(alias, "pnp:c%s", id->id); 340 device_id_check(mod->name, "pnp", size, id_size, symval);
338 for (i = 0; i < PNP_MAX_DEVICES; i++) { 341
339 if (! *id->devs[i].id) 342 for (i = 0; i < count; i++) {
340 break; 343 unsigned int j;
341 sprintf(alias + strlen(alias), "d%s", id->devs[i].id); 344 const struct pnp_card_device_id *card = &cards[i];
345
346 for (j = 0; j < PNP_MAX_DEVICES; j++) {
347 const char *id = (char *)card->devs[j].id;
348 int i2, j2;
349 int dup = 0;
350
351 if (!id[0])
352 break;
353
354 /* find duplicate, already added value */
355 for (i2 = 0; i2 < i && !dup; i2++) {
356 const struct pnp_card_device_id *card2 = &cards[i2];
357
358 for (j2 = 0; j2 < PNP_MAX_DEVICES; j2++) {
359 const char *id2 = (char *)card2->devs[j2].id;
360
361 if (!id2[0])
362 break;
363
364 if (!strcmp(id, id2)) {
365 dup = 1;
366 break;
367 }
368 }
369 }
370
371 /* add an individual alias for every device entry */
372 if (!dup)
373 buf_printf(&mod->dev_table_buf,
374 "MODULE_ALIAS(\"pnp:d%s*\");\n", id);
375 }
342 } 376 }
343 return 1;
344} 377}
345 378
346/* Looks like: pcmcia:mNcNfNfnNpfnNvaNvbNvcNvdN. */ 379/* Looks like: pcmcia:mNcNfNfnNpfnNvaNvbNvcNvdN. */
@@ -543,6 +576,15 @@ static int do_virtio_entry(const char *filename, struct virtio_device_id *id,
543 return 1; 576 return 1;
544} 577}
545 578
579/* Looks like: i2c:S */
580static int do_i2c_entry(const char *filename, struct i2c_device_id *id,
581 char *alias)
582{
583 sprintf(alias, I2C_MODULE_PREFIX "%s", id->name);
584
585 return 1;
586}
587
546/* Ignore any prefix, eg. v850 prepends _ */ 588/* Ignore any prefix, eg. v850 prepends _ */
547static inline int sym_is(const char *symbol, const char *name) 589static inline int sym_is(const char *symbol, const char *name)
548{ 590{
@@ -634,9 +676,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
634 sizeof(struct pnp_device_id), "pnp", 676 sizeof(struct pnp_device_id), "pnp",
635 do_pnp_entry, mod); 677 do_pnp_entry, mod);
636 else if (sym_is(symname, "__mod_pnp_card_device_table")) 678 else if (sym_is(symname, "__mod_pnp_card_device_table"))
637 do_table(symval, sym->st_size, 679 do_pnp_card_entries(symval, sym->st_size, mod);
638 sizeof(struct pnp_card_device_id), "pnp_card",
639 do_pnp_card_entry, mod);
640 else if (sym_is(symname, "__mod_pcmcia_device_table")) 680 else if (sym_is(symname, "__mod_pcmcia_device_table"))
641 do_table(symval, sym->st_size, 681 do_table(symval, sym->st_size,
642 sizeof(struct pcmcia_device_id), "pcmcia", 682 sizeof(struct pcmcia_device_id), "pcmcia",
@@ -673,6 +713,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
673 do_table(symval, sym->st_size, 713 do_table(symval, sym->st_size,
674 sizeof(struct virtio_device_id), "virtio", 714 sizeof(struct virtio_device_id), "virtio",
675 do_virtio_entry, mod); 715 do_virtio_entry, mod);
716 else if (sym_is(symname, "__mod_i2c_device_table"))
717 do_table(symval, sym->st_size,
718 sizeof(struct i2c_device_id), "i2c",
719 do_i2c_entry, mod);
676 free(zeros); 720 free(zeros);
677} 721}
678 722
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 110cf243fa4e..757294b4f322 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1552,6 +1552,10 @@ static void read_symbols(char *modname)
1552 } 1552 }
1553 1553
1554 license = get_modinfo(info.modinfo, info.modinfo_len, "license"); 1554 license = get_modinfo(info.modinfo, info.modinfo_len, "license");
1555 if (info.modinfo && !license && !is_vmlinux(modname))
1556 warn("modpost: missing MODULE_LICENSE() in %s\n"
1557 "see include/linux/module.h for "
1558 "more information\n", modname);
1555 while (license) { 1559 while (license) {
1556 if (license_is_gpl_compatible(license)) 1560 if (license_is_gpl_compatible(license))
1557 mod->gpl_compatible = 1; 1561 mod->gpl_compatible = 1;
@@ -2015,6 +2019,11 @@ static void write_markers(const char *fname)
2015 write_if_changed(&buf, fname); 2019 write_if_changed(&buf, fname);
2016} 2020}
2017 2021
2022struct ext_sym_list {
2023 struct ext_sym_list *next;
2024 const char *file;
2025};
2026
2018int main(int argc, char **argv) 2027int main(int argc, char **argv)
2019{ 2028{
2020 struct module *mod; 2029 struct module *mod;
@@ -2025,8 +2034,10 @@ int main(int argc, char **argv)
2025 char *markers_write = NULL; 2034 char *markers_write = NULL;
2026 int opt; 2035 int opt;
2027 int err; 2036 int err;
2037 struct ext_sym_list *extsym_iter;
2038 struct ext_sym_list *extsym_start = NULL;
2028 2039
2029 while ((opt = getopt(argc, argv, "i:I:cmsSo:awM:K:")) != -1) { 2040 while ((opt = getopt(argc, argv, "i:I:e:cmsSo:awM:K:")) != -1) {
2030 switch (opt) { 2041 switch (opt) {
2031 case 'i': 2042 case 'i':
2032 kernel_read = optarg; 2043 kernel_read = optarg;
@@ -2038,6 +2049,14 @@ int main(int argc, char **argv)
2038 case 'c': 2049 case 'c':
2039 cross_build = 1; 2050 cross_build = 1;
2040 break; 2051 break;
2052 case 'e':
2053 external_module = 1;
2054 extsym_iter =
2055 NOFAIL(malloc(sizeof(*extsym_iter)));
2056 extsym_iter->next = extsym_start;
2057 extsym_iter->file = optarg;
2058 extsym_start = extsym_iter;
2059 break;
2041 case 'm': 2060 case 'm':
2042 modversions = 1; 2061 modversions = 1;
2043 break; 2062 break;
@@ -2071,6 +2090,12 @@ int main(int argc, char **argv)
2071 read_dump(kernel_read, 1); 2090 read_dump(kernel_read, 1);
2072 if (module_read) 2091 if (module_read)
2073 read_dump(module_read, 0); 2092 read_dump(module_read, 0);
2093 while (extsym_start) {
2094 read_dump(extsym_start->file, 0);
2095 extsym_iter = extsym_start->next;
2096 free(extsym_start);
2097 extsym_start = extsym_iter;
2098 }
2074 2099
2075 while (optind < argc) 2100 while (optind < argc)
2076 read_symbols(argv[optind++]); 2101 read_symbols(argv[optind++]);