aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl71
-rw-r--r--scripts/coccinelle/iterators/use_after_iter.cocci147
-rw-r--r--scripts/coccinelle/misc/irqf_oneshot.cocci65
-rwxr-xr-xscripts/config62
-rw-r--r--scripts/kconfig/.gitignore1
-rw-r--r--scripts/kconfig/Makefile41
-rw-r--r--scripts/kconfig/confdata.c61
-rw-r--r--scripts/kconfig/lxdialog/check-lxdialog.sh8
-rw-r--r--scripts/kconfig/lxdialog/textbox.c3
-rw-r--r--scripts/kconfig/mconf.c6
-rw-r--r--scripts/kconfig/nconf.c10
-rw-r--r--scripts/kconfig/nconf.gui.c8
-rw-r--r--scripts/kconfig/streamline_config.pl175
-rw-r--r--scripts/link-vmlinux.sh4
-rw-r--r--scripts/mksysmap2
-rw-r--r--scripts/mod/file2alias.c5
-rw-r--r--scripts/mod/modpost.c11
-rw-r--r--scripts/package/builddeb7
-rw-r--r--scripts/sortextable.c1
-rwxr-xr-xscripts/tags.sh6
20 files changed, 613 insertions, 81 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e5bd60ff48e3..913d6bdfdda3 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1600,13 +1600,17 @@ sub process {
1600 1600
1601# Check signature styles 1601# Check signature styles
1602 if (!$in_header_lines && 1602 if (!$in_header_lines &&
1603 $line =~ /^(\s*)($signature_tags)(\s*)(.*)/) { 1603 $line =~ /^(\s*)([a-z0-9_-]+by:|$signature_tags)(\s*)(.*)/i) {
1604 my $space_before = $1; 1604 my $space_before = $1;
1605 my $sign_off = $2; 1605 my $sign_off = $2;
1606 my $space_after = $3; 1606 my $space_after = $3;
1607 my $email = $4; 1607 my $email = $4;
1608 my $ucfirst_sign_off = ucfirst(lc($sign_off)); 1608 my $ucfirst_sign_off = ucfirst(lc($sign_off));
1609 1609
1610 if ($sign_off !~ /$signature_tags/) {
1611 WARN("BAD_SIGN_OFF",
1612 "Non-standard signature: $sign_off\n" . $herecurr);
1613 }
1610 if (defined $space_before && $space_before ne "") { 1614 if (defined $space_before && $space_before ne "") {
1611 WARN("BAD_SIGN_OFF", 1615 WARN("BAD_SIGN_OFF",
1612 "Do not use whitespace before $ucfirst_sign_off\n" . $herecurr); 1616 "Do not use whitespace before $ucfirst_sign_off\n" . $herecurr);
@@ -1848,8 +1852,8 @@ sub process {
1848 1852
1849 my $pos = pos_last_openparen($rest); 1853 my $pos = pos_last_openparen($rest);
1850 if ($pos >= 0) { 1854 if ($pos >= 0) {
1851 $line =~ /^\+([ \t]*)/; 1855 $line =~ /^(\+| )([ \t]*)/;
1852 my $newindent = $1; 1856 my $newindent = $2;
1853 1857
1854 my $goodtabindent = $oldindent . 1858 my $goodtabindent = $oldindent .
1855 "\t" x ($pos / 8) . 1859 "\t" x ($pos / 8) .
@@ -2984,6 +2988,45 @@ sub process {
2984 } 2988 }
2985 } 2989 }
2986 2990
2991# do {} while (0) macro tests:
2992# single-statement macros do not need to be enclosed in do while (0) loop,
2993# macro should not end with a semicolon
2994 if ($^V && $^V ge 5.10.0 &&
2995 $realfile !~ m@/vmlinux.lds.h$@ &&
2996 $line =~ /^.\s*\#\s*define\s+$Ident(\()?/) {
2997 my $ln = $linenr;
2998 my $cnt = $realcnt;
2999 my ($off, $dstat, $dcond, $rest);
3000 my $ctx = '';
3001 ($dstat, $dcond, $ln, $cnt, $off) =
3002 ctx_statement_block($linenr, $realcnt, 0);
3003 $ctx = $dstat;
3004
3005 $dstat =~ s/\\\n.//g;
3006
3007 if ($dstat =~ /^\+\s*#\s*define\s+$Ident\s*${balanced_parens}\s*do\s*{(.*)\s*}\s*while\s*\(\s*0\s*\)\s*([;\s]*)\s*$/) {
3008 my $stmts = $2;
3009 my $semis = $3;
3010
3011 $ctx =~ s/\n*$//;
3012 my $cnt = statement_rawlines($ctx);
3013 my $herectx = $here . "\n";
3014
3015 for (my $n = 0; $n < $cnt; $n++) {
3016 $herectx .= raw_line($linenr, $n) . "\n";
3017 }
3018
3019 if (($stmts =~ tr/;/;/) == 1) {
3020 WARN("SINGLE_STATEMENT_DO_WHILE_MACRO",
3021 "Single statement macros should not use a do {} while (0) loop\n" . "$herectx");
3022 }
3023 if (defined $semis && $semis ne "") {
3024 WARN("DO_WHILE_MACRO_WITH_TRAILING_SEMICOLON",
3025 "do {} while (0) macros should not be semicolon terminated\n" . "$herectx");
3026 }
3027 }
3028 }
3029
2987# make sure symbols are always wrapped with VMLINUX_SYMBOL() ... 3030# make sure symbols are always wrapped with VMLINUX_SYMBOL() ...
2988# all assignments may have only one of the following with an assignment: 3031# all assignments may have only one of the following with an assignment:
2989# . 3032# .
@@ -3261,6 +3304,12 @@ sub process {
3261 "sizeof(& should be avoided\n" . $herecurr); 3304 "sizeof(& should be avoided\n" . $herecurr);
3262 } 3305 }
3263 3306
3307# check for sizeof without parenthesis
3308 if ($line =~ /\bsizeof\s+((?:\*\s*|)$Lval|$Type(?:\s+$Lval|))/) {
3309 WARN("SIZEOF_PARENTHESIS",
3310 "sizeof $1 should be sizeof($1)\n" . $herecurr);
3311 }
3312
3264# check for line continuations in quoted strings with odd counts of " 3313# check for line continuations in quoted strings with odd counts of "
3265 if ($rawline =~ /\\$/ && $rawline =~ tr/"/"/ % 2) { 3314 if ($rawline =~ /\\$/ && $rawline =~ tr/"/"/ % 2) {
3266 WARN("LINE_CONTINUATIONS", 3315 WARN("LINE_CONTINUATIONS",
@@ -3309,6 +3358,22 @@ sub process {
3309 } 3358 }
3310 } 3359 }
3311 3360
3361# check usleep_range arguments
3362 if ($^V && $^V ge 5.10.0 &&
3363 defined $stat &&
3364 $stat =~ /^\+(?:.*?)\busleep_range\s*\(\s*($FuncArg)\s*,\s*($FuncArg)\s*\)/) {
3365 my $min = $1;
3366 my $max = $7;
3367 if ($min eq $max) {
3368 WARN("USLEEP_RANGE",
3369 "usleep_range should not use min == max args; see Documentation/timers/timers-howto.txt\n" . "$here\n$stat\n");
3370 } elsif ($min =~ /^\d+$/ && $max =~ /^\d+$/ &&
3371 $min > $max) {
3372 WARN("USLEEP_RANGE",
3373 "usleep_range args reversed, use min then max; see Documentation/timers/timers-howto.txt\n" . "$here\n$stat\n");
3374 }
3375 }
3376
3312# check for new externs in .c files. 3377# check for new externs in .c files.
3313 if ($realfile =~ /\.c$/ && defined $stat && 3378 if ($realfile =~ /\.c$/ && defined $stat &&
3314 $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s) 3379 $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s)
diff --git a/scripts/coccinelle/iterators/use_after_iter.cocci b/scripts/coccinelle/iterators/use_after_iter.cocci
new file mode 100644
index 000000000000..06284c57a951
--- /dev/null
+++ b/scripts/coccinelle/iterators/use_after_iter.cocci
@@ -0,0 +1,147 @@
1/// If list_for_each_entry, etc complete a traversal of the list, the iterator
2/// variable ends up pointing to an address at an offset from the list head,
3/// and not a meaningful structure. Thus this value should not be used after
4/// the end of the iterator.
5//#False positives arise when there is a goto in the iterator and the
6//#reported reference is at the label of this goto. Some flag tests
7//#may also cause a report to be a false positive.
8///
9// Confidence: Moderate
10// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
11// Copyright: (C) 2012 Gilles Muller, INRIA/LIP6. GPLv2.
12// URL: http://coccinelle.lip6.fr/
13// Comments:
14// Options: -no_includes -include_headers
15
16virtual context
17virtual org
18virtual report
19
20@r exists@
21identifier c,member;
22expression E,x;
23iterator name list_for_each_entry;
24iterator name list_for_each_entry_reverse;
25iterator name list_for_each_entry_continue;
26iterator name list_for_each_entry_continue_reverse;
27iterator name list_for_each_entry_from;
28iterator name list_for_each_entry_safe;
29iterator name list_for_each_entry_safe_continue;
30iterator name list_for_each_entry_safe_from;
31iterator name list_for_each_entry_safe_reverse;
32iterator name hlist_for_each_entry;
33iterator name hlist_for_each_entry_continue;
34iterator name hlist_for_each_entry_from;
35iterator name hlist_for_each_entry_safe;
36statement S;
37position p1,p2;
38@@
39
40(
41list_for_each_entry@p1(c,...,member) { ... when != break;
42 when forall
43 when strict
44}
45|
46list_for_each_entry_reverse@p1(c,...,member) { ... when != break;
47 when forall
48 when strict
49}
50|
51list_for_each_entry_continue@p1(c,...,member) { ... when != break;
52 when forall
53 when strict
54}
55|
56list_for_each_entry_continue_reverse@p1(c,...,member) { ... when != break;
57 when forall
58 when strict
59}
60|
61list_for_each_entry_from@p1(c,...,member) { ... when != break;
62 when forall
63 when strict
64}
65|
66list_for_each_entry_safe@p1(c,...,member) { ... when != break;
67 when forall
68 when strict
69}
70|
71list_for_each_entry_safe_continue@p1(c,...,member) { ... when != break;
72 when forall
73 when strict
74}
75|
76list_for_each_entry_safe_from@p1(c,...,member) { ... when != break;
77 when forall
78 when strict
79}
80|
81list_for_each_entry_safe_reverse@p1(c,...,member) { ... when != break;
82 when forall
83 when strict
84}
85)
86...
87(
88list_for_each_entry(c,...) S
89|
90list_for_each_entry_reverse(c,...) S
91|
92list_for_each_entry_continue(c,...) S
93|
94list_for_each_entry_continue_reverse(c,...) S
95|
96list_for_each_entry_from(c,...) S
97|
98list_for_each_entry_safe(c,...) S
99|
100list_for_each_entry_safe(x,c,...) S
101|
102list_for_each_entry_safe_continue(c,...) S
103|
104list_for_each_entry_safe_continue(x,c,...) S
105|
106list_for_each_entry_safe_from(c,...) S
107|
108list_for_each_entry_safe_from(x,c,...) S
109|
110list_for_each_entry_safe_reverse(c,...) S
111|
112list_for_each_entry_safe_reverse(x,c,...) S
113|
114hlist_for_each_entry(c,...) S
115|
116hlist_for_each_entry_continue(c,...) S
117|
118hlist_for_each_entry_from(c,...) S
119|
120hlist_for_each_entry_safe(c,...) S
121|
122list_remove_head(x,c,...)
123|
124sizeof(<+...c...+>)
125|
126&c->member
127|
128c = E
129|
130*c@p2
131)
132
133@script:python depends on org@
134p1 << r.p1;
135p2 << r.p2;
136@@
137
138cocci.print_main("invalid iterator index reference",p2)
139cocci.print_secs("iterator",p1)
140
141@script:python depends on report@
142p1 << r.p1;
143p2 << r.p2;
144@@
145
146msg = "ERROR: invalid reference to the index variable of the iterator on line %s" % (p1[0].line)
147coccilib.report.print_report(p2[0], msg)
diff --git a/scripts/coccinelle/misc/irqf_oneshot.cocci b/scripts/coccinelle/misc/irqf_oneshot.cocci
new file mode 100644
index 000000000000..6cfde94be0ef
--- /dev/null
+++ b/scripts/coccinelle/misc/irqf_oneshot.cocci
@@ -0,0 +1,65 @@
1/// Make sure threaded IRQs without a primary handler are always request with
2/// IRQF_ONESHOT
3///
4//
5// Confidence: Good
6// Comments:
7// Options: --no-includes
8
9virtual patch
10virtual context
11virtual org
12virtual report
13
14@r1@
15expression irq;
16expression thread_fn;
17expression flags;
18position p;
19@@
20request_threaded_irq@p(irq, NULL, thread_fn,
21(
22flags | IRQF_ONESHOT
23|
24IRQF_ONESHOT
25)
26, ...)
27
28@depends on patch@
29expression irq;
30expression thread_fn;
31expression flags;
32position p != r1.p;
33@@
34request_threaded_irq@p(irq, NULL, thread_fn,
35(
36-0
37+IRQF_ONESHOT
38|
39-flags
40+flags | IRQF_ONESHOT
41)
42, ...)
43
44@depends on context@
45position p != r1.p;
46@@
47*request_threaded_irq@p(...)
48
49@match depends on report || org@
50expression irq;
51position p != r1.p;
52@@
53request_threaded_irq@p(irq, NULL, ...)
54
55@script:python depends on org@
56p << match.p;
57@@
58msg = "ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT"
59coccilib.org.print_todo(p[0],msg)
60
61@script:python depends on report@
62p << match.p;
63@@
64msg = "ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT"
65coccilib.report.print_report(p[0],msg)
diff --git a/scripts/config b/scripts/config
index ed6653ef9702..ee355394f4ef 100755
--- a/scripts/config
+++ b/scripts/config
@@ -1,6 +1,9 @@
1#!/bin/bash 1#!/bin/bash
2# Manipulate options in a .config file from the command line 2# Manipulate options in a .config file from the command line
3 3
4# If no prefix forced, use the default CONFIG_
5CONFIG_="${CONFIG_-CONFIG_}"
6
4usage() { 7usage() {
5 cat >&2 <<EOL 8 cat >&2 <<EOL
6Manipulate options in a .config file from the command line. 9Manipulate options in a .config file from the command line.
@@ -14,6 +17,7 @@ commands:
14 Set option to "string" 17 Set option to "string"
15 --set-val option value 18 --set-val option value
16 Set option to value 19 Set option to value
20 --undefine|-u option Undefine option
17 --state|-s option Print state of option (n,y,m,undef) 21 --state|-s option Print state of option (n,y,m,undef)
18 22
19 --enable-after|-E beforeopt option 23 --enable-after|-E beforeopt option
@@ -26,10 +30,17 @@ commands:
26 commands can be repeated multiple times 30 commands can be repeated multiple times
27 31
28options: 32options:
29 --file .config file to change (default .config) 33 --file config-file .config file to change (default .config)
34 --keep-case|-k Keep next symbols' case (dont' upper-case it)
30 35
31config doesn't check the validity of the .config file. This is done at next 36config doesn't check the validity of the .config file. This is done at next
32 make time. 37make time.
38
39By default, config will upper-case the given symbol. Use --keep-case to keep
40the case of all following symbols unchanged.
41
42config uses 'CONFIG_' as the default symbol prefix. Set the environment
43variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" config ...
33EOL 44EOL
34 exit 1 45 exit 1
35} 46}
@@ -40,11 +51,13 @@ checkarg() {
40 usage 51 usage
41 fi 52 fi
42 case "$ARG" in 53 case "$ARG" in
43 CONFIG_*) 54 ${CONFIG_}*)
44 ARG="${ARG/CONFIG_/}" 55 ARG="${ARG/${CONFIG_}/}"
45 ;; 56 ;;
46 esac 57 esac
47 ARG="`echo $ARG | tr a-z A-Z`" 58 if [ "$MUNGE_CASE" = "yes" ] ; then
59 ARG="`echo $ARG | tr a-z A-Z`"
60 fi
48} 61}
49 62
50set_var() { 63set_var() {
@@ -61,6 +74,12 @@ set_var() {
61 fi 74 fi
62} 75}
63 76
77undef_var() {
78 local name=$1
79
80 sed -ri "/^($name=|# $name is not set)/d" "$FN"
81}
82
64if [ "$1" = "--file" ]; then 83if [ "$1" = "--file" ]; then
65 FN="$2" 84 FN="$2"
66 if [ "$FN" = "" ] ; then 85 if [ "$FN" = "" ] ; then
@@ -75,10 +94,16 @@ if [ "$1" = "" ] ; then
75 usage 94 usage
76fi 95fi
77 96
97MUNGE_CASE=yes
78while [ "$1" != "" ] ; do 98while [ "$1" != "" ] ; do
79 CMD="$1" 99 CMD="$1"
80 shift 100 shift
81 case "$CMD" in 101 case "$CMD" in
102 --keep-case|-k)
103 MUNGE_CASE=no
104 shift
105 continue
106 ;;
82 --refresh) 107 --refresh)
83 ;; 108 ;;
84 --*-after) 109 --*-after)
@@ -95,55 +120,58 @@ while [ "$1" != "" ] ; do
95 esac 120 esac
96 case "$CMD" in 121 case "$CMD" in
97 --enable|-e) 122 --enable|-e)
98 set_var "CONFIG_$ARG" "CONFIG_$ARG=y" 123 set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=y"
99 ;; 124 ;;
100 125
101 --disable|-d) 126 --disable|-d)
102 set_var "CONFIG_$ARG" "# CONFIG_$ARG is not set" 127 set_var "${CONFIG_}$ARG" "# ${CONFIG_}$ARG is not set"
103 ;; 128 ;;
104 129
105 --module|-m) 130 --module|-m)
106 set_var "CONFIG_$ARG" "CONFIG_$ARG=m" 131 set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=m"
107 ;; 132 ;;
108 133
109 --set-str) 134 --set-str)
110 # sed swallows one level of escaping, so we need double-escaping 135 # sed swallows one level of escaping, so we need double-escaping
111 set_var "CONFIG_$ARG" "CONFIG_$ARG=\"${1//\"/\\\\\"}\"" 136 set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=\"${1//\"/\\\\\"}\""
112 shift 137 shift
113 ;; 138 ;;
114 139
115 --set-val) 140 --set-val)
116 set_var "CONFIG_$ARG" "CONFIG_$ARG=$1" 141 set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=$1"
117 shift 142 shift
118 ;; 143 ;;
144 --undefine|-u)
145 undef_var "${CONFIG_}$ARG"
146 ;;
119 147
120 --state|-s) 148 --state|-s)
121 if grep -q "# CONFIG_$ARG is not set" $FN ; then 149 if grep -q "# ${CONFIG_}$ARG is not set" $FN ; then
122 echo n 150 echo n
123 else 151 else
124 V="$(grep "^CONFIG_$ARG=" $FN)" 152 V="$(grep "^${CONFIG_}$ARG=" $FN)"
125 if [ $? != 0 ] ; then 153 if [ $? != 0 ] ; then
126 echo undef 154 echo undef
127 else 155 else
128 V="${V/#CONFIG_$ARG=/}" 156 V="${V/#${CONFIG_}$ARG=/}"
129 V="${V/#\"/}" 157 V="${V/#\"/}"
130 V="${V/%\"/}" 158 V="${V/%\"/}"
131 V="${V/\\\"/\"}" 159 V="${V//\\\"/\"}"
132 echo "${V}" 160 echo "${V}"
133 fi 161 fi
134 fi 162 fi
135 ;; 163 ;;
136 164
137 --enable-after|-E) 165 --enable-after|-E)
138 set_var "CONFIG_$B" "CONFIG_$B=y" "CONFIG_$A" 166 set_var "${CONFIG_}$B" "${CONFIG_}$B=y" "${CONFIG_}$A"
139 ;; 167 ;;
140 168
141 --disable-after|-D) 169 --disable-after|-D)
142 set_var "CONFIG_$B" "# CONFIG_$B is not set" "CONFIG_$A" 170 set_var "${CONFIG_}$B" "# ${CONFIG_}$B is not set" "${CONFIG_}$A"
143 ;; 171 ;;
144 172
145 --module-after|-M) 173 --module-after|-M)
146 set_var "CONFIG_$B" "CONFIG_$B=m" "CONFIG_$A" 174 set_var "${CONFIG_}$B" "${CONFIG_}$B=m" "${CONFIG_}$A"
147 ;; 175 ;;
148 176
149 # undocumented because it ignores --file (fixme) 177 # undocumented because it ignores --file (fixme)
diff --git a/scripts/kconfig/.gitignore b/scripts/kconfig/.gitignore
index ee120d441565..be603c4fef62 100644
--- a/scripts/kconfig/.gitignore
+++ b/scripts/kconfig/.gitignore
@@ -7,7 +7,6 @@ config*
7*.tab.h 7*.tab.h
8zconf.hash.c 8zconf.hash.c
9*.moc 9*.moc
10lkc_defs.h
11gconf.glade.h 10gconf.glade.h
12*.pot 11*.pot
13*.mo 12*.mo
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 79662658fb91..77d53999ffb9 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -114,7 +114,7 @@ help:
114 @echo ' alldefconfig - New config with all symbols set to default' 114 @echo ' alldefconfig - New config with all symbols set to default'
115 @echo ' randconfig - New config with random answer to all options' 115 @echo ' randconfig - New config with random answer to all options'
116 @echo ' listnewconfig - List new options' 116 @echo ' listnewconfig - List new options'
117 @echo ' oldnoconfig - Same as silentoldconfig but set new symbols to n (unset)' 117 @echo ' oldnoconfig - Same as silentoldconfig but sets new symbols to their default value'
118 118
119# lxdialog stuff 119# lxdialog stuff
120check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh 120check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
@@ -234,12 +234,12 @@ $(obj)/.tmp_qtcheck:
234 if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \ 234 if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
235 done; \ 235 done; \
236 if [ -z "$$dir" ]; then \ 236 if [ -z "$$dir" ]; then \
237 echo "*"; \ 237 echo >&2 "*"; \
238 echo "* Unable to find any QT installation. Please make sure that"; \ 238 echo >&2 "* Unable to find any QT installation. Please make sure that"; \
239 echo "* the QT4 or QT3 development package is correctly installed and"; \ 239 echo >&2 "* the QT4 or QT3 development package is correctly installed and"; \
240 echo "* either qmake can be found or install pkg-config or set"; \ 240 echo >&2 "* either qmake can be found or install pkg-config or set"; \
241 echo "* the QTDIR environment variable to the correct location."; \ 241 echo >&2 "* the QTDIR environment variable to the correct location."; \
242 echo "*"; \ 242 echo >&2 "*"; \
243 false; \ 243 false; \
244 fi; \ 244 fi; \
245 libpath=$$dir/lib; lib=qt; osdir=""; \ 245 libpath=$$dir/lib; lib=qt; osdir=""; \
@@ -260,8 +260,8 @@ $(obj)/.tmp_qtcheck:
260 else \ 260 else \
261 cflags="\$$(shell pkg-config QtCore QtGui Qt3Support --cflags)"; \ 261 cflags="\$$(shell pkg-config QtCore QtGui Qt3Support --cflags)"; \
262 libs="\$$(shell pkg-config QtCore QtGui Qt3Support --libs)"; \ 262 libs="\$$(shell pkg-config QtCore QtGui Qt3Support --libs)"; \
263 binpath="\$$(shell pkg-config QtCore --variable=prefix)"; \ 263 moc="\$$(shell pkg-config QtCore --variable=moc_location)"; \
264 moc="$$binpath/bin/moc"; \ 264 [ -n "$$moc" ] || moc="\$$(shell pkg-config QtCore --variable=prefix)/bin/moc"; \
265 fi; \ 265 fi; \
266 echo "KC_QT_CFLAGS=$$cflags" > $@; \ 266 echo "KC_QT_CFLAGS=$$cflags" > $@; \
267 echo "KC_QT_LIBS=$$libs" >> $@; \ 267 echo "KC_QT_LIBS=$$libs" >> $@; \
@@ -279,17 +279,17 @@ $(obj)/.tmp_gtkcheck:
279 if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \ 279 if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \
280 touch $@; \ 280 touch $@; \
281 else \ 281 else \
282 echo "*"; \ 282 echo >&2 "*"; \
283 echo "* GTK+ is present but version >= 2.0.0 is required."; \ 283 echo >&2 "* GTK+ is present but version >= 2.0.0 is required."; \
284 echo "*"; \ 284 echo >&2 "*"; \
285 false; \ 285 false; \
286 fi \ 286 fi \
287 else \ 287 else \
288 echo "*"; \ 288 echo >&2 "*"; \
289 echo "* Unable to find the GTK+ installation. Please make sure that"; \ 289 echo >&2 "* Unable to find the GTK+ installation. Please make sure that"; \
290 echo "* the GTK+ 2.0 development package is correctly installed..."; \ 290 echo >&2 "* the GTK+ 2.0 development package is correctly installed..."; \
291 echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \ 291 echo >&2 "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \
292 echo "*"; \ 292 echo >&2 "*"; \
293 false; \ 293 false; \
294 fi 294 fi
295endif 295endif
@@ -298,8 +298,11 @@ $(obj)/zconf.tab.o: $(obj)/zconf.lex.c $(obj)/zconf.hash.c
298 298
299$(obj)/qconf.o: $(obj)/qconf.moc 299$(obj)/qconf.o: $(obj)/qconf.moc
300 300
301$(obj)/%.moc: $(src)/%.h 301quiet_cmd_moc = MOC $@
302 $(KC_QT_MOC) -i $< -o $@ 302 cmd_moc = $(KC_QT_MOC) -i $< -o $@
303
304$(obj)/%.moc: $(src)/%.h $(obj)/.tmp_qtcheck
305 $(call cmd,moc)
303 306
304# Extract gconf menu items for I18N support 307# Extract gconf menu items for I18N support
305$(obj)/gconf.glade.h: $(obj)/gconf.glade 308$(obj)/gconf.glade.h: $(obj)/gconf.glade
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 52577f052bc1..13ddf1126c2a 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -182,10 +182,66 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
182 return 0; 182 return 0;
183} 183}
184 184
185#define LINE_GROWTH 16
186static int add_byte(int c, char **lineptr, size_t slen, size_t *n)
187{
188 char *nline;
189 size_t new_size = slen + 1;
190 if (new_size > *n) {
191 new_size += LINE_GROWTH - 1;
192 new_size *= 2;
193 nline = realloc(*lineptr, new_size);
194 if (!nline)
195 return -1;
196
197 *lineptr = nline;
198 *n = new_size;
199 }
200
201 (*lineptr)[slen] = c;
202
203 return 0;
204}
205
206static ssize_t compat_getline(char **lineptr, size_t *n, FILE *stream)
207{
208 char *line = *lineptr;
209 size_t slen = 0;
210
211 for (;;) {
212 int c = getc(stream);
213
214 switch (c) {
215 case '\n':
216 if (add_byte(c, &line, slen, n) < 0)
217 goto e_out;
218 slen++;
219 /* fall through */
220 case EOF:
221 if (add_byte('\0', &line, slen, n) < 0)
222 goto e_out;
223 *lineptr = line;
224 if (slen == 0)
225 return -1;
226 return slen;
227 default:
228 if (add_byte(c, &line, slen, n) < 0)
229 goto e_out;
230 slen++;
231 }
232 }
233
234e_out:
235 line[slen-1] = '\0';
236 *lineptr = line;
237 return -1;
238}
239
185int conf_read_simple(const char *name, int def) 240int conf_read_simple(const char *name, int def)
186{ 241{
187 FILE *in = NULL; 242 FILE *in = NULL;
188 char line[1024]; 243 char *line = NULL;
244 size_t line_asize = 0;
189 char *p, *p2; 245 char *p, *p2;
190 struct symbol *sym; 246 struct symbol *sym;
191 int i, def_flags; 247 int i, def_flags;
@@ -247,7 +303,7 @@ load:
247 } 303 }
248 } 304 }
249 305
250 while (fgets(line, sizeof(line), in)) { 306 while (compat_getline(&line, &line_asize, in) != -1) {
251 conf_lineno++; 307 conf_lineno++;
252 sym = NULL; 308 sym = NULL;
253 if (line[0] == '#') { 309 if (line[0] == '#') {
@@ -335,6 +391,7 @@ setsym:
335 cs->def[def].tri = EXPR_OR(cs->def[def].tri, sym->def[def].tri); 391 cs->def[def].tri = EXPR_OR(cs->def[def].tri, sym->def[def].tri);
336 } 392 }
337 } 393 }
394 free(line);
338 fclose(in); 395 fclose(in);
339 396
340 if (modules_sym) 397 if (modules_sym)
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh
index 82cc3a85e7f8..e3b12c010417 100644
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
@@ -4,7 +4,7 @@
4# What library to link 4# What library to link
5ldflags() 5ldflags()
6{ 6{
7 for ext in so a dylib ; do 7 for ext in so a dll.a dylib ; do
8 for lib in ncursesw ncurses curses ; do 8 for lib in ncursesw ncurses curses ; do
9 $cc -print-file-name=lib${lib}.${ext} | grep -q / 9 $cc -print-file-name=lib${lib}.${ext} | grep -q /
10 if [ $? -eq 0 ]; then 10 if [ $? -eq 0 ]; then
@@ -19,12 +19,12 @@ ldflags()
19# Where is ncurses.h? 19# Where is ncurses.h?
20ccflags() 20ccflags()
21{ 21{
22 if [ -f /usr/include/ncurses/ncurses.h ]; then 22 if [ -f /usr/include/ncursesw/curses.h ]; then
23 echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"'
24 elif [ -f /usr/include/ncurses/ncurses.h ]; then
23 echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"' 25 echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
24 elif [ -f /usr/include/ncurses/curses.h ]; then 26 elif [ -f /usr/include/ncurses/curses.h ]; then
25 echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"' 27 echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"'
26 elif [ -f /usr/include/ncursesw/curses.h ]; then
27 echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"'
28 elif [ -f /usr/include/ncurses.h ]; then 28 elif [ -f /usr/include/ncurses.h ]; then
29 echo '-DCURSES_LOC="<ncurses.h>"' 29 echo '-DCURSES_LOC="<ncurses.h>"'
30 else 30 else
diff --git a/scripts/kconfig/lxdialog/textbox.c b/scripts/kconfig/lxdialog/textbox.c
index 154c2dd245b7..4e5de60a0c0d 100644
--- a/scripts/kconfig/lxdialog/textbox.c
+++ b/scripts/kconfig/lxdialog/textbox.c
@@ -129,6 +129,7 @@ do_resize:
129 case 'e': 129 case 'e':
130 case 'X': 130 case 'X':
131 case 'x': 131 case 'x':
132 case 'q':
132 delwin(box); 133 delwin(box);
133 delwin(dialog); 134 delwin(dialog);
134 return 0; 135 return 0;
@@ -190,6 +191,7 @@ do_resize:
190 break; 191 break;
191 case 'B': /* Previous page */ 192 case 'B': /* Previous page */
192 case 'b': 193 case 'b':
194 case 'u':
193 case KEY_PPAGE: 195 case KEY_PPAGE:
194 if (begin_reached) 196 if (begin_reached)
195 break; 197 break;
@@ -214,6 +216,7 @@ do_resize:
214 break; 216 break;
215 case KEY_NPAGE: /* Next page */ 217 case KEY_NPAGE: /* Next page */
216 case ' ': 218 case ' ':
219 case 'd':
217 if (end_reached) 220 if (end_reached)
218 break; 221 break;
219 222
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index f606738d421d..f584a281bb4c 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -105,10 +105,10 @@ static const char mconf_readme[] = N_(
105"Text Box (Help Window)\n" 105"Text Box (Help Window)\n"
106"--------\n" 106"--------\n"
107"o Use the cursor keys to scroll up/down/left/right. The VI editor\n" 107"o Use the cursor keys to scroll up/down/left/right. The VI editor\n"
108" keys h,j,k,l function here as do <SPACE BAR> and <B> for those\n" 108" keys h,j,k,l function here as do <u>, <d>, <SPACE BAR> and <B> for \n"
109" who are familiar with less and lynx.\n" 109" those who are familiar with less and lynx.\n"
110"\n" 110"\n"
111"o Press <E>, <X>, <Enter> or <Esc><Esc> to exit.\n" 111"o Press <E>, <X>, <q>, <Enter> or <Esc><Esc> to exit.\n"
112"\n" 112"\n"
113"\n" 113"\n"
114"Alternate Configuration Files\n" 114"Alternate Configuration Files\n"
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index 8c0eb65978c9..1704a8562a5d 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -83,10 +83,10 @@ static const char nconf_readme[] = N_(
83"Text Box (Help Window)\n" 83"Text Box (Help Window)\n"
84"--------\n" 84"--------\n"
85"o Use the cursor keys to scroll up/down/left/right. The VI editor\n" 85"o Use the cursor keys to scroll up/down/left/right. The VI editor\n"
86" keys h,j,k,l function here as do <SPACE BAR> for those\n" 86" keys h,j,k,l function here as do <u>, <d> and <SPACE BAR> for\n"
87" who are familiar with less and lynx.\n" 87" those who are familiar with less and lynx.\n"
88"\n" 88"\n"
89"o Press <Enter>, <F1>, <F5>, <F7> or <Esc> to exit.\n" 89"o Press <Enter>, <F1>, <F5>, <F9>, <q> or <Esc> to exit.\n"
90"\n" 90"\n"
91"\n" 91"\n"
92"Alternate Configuration Files\n" 92"Alternate Configuration Files\n"
@@ -1503,7 +1503,11 @@ int main(int ac, char **av)
1503 } 1503 }
1504 1504
1505 notimeout(stdscr, FALSE); 1505 notimeout(stdscr, FALSE);
1506#if NCURSES_REENTRANT
1507 set_escdelay(1);
1508#else
1506 ESCDELAY = 1; 1509 ESCDELAY = 1;
1510#endif
1507 1511
1508 /* set btns menu */ 1512 /* set btns menu */
1509 curses_menu = new_menu(curses_menu_items); 1513 curses_menu = new_menu(curses_menu_items);
diff --git a/scripts/kconfig/nconf.gui.c b/scripts/kconfig/nconf.gui.c
index 3b18dd839668..379003c7a2b4 100644
--- a/scripts/kconfig/nconf.gui.c
+++ b/scripts/kconfig/nconf.gui.c
@@ -604,9 +604,11 @@ void show_scroll_win(WINDOW *main_window,
604 switch (res) { 604 switch (res) {
605 case KEY_NPAGE: 605 case KEY_NPAGE:
606 case ' ': 606 case ' ':
607 case 'd':
607 start_y += text_lines-2; 608 start_y += text_lines-2;
608 break; 609 break;
609 case KEY_PPAGE: 610 case KEY_PPAGE:
611 case 'u':
610 start_y -= text_lines+2; 612 start_y -= text_lines+2;
611 break; 613 break;
612 case KEY_HOME: 614 case KEY_HOME:
@@ -632,10 +634,10 @@ void show_scroll_win(WINDOW *main_window,
632 start_x++; 634 start_x++;
633 break; 635 break;
634 } 636 }
635 if (res == 10 || res == 27 || res == 'q' 637 if (res == 10 || res == 27 || res == 'q' ||
636 || res == KEY_F(F_BACK) || res == KEY_F(F_EXIT)) { 638 res == KEY_F(F_HELP) || res == KEY_F(F_BACK) ||
639 res == KEY_F(F_EXIT))
637 break; 640 break;
638 }
639 if (start_y < 0) 641 if (start_y < 0)
640 start_y = 0; 642 start_y = 0;
641 if (start_y >= total_lines-text_lines) 643 if (start_y >= total_lines-text_lines)
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index bccf07ddd0b6..2fbbbc1ddea0 100644
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -45,6 +45,16 @@
45use strict; 45use strict;
46use Getopt::Long; 46use Getopt::Long;
47 47
48# set the environment variable LOCALMODCONFIG_DEBUG to get
49# debug output.
50my $debugprint = 0;
51$debugprint = 1 if (defined($ENV{LOCALMODCONFIG_DEBUG}));
52
53sub dprint {
54 return if (!$debugprint);
55 print STDERR @_;
56}
57
48my $config = ".config"; 58my $config = ".config";
49 59
50my $uname = `uname -r`; 60my $uname = `uname -r`;
@@ -113,6 +123,10 @@ sub find_config {
113 123
114find_config; 124find_config;
115 125
126# Read in the entire config file into config_file
127my @config_file = <CIN>;
128close CIN;
129
116# Parse options 130# Parse options
117my $localmodconfig = 0; 131my $localmodconfig = 0;
118my $localyesconfig = 0; 132my $localyesconfig = 0;
@@ -186,6 +200,7 @@ sub read_kconfig {
186 $state = "NEW"; 200 $state = "NEW";
187 $config = $2; 201 $config = $2;
188 202
203 # Add depends for 'if' nesting
189 for (my $i = 0; $i < $iflevel; $i++) { 204 for (my $i = 0; $i < $iflevel; $i++) {
190 if ($i) { 205 if ($i) {
191 $depends{$config} .= " " . $ifdeps[$i]; 206 $depends{$config} .= " " . $ifdeps[$i];
@@ -204,10 +219,11 @@ sub read_kconfig {
204 219
205 # Get the configs that select this config 220 # Get the configs that select this config
206 } elsif ($state ne "NONE" && /^\s*select\s+(\S+)/) { 221 } elsif ($state ne "NONE" && /^\s*select\s+(\S+)/) {
207 if (defined($selects{$1})) { 222 my $conf = $1;
208 $selects{$1} .= " " . $config; 223 if (defined($selects{$conf})) {
224 $selects{$conf} .= " " . $config;
209 } else { 225 } else {
210 $selects{$1} = $config; 226 $selects{$conf} = $config;
211 } 227 }
212 228
213 # configs without prompts must be selected 229 # configs without prompts must be selected
@@ -250,6 +266,7 @@ if ($kconfig) {
250 read_kconfig($kconfig); 266 read_kconfig($kconfig);
251} 267}
252 268
269# Makefiles can use variables to define their dependencies
253sub convert_vars { 270sub convert_vars {
254 my ($line, %vars) = @_; 271 my ($line, %vars) = @_;
255 272
@@ -293,6 +310,7 @@ foreach my $makefile (@makefiles) {
293 310
294 my $objs; 311 my $objs;
295 312
313 # Convert variables in a line (could define configs)
296 $_ = convert_vars($_, %make_vars); 314 $_ = convert_vars($_, %make_vars);
297 315
298 # collect objects after obj-$(CONFIG_FOO_BAR) 316 # collect objects after obj-$(CONFIG_FOO_BAR)
@@ -373,13 +391,15 @@ while (<LIN>) {
373close (LIN); 391close (LIN);
374 392
375# add to the configs hash all configs that are needed to enable 393# add to the configs hash all configs that are needed to enable
376# a loaded module. 394# a loaded module. This is a direct obj-${CONFIG_FOO} += bar.o
395# where we know we need bar.o so we add FOO to the list.
377my %configs; 396my %configs;
378foreach my $module (keys(%modules)) { 397foreach my $module (keys(%modules)) {
379 if (defined($objects{$module})) { 398 if (defined($objects{$module})) {
380 my @arr = @{$objects{$module}}; 399 my @arr = @{$objects{$module}};
381 foreach my $conf (@arr) { 400 foreach my $conf (@arr) {
382 $configs{$conf} = $module; 401 $configs{$conf} = $module;
402 dprint "$conf added by direct ($module)\n";
383 } 403 }
384 } else { 404 } else {
385 # Most likely, someone has a custom (binary?) module loaded. 405 # Most likely, someone has a custom (binary?) module loaded.
@@ -387,9 +407,24 @@ foreach my $module (keys(%modules)) {
387 } 407 }
388} 408}
389 409
410# Read the current config, and see what is enabled. We want to
411# ignore configs that we would not enable anyway.
412
413my %orig_configs;
390my $valid = "A-Za-z_0-9"; 414my $valid = "A-Za-z_0-9";
415
416foreach my $line (@config_file) {
417 $_ = $line;
418
419 if (/(CONFIG_[$valid]*)=(m|y)/) {
420 $orig_configs{$1} = $2;
421 }
422}
423
391my $repeat = 1; 424my $repeat = 1;
392 425
426my $depconfig;
427
393# 428#
394# Note, we do not care about operands (like: &&, ||, !) we want to add any 429# Note, we do not care about operands (like: &&, ||, !) we want to add any
395# config that is in the depend list of another config. This script does 430# config that is in the depend list of another config. This script does
@@ -398,7 +433,7 @@ my $repeat = 1;
398# to keep on. If A was on in the original config, B would not have been 433# to keep on. If A was on in the original config, B would not have been
399# and B would not be turned on by this script. 434# and B would not be turned on by this script.
400# 435#
401sub parse_config_dep_select 436sub parse_config_depends
402{ 437{
403 my ($p) = @_; 438 my ($p) = @_;
404 439
@@ -409,10 +444,16 @@ sub parse_config_dep_select
409 444
410 $p =~ s/^[^$valid]*[$valid]+//; 445 $p =~ s/^[^$valid]*[$valid]+//;
411 446
447 # We only need to process if the depend config is a module
448 if (!defined($orig_configs{$conf}) || !$orig_configs{conf} eq "m") {
449 next;
450 }
451
412 if (!defined($configs{$conf})) { 452 if (!defined($configs{$conf})) {
413 # We must make sure that this config has its 453 # We must make sure that this config has its
414 # dependencies met. 454 # dependencies met.
415 $repeat = 1; # do again 455 $repeat = 1; # do again
456 dprint "$conf selected by depend $depconfig\n";
416 $configs{$conf} = 1; 457 $configs{$conf} = 1;
417 } 458 }
418 } else { 459 } else {
@@ -421,31 +462,132 @@ sub parse_config_dep_select
421 } 462 }
422} 463}
423 464
424while ($repeat) { 465# Select is treated a bit differently than depends. We call this
425 $repeat = 0; 466# when a config has no prompt and requires another config to be
467# selected. We use to just select all configs that selected this
468# config, but found that that can balloon into enabling hundreds
469# of configs that we do not care about.
470#
471# The idea is we look at all the configs that select it. If one
472# is already in our list of configs to enable, then there's nothing
473# else to do. If there isn't, we pick the first config that was
474# enabled in the orignal config and use that.
475sub parse_config_selects
476{
477 my ($config, $p) = @_;
426 478
427 foreach my $config (keys %configs) { 479 my $next_config;
428 $config =~ s/^CONFIG_//; 480
481 while ($p =~ /[$valid]/) {
429 482
430 if (defined($depends{$config})) { 483 if ($p =~ /^[^$valid]*([$valid]+)/) {
431 # This config has dependencies. Make sure they are also included 484 my $conf = "CONFIG_" . $1;
432 parse_config_dep_select $depends{$config}; 485
486 $p =~ s/^[^$valid]*[$valid]+//;
487
488 # Make sure that this config exists in the current .config file
489 if (!defined($orig_configs{$conf})) {
490 dprint "$conf not set for $config select\n";
491 next;
492 }
493
494 # Check if something other than a module selects this config
495 if (defined($orig_configs{$conf}) && $orig_configs{$conf} ne "m") {
496 dprint "$conf (non module) selects config, we are good\n";
497 # we are good with this
498 return;
499 }
500 if (defined($configs{$conf})) {
501 dprint "$conf selects $config so we are good\n";
502 # A set config selects this config, we are good
503 return;
504 }
505 # Set this config to be selected
506 if (!defined($next_config)) {
507 $next_config = $conf;
508 }
509 } else {
510 die "this should never happen";
433 } 511 }
512 }
434 513
435 if (defined($prompts{$config}) || !defined($selects{$config})) { 514 # If no possible config selected this, then something happened.
436 next; 515 if (!defined($next_config)) {
516 print STDERR "WARNING: $config is required, but nothing in the\n";
517 print STDERR " current config selects it.\n";
518 return;
519 }
520
521 # If we are here, then we found no config that is set and
522 # selects this config. Repeat.
523 $repeat = 1;
524 # Make this config need to be selected
525 $configs{$next_config} = 1;
526 dprint "$next_config selected by select $config\n";
527}
528
529my %process_selects;
530
531# loop through all configs, select their dependencies.
532sub loop_depend {
533 $repeat = 1;
534
535 while ($repeat) {
536 $repeat = 0;
537
538 forloop:
539 foreach my $config (keys %configs) {
540
541 # If this config is not a module, we do not need to process it
542 if (defined($orig_configs{$config}) && $orig_configs{$config} ne "m") {
543 next forloop;
544 }
545
546 $config =~ s/^CONFIG_//;
547 $depconfig = $config;
548
549 if (defined($depends{$config})) {
550 # This config has dependencies. Make sure they are also included
551 parse_config_depends $depends{$config};
552 }
553
554 # If the config has no prompt, then we need to check if a config
555 # that is enabled selected it. Or if we need to enable one.
556 if (!defined($prompts{$config}) && defined($selects{$config})) {
557 $process_selects{$config} = 1;
558 }
437 } 559 }
560 }
561}
562
563sub loop_select {
564
565 foreach my $config (keys %process_selects) {
566 $config =~ s/^CONFIG_//;
567
568 dprint "Process select $config\n";
438 569
439 # config has no prompt and must be selected. 570 # config has no prompt and must be selected.
440 parse_config_dep_select $selects{$config}; 571 parse_config_selects $config, $selects{$config};
441 } 572 }
442} 573}
443 574
575while ($repeat) {
576 # Get the first set of configs and their dependencies.
577 loop_depend;
578
579 $repeat = 0;
580
581 # Now we need to see if we have to check selects;
582 loop_select;
583}
584
444my %setconfigs; 585my %setconfigs;
445 586
446# Finally, read the .config file and turn off any module enabled that 587# Finally, read the .config file and turn off any module enabled that
447# we could not find a reason to keep enabled. 588# we could not find a reason to keep enabled.
448while(<CIN>) { 589foreach my $line (@config_file) {
590 $_ = $line;
449 591
450 if (/CONFIG_IKCONFIG/) { 592 if (/CONFIG_IKCONFIG/) {
451 if (/# CONFIG_IKCONFIG is not set/) { 593 if (/# CONFIG_IKCONFIG is not set/) {
@@ -473,7 +615,6 @@ while(<CIN>) {
473 } 615 }
474 print; 616 print;
475} 617}
476close(CIN);
477 618
478# Integrity check, make sure all modules that we want enabled do 619# Integrity check, make sure all modules that we want enabled do
479# indeed have their configs set. 620# indeed have their configs set.
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index cd9c6c6bb4c9..4629038c9e5a 100644
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -210,8 +210,8 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then
210 mksysmap ${kallsyms_vmlinux} .tmp_System.map 210 mksysmap ${kallsyms_vmlinux} .tmp_System.map
211 211
212 if ! cmp -s System.map .tmp_System.map; then 212 if ! cmp -s System.map .tmp_System.map; then
213 echo Inconsistent kallsyms data 213 echo >&2 Inconsistent kallsyms data
214 echo echo Try "make KALLSYMS_EXTRA_PASS=1" as a workaround 214 echo >&2 echo Try "make KALLSYMS_EXTRA_PASS=1" as a workaround
215 cleanup 215 cleanup
216 exit 1 216 exit 1
217 fi 217 fi
diff --git a/scripts/mksysmap b/scripts/mksysmap
index 6e133a0bae7a..c1b6191ef879 100644
--- a/scripts/mksysmap
+++ b/scripts/mksysmap
@@ -16,7 +16,7 @@
16# The second row specify the type of the symbol: 16# The second row specify the type of the symbol:
17# A = Absolute 17# A = Absolute
18# B = Uninitialised data (.bss) 18# B = Uninitialised data (.bss)
19# C = Comon symbol 19# C = Common symbol
20# D = Initialised data 20# D = Initialised data
21# G = Initialised data for small objects 21# G = Initialised data for small objects
22# I = Indirect reference to another symbol 22# I = Indirect reference to another symbol
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 5759751a1f61..7ed6864ef65b 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -156,7 +156,7 @@ static void device_id_check(const char *modname, const char *device_id,
156} 156}
157 157
158/* USB is special because the bcdDevice can be matched against a numeric range */ 158/* USB is special because the bcdDevice can be matched against a numeric range */
159/* Looks like "usb:vNpNdNdcNdscNdpNicNiscNipN" */ 159/* Looks like "usb:vNpNdNdcNdscNdpNicNiscNipNinN" */
160static void do_usb_entry(struct usb_device_id *id, 160static void do_usb_entry(struct usb_device_id *id,
161 unsigned int bcdDevice_initial, int bcdDevice_initial_digits, 161 unsigned int bcdDevice_initial, int bcdDevice_initial_digits,
162 unsigned char range_lo, unsigned char range_hi, 162 unsigned char range_lo, unsigned char range_hi,
@@ -210,6 +210,9 @@ static void do_usb_entry(struct usb_device_id *id,
210 ADD(alias, "ip", 210 ADD(alias, "ip",
211 id->match_flags&USB_DEVICE_ID_MATCH_INT_PROTOCOL, 211 id->match_flags&USB_DEVICE_ID_MATCH_INT_PROTOCOL,
212 id->bInterfaceProtocol); 212 id->bInterfaceProtocol);
213 ADD(alias, "in",
214 id->match_flags&USB_DEVICE_ID_MATCH_INT_NUMBER,
215 id->bInterfaceNumber);
213 216
214 add_wildcard(alias); 217 add_wildcard(alias);
215 buf_printf(&mod->dev_table_buf, 218 buf_printf(&mod->dev_table_buf,
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 0f84bb38eb0d..68e9f5ed0a6f 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -865,6 +865,11 @@ static void check_section(const char *modname, struct elf_info *elf,
865#define ALL_EXIT_TEXT_SECTIONS \ 865#define ALL_EXIT_TEXT_SECTIONS \
866 ".exit.text$", ".devexit.text$", ".cpuexit.text$", ".memexit.text$" 866 ".exit.text$", ".devexit.text$", ".cpuexit.text$", ".memexit.text$"
867 867
868#define ALL_PCI_INIT_SECTIONS \
869 ".pci_fixup_early$", ".pci_fixup_header$", ".pci_fixup_final$", \
870 ".pci_fixup_enable$", ".pci_fixup_resume$", \
871 ".pci_fixup_resume_early$", ".pci_fixup_suspend$"
872
868#define ALL_XXXINIT_SECTIONS DEV_INIT_SECTIONS, CPU_INIT_SECTIONS, \ 873#define ALL_XXXINIT_SECTIONS DEV_INIT_SECTIONS, CPU_INIT_SECTIONS, \
869 MEM_INIT_SECTIONS 874 MEM_INIT_SECTIONS
870#define ALL_XXXEXIT_SECTIONS DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, \ 875#define ALL_XXXEXIT_SECTIONS DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, \
@@ -1027,6 +1032,12 @@ const struct sectioncheck sectioncheck[] = {
1027 .mismatch = ANY_EXIT_TO_ANY_INIT, 1032 .mismatch = ANY_EXIT_TO_ANY_INIT,
1028 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, 1033 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL },
1029}, 1034},
1035{
1036 .fromsec = { ALL_PCI_INIT_SECTIONS, NULL },
1037 .tosec = { INIT_SECTIONS, NULL },
1038 .mismatch = ANY_INIT_TO_ANY_EXIT,
1039 .symbol_white_list = { NULL },
1040},
1030/* Do not export init/exit functions or data */ 1041/* Do not export init/exit functions or data */
1031{ 1042{
1032 .fromsec = { "__ksymtab*", NULL }, 1043 .fromsec = { "__ksymtab*", NULL },
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index c95fdda58414..acb86507828a 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -92,7 +92,7 @@ rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir"
92mkdir -m 755 -p "$tmpdir/DEBIAN" 92mkdir -m 755 -p "$tmpdir/DEBIAN"
93mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename" 93mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename"
94mkdir -m 755 -p "$fwdir/DEBIAN" 94mkdir -m 755 -p "$fwdir/DEBIAN"
95mkdir -p "$fwdir/lib" "$fwdir/usr/share/doc/$fwpackagename" 95mkdir -p "$fwdir/lib/firmware/$version/" "$fwdir/usr/share/doc/$fwpackagename"
96mkdir -m 755 -p "$libc_headers_dir/DEBIAN" 96mkdir -m 755 -p "$libc_headers_dir/DEBIAN"
97mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename" 97mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename"
98mkdir -m 755 -p "$kernel_headers_dir/DEBIAN" 98mkdir -m 755 -p "$kernel_headers_dir/DEBIAN"
@@ -243,7 +243,7 @@ EOF
243fi 243fi
244 244
245# Build header package 245# Build header package
246(cd $srctree; find . -name Makefile -o -name Kconfig\* -o -name \*.pl > "$objtree/debian/hdrsrcfiles") 246(cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl > "$objtree/debian/hdrsrcfiles")
247(cd $srctree; find arch/$SRCARCH/include include scripts -type f >> "$objtree/debian/hdrsrcfiles") 247(cd $srctree; find arch/$SRCARCH/include include scripts -type f >> "$objtree/debian/hdrsrcfiles")
248(cd $objtree; find arch/$SRCARCH/include .config Module.symvers include scripts -type f >> "$objtree/debian/hdrobjfiles") 248(cd $objtree; find arch/$SRCARCH/include .config Module.symvers include scripts -type f >> "$objtree/debian/hdrobjfiles")
249destdir=$kernel_headers_dir/usr/src/linux-headers-$version 249destdir=$kernel_headers_dir/usr/src/linux-headers-$version
@@ -267,7 +267,8 @@ EOF
267 267
268# Do we have firmware? Move it out of the way and build it into a package. 268# Do we have firmware? Move it out of the way and build it into a package.
269if [ -e "$tmpdir/lib/firmware" ]; then 269if [ -e "$tmpdir/lib/firmware" ]; then
270 mv "$tmpdir/lib/firmware" "$fwdir/lib/" 270 mv "$tmpdir/lib/firmware"/* "$fwdir/lib/firmware/$version/"
271 rmdir "$tmpdir/lib/firmware"
271 272
272 cat <<EOF >> debian/control 273 cat <<EOF >> debian/control
273 274
diff --git a/scripts/sortextable.c b/scripts/sortextable.c
index 1ca9ceb95eb6..6acf83449105 100644
--- a/scripts/sortextable.c
+++ b/scripts/sortextable.c
@@ -247,6 +247,7 @@ do_file(char const *const fname)
247 case EM_X86_64: 247 case EM_X86_64:
248 custom_sort = sort_x86_table; 248 custom_sort = sort_x86_table;
249 break; 249 break;
250 case EM_S390:
250 case EM_MIPS: 251 case EM_MIPS:
251 break; 252 break;
252 } /* end switch */ 253 } /* end switch */
diff --git a/scripts/tags.sh b/scripts/tags.sh
index cf7b12fee573..cff8faad73d1 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -153,7 +153,8 @@ exuberant()
153 --regex-c++='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \ 153 --regex-c++='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \
154 --regex-c++='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \ 154 --regex-c++='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \
155 --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ 155 --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \
156 --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' 156 --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \
157 --regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/'
157 158
158 all_kconfigs | xargs $1 -a \ 159 all_kconfigs | xargs $1 -a \
159 --langdef=kconfig --language-force=kconfig \ 160 --langdef=kconfig --language-force=kconfig \
@@ -195,7 +196,8 @@ emacs()
195 --regex='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \ 196 --regex='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \
196 --regex='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \ 197 --regex='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \
197 --regex='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ 198 --regex='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \
198 --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' 199 --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \
200 --regex='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/'
199 201
200 all_kconfigs | xargs $1 -a \ 202 all_kconfigs | xargs $1 -a \
201 --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' 203 --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'