diff options
Diffstat (limited to 'scripts')
62 files changed, 504 insertions, 240 deletions
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index 182084d728c8..8ccf83056a7a 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst | |||
@@ -47,18 +47,24 @@ header-y := $(filter-out $(generic-y), $(header-y)) | |||
47 | all-files := $(header-y) $(genhdr-y) $(wrapper-files) | 47 | all-files := $(header-y) $(genhdr-y) $(wrapper-files) |
48 | output-files := $(addprefix $(installdir)/, $(all-files)) | 48 | output-files := $(addprefix $(installdir)/, $(all-files)) |
49 | 49 | ||
50 | input-files := $(foreach hdr, $(header-y), \ | 50 | input-files1 := $(foreach hdr, $(header-y), \ |
51 | $(if $(wildcard $(srcdir)/$(hdr)), \ | 51 | $(if $(wildcard $(srcdir)/$(hdr)), \ |
52 | $(wildcard $(srcdir)/$(hdr)), \ | 52 | $(wildcard $(srcdir)/$(hdr))) \ |
53 | ) | ||
54 | input-files1-name := $(notdir $(input-files1)) | ||
55 | input-files2 := $(foreach hdr, $(header-y), \ | ||
56 | $(if $(wildcard $(srcdir)/$(hdr)),, \ | ||
53 | $(if $(wildcard $(oldsrcdir)/$(hdr)), \ | 57 | $(if $(wildcard $(oldsrcdir)/$(hdr)), \ |
54 | $(wildcard $(oldsrcdir)/$(hdr)), \ | 58 | $(wildcard $(oldsrcdir)/$(hdr)), \ |
55 | $(error Missing UAPI file $(srcdir)/$(hdr))) \ | 59 | $(error Missing UAPI file $(srcdir)/$(hdr))) \ |
56 | )) \ | 60 | )) |
57 | $(foreach hdr, $(genhdr-y), \ | 61 | input-files2-name := $(notdir $(input-files2)) |
62 | input-files3 := $(foreach hdr, $(genhdr-y), \ | ||
58 | $(if $(wildcard $(gendir)/$(hdr)), \ | 63 | $(if $(wildcard $(gendir)/$(hdr)), \ |
59 | $(wildcard $(gendir)/$(hdr)), \ | 64 | $(wildcard $(gendir)/$(hdr)), \ |
60 | $(error Missing generated UAPI file $(gendir)/$(hdr)) \ | 65 | $(error Missing generated UAPI file $(gendir)/$(hdr)) \ |
61 | )) | 66 | )) |
67 | input-files3-name := $(notdir $(input-files3)) | ||
62 | 68 | ||
63 | # Work out what needs to be removed | 69 | # Work out what needs to be removed |
64 | oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h)) | 70 | oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h)) |
@@ -72,7 +78,9 @@ printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@)) | |||
72 | quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ | 78 | quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ |
73 | file$(if $(word 2, $(all-files)),s)) | 79 | file$(if $(word 2, $(all-files)),s)) |
74 | cmd_install = \ | 80 | cmd_install = \ |
75 | $(CONFIG_SHELL) $< $(installdir) $(input-files); \ | 81 | $(CONFIG_SHELL) $< $(installdir) $(srcdir) $(input-files1-name); \ |
82 | $(CONFIG_SHELL) $< $(installdir) $(oldsrcdir) $(input-files2-name); \ | ||
83 | $(CONFIG_SHELL) $< $(installdir) $(gendir) $(input-files3-name); \ | ||
76 | for F in $(wrapper-files); do \ | 84 | for F in $(wrapper-files); do \ |
77 | echo "\#include <asm-generic/$$F>" > $(installdir)/$$F; \ | 85 | echo "\#include <asm-generic/$$F>" > $(installdir)/$$F; \ |
78 | done; \ | 86 | done; \ |
@@ -98,7 +106,7 @@ __headersinst: $(subdirs) $(install-file) | |||
98 | @: | 106 | @: |
99 | 107 | ||
100 | targets += $(install-file) | 108 | targets += $(install-file) |
101 | $(install-file): scripts/headers_install.sh $(input-files) FORCE | 109 | $(install-file): scripts/headers_install.sh $(input-files1) $(input-files2) $(input-files3) FORCE |
102 | $(if $(unwanted),$(call cmd,remove),) | 110 | $(if $(unwanted),$(call cmd,remove),) |
103 | $(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@))) | 111 | $(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@))) |
104 | $(call if_changed,install) | 112 | $(call if_changed,install) |
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index f97869f1f09b..49392ecbef17 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -63,7 +63,7 @@ multi-objs := $(multi-objs-y) $(multi-objs-m) | |||
63 | subdir-obj-y := $(filter %/built-in.o, $(obj-y)) | 63 | subdir-obj-y := $(filter %/built-in.o, $(obj-y)) |
64 | 64 | ||
65 | # $(obj-dirs) is a list of directories that contain object files | 65 | # $(obj-dirs) is a list of directories that contain object files |
66 | obj-dirs := $(dir $(multi-objs) $(subdir-obj-y)) | 66 | obj-dirs := $(dir $(multi-objs) $(obj-y)) |
67 | 67 | ||
68 | # Replace multi-part objects by their individual parts, look at local dir only | 68 | # Replace multi-part objects by their individual parts, look at local dir only |
69 | real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y) | 69 | real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y) |
@@ -244,7 +244,7 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -n -f -9 > $@) || \ | |||
244 | # --------------------------------------------------------------------------- | 244 | # --------------------------------------------------------------------------- |
245 | 245 | ||
246 | # Generate an assembly file to wrap the output of the device tree compiler | 246 | # Generate an assembly file to wrap the output of the device tree compiler |
247 | quiet_cmd_dt_S_dtb= DTB $@ | 247 | quiet_cmd_dt_S_dtb= DTB $@ |
248 | cmd_dt_S_dtb= \ | 248 | cmd_dt_S_dtb= \ |
249 | ( \ | 249 | ( \ |
250 | echo '\#include <asm-generic/vmlinux.lds.h>'; \ | 250 | echo '\#include <asm-generic/vmlinux.lds.h>'; \ |
@@ -311,6 +311,11 @@ cmd_lzo = (cat $(filter-out FORCE,$^) | \ | |||
311 | lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ | 311 | lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ |
312 | (rm -f $@ ; false) | 312 | (rm -f $@ ; false) |
313 | 313 | ||
314 | quiet_cmd_lz4 = LZ4 $@ | ||
315 | cmd_lz4 = (cat $(filter-out FORCE,$^) | \ | ||
316 | lz4c -l -c1 stdin stdout && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ | ||
317 | (rm -f $@ ; false) | ||
318 | |||
314 | # U-Boot mkimage | 319 | # U-Boot mkimage |
315 | # --------------------------------------------------------------------------- | 320 | # --------------------------------------------------------------------------- |
316 | 321 | ||
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 6afcd1239ca5..2ee9eb750560 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -6,6 +6,7 @@ | |||
6 | # Licensed under the terms of the GNU GPL License version 2 | 6 | # Licensed under the terms of the GNU GPL License version 2 |
7 | 7 | ||
8 | use strict; | 8 | use strict; |
9 | use POSIX; | ||
9 | 10 | ||
10 | my $P = $0; | 11 | my $P = $0; |
11 | $P =~ s@.*/@@g; | 12 | $P =~ s@.*/@@g; |
@@ -399,37 +400,52 @@ sub seed_camelcase_includes { | |||
399 | return if ($camelcase_seeded); | 400 | return if ($camelcase_seeded); |
400 | 401 | ||
401 | my $files; | 402 | my $files; |
402 | my $camelcase_git_file = ""; | 403 | my $camelcase_cache = ""; |
404 | my @include_files = (); | ||
405 | |||
406 | $camelcase_seeded = 1; | ||
403 | 407 | ||
404 | if (-d ".git") { | 408 | if (-d ".git") { |
405 | my $git_last_include_commit = `git log --no-merges --pretty=format:"%h%n" -1 -- include`; | 409 | my $git_last_include_commit = `git log --no-merges --pretty=format:"%h%n" -1 -- include`; |
406 | chomp $git_last_include_commit; | 410 | chomp $git_last_include_commit; |
407 | $camelcase_git_file = ".checkpatch-camelcase.$git_last_include_commit"; | 411 | $camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit"; |
408 | if (-f $camelcase_git_file) { | ||
409 | open(my $camelcase_file, '<', "$camelcase_git_file") | ||
410 | or warn "$P: Can't read '$camelcase_git_file' $!\n"; | ||
411 | while (<$camelcase_file>) { | ||
412 | chomp; | ||
413 | $camelcase{$_} = 1; | ||
414 | } | ||
415 | close($camelcase_file); | ||
416 | |||
417 | return; | ||
418 | } | ||
419 | $files = `git ls-files include`; | ||
420 | } else { | 412 | } else { |
413 | my $last_mod_date = 0; | ||
421 | $files = `find $root/include -name "*.h"`; | 414 | $files = `find $root/include -name "*.h"`; |
415 | @include_files = split('\n', $files); | ||
416 | foreach my $file (@include_files) { | ||
417 | my $date = POSIX::strftime("%Y%m%d%H%M", | ||
418 | localtime((stat $file)[9])); | ||
419 | $last_mod_date = $date if ($last_mod_date < $date); | ||
420 | } | ||
421 | $camelcase_cache = ".checkpatch-camelcase.date.$last_mod_date"; | ||
422 | } | ||
423 | |||
424 | if ($camelcase_cache ne "" && -f $camelcase_cache) { | ||
425 | open(my $camelcase_file, '<', "$camelcase_cache") | ||
426 | or warn "$P: Can't read '$camelcase_cache' $!\n"; | ||
427 | while (<$camelcase_file>) { | ||
428 | chomp; | ||
429 | $camelcase{$_} = 1; | ||
430 | } | ||
431 | close($camelcase_file); | ||
432 | |||
433 | return; | ||
434 | } | ||
435 | |||
436 | if (-d ".git") { | ||
437 | $files = `git ls-files "include/*.h"`; | ||
438 | @include_files = split('\n', $files); | ||
422 | } | 439 | } |
423 | my @include_files = split('\n', $files); | 440 | |
424 | foreach my $file (@include_files) { | 441 | foreach my $file (@include_files) { |
425 | seed_camelcase_file($file); | 442 | seed_camelcase_file($file); |
426 | } | 443 | } |
427 | $camelcase_seeded = 1; | ||
428 | 444 | ||
429 | if ($camelcase_git_file ne "") { | 445 | if ($camelcase_cache ne "") { |
430 | unlink glob ".checkpatch-camelcase.*"; | 446 | unlink glob ".checkpatch-camelcase.*"; |
431 | open(my $camelcase_file, '>', "$camelcase_git_file") | 447 | open(my $camelcase_file, '>', "$camelcase_cache") |
432 | or warn "$P: Can't write '$camelcase_git_file' $!\n"; | 448 | or warn "$P: Can't write '$camelcase_cache' $!\n"; |
433 | foreach (sort { lc($a) cmp lc($b) } keys(%camelcase)) { | 449 | foreach (sort { lc($a) cmp lc($b) } keys(%camelcase)) { |
434 | print $camelcase_file ("$_\n"); | 450 | print $camelcase_file ("$_\n"); |
435 | } | 451 | } |
diff --git a/scripts/coccicheck b/scripts/coccicheck index 06fcb3333247..bbf901afb606 100755 --- a/scripts/coccicheck +++ b/scripts/coccicheck | |||
@@ -1,17 +1,31 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | # | ||
4 | # This script requires at least spatch | ||
5 | # version 1.0.0-rc11. | ||
6 | # | ||
7 | |||
3 | SPATCH="`which ${SPATCH:=spatch}`" | 8 | SPATCH="`which ${SPATCH:=spatch}`" |
4 | 9 | ||
10 | trap kill_running SIGTERM SIGINT | ||
11 | declare -a SPATCH_PID | ||
12 | |||
5 | # The verbosity may be set by the environmental parameter V= | 13 | # The verbosity may be set by the environmental parameter V= |
6 | # as for example with 'make V=1 coccicheck' | 14 | # as for example with 'make V=1 coccicheck' |
7 | 15 | ||
8 | if [ -n "$V" -a "$V" != "0" ]; then | 16 | if [ -n "$V" -a "$V" != "0" ]; then |
9 | VERBOSE=1 | 17 | VERBOSE="$V" |
10 | else | 18 | else |
11 | VERBOSE=0 | 19 | VERBOSE=0 |
12 | fi | 20 | fi |
13 | 21 | ||
14 | FLAGS="$SPFLAGS -very_quiet" | 22 | if [ -z "$J" ]; then |
23 | NPROC=$(getconf _NPROCESSORS_ONLN) | ||
24 | else | ||
25 | NPROC="$J" | ||
26 | fi | ||
27 | |||
28 | FLAGS="$SPFLAGS --very-quiet" | ||
15 | 29 | ||
16 | # spatch only allows include directories with the syntax "-I include" | 30 | # spatch only allows include directories with the syntax "-I include" |
17 | # while gcc also allows "-Iinclude" and "-include include" | 31 | # while gcc also allows "-Iinclude" and "-include include" |
@@ -27,14 +41,14 @@ if [ "$C" = "1" -o "$C" = "2" ]; then | |||
27 | else | 41 | else |
28 | ONLINE=0 | 42 | ONLINE=0 |
29 | if [ "$KBUILD_EXTMOD" = "" ] ; then | 43 | if [ "$KBUILD_EXTMOD" = "" ] ; then |
30 | OPTIONS="-dir $srctree $COCCIINCLUDE" | 44 | OPTIONS="--dir $srctree $COCCIINCLUDE" |
31 | else | 45 | else |
32 | OPTIONS="-dir $KBUILD_EXTMOD $COCCIINCLUDE" | 46 | OPTIONS="--dir $KBUILD_EXTMOD $COCCIINCLUDE" |
33 | fi | 47 | fi |
34 | fi | 48 | fi |
35 | 49 | ||
36 | if [ "$KBUILD_EXTMOD" != "" ] ; then | 50 | if [ "$KBUILD_EXTMOD" != "" ] ; then |
37 | OPTIONS="-patch $srctree $OPTIONS" | 51 | OPTIONS="--patch $srctree $OPTIONS" |
38 | fi | 52 | fi |
39 | 53 | ||
40 | if [ ! -x "$SPATCH" ]; then | 54 | if [ ! -x "$SPATCH" ]; then |
@@ -44,13 +58,21 @@ fi | |||
44 | 58 | ||
45 | if [ "$MODE" = "" ] ; then | 59 | if [ "$MODE" = "" ] ; then |
46 | if [ "$ONLINE" = "0" ] ; then | 60 | if [ "$ONLINE" = "0" ] ; then |
47 | echo 'You have not explicitly specified the mode to use. Using default "chain" mode.' | 61 | echo 'You have not explicitly specified the mode to use. Using default "report" mode.' |
48 | echo 'All available modes will be tried (in that order): patch, report, context, org' | 62 | echo 'Available modes are the following: patch, report, context, org' |
49 | echo 'You can specify the mode with "make coccicheck MODE=<mode>"' | 63 | echo 'You can specify the mode with "make coccicheck MODE=<mode>"' |
64 | echo 'Note however that some modes are not implemented by some semantic patches.' | ||
65 | fi | ||
66 | MODE="report" | ||
67 | fi | ||
68 | |||
69 | if [ "$MODE" = "chain" ] ; then | ||
70 | if [ "$ONLINE" = "0" ] ; then | ||
71 | echo 'You have selected the "chain" mode.' | ||
72 | echo 'All available modes will be tried (in that order): patch, report, context, org' | ||
50 | fi | 73 | fi |
51 | MODE="chain" | ||
52 | elif [ "$MODE" = "report" -o "$MODE" = "org" ] ; then | 74 | elif [ "$MODE" = "report" -o "$MODE" = "org" ] ; then |
53 | FLAGS="$FLAGS -no_show_diff" | 75 | FLAGS="$FLAGS --no-show-diff" |
54 | fi | 76 | fi |
55 | 77 | ||
56 | if [ "$ONLINE" = "0" ] ; then | 78 | if [ "$ONLINE" = "0" ] ; then |
@@ -61,19 +83,35 @@ if [ "$ONLINE" = "0" ] ; then | |||
61 | fi | 83 | fi |
62 | 84 | ||
63 | run_cmd() { | 85 | run_cmd() { |
86 | local i | ||
64 | if [ $VERBOSE -ne 0 ] ; then | 87 | if [ $VERBOSE -ne 0 ] ; then |
65 | echo "Running: $@" | 88 | echo "Running ($NPROC in parallel): $@" |
66 | fi | 89 | fi |
67 | eval $@ | 90 | for i in $(seq 0 $(( NPROC - 1)) ); do |
91 | eval "$@ --max $NPROC --index $i &" | ||
92 | SPATCH_PID[$i]=$! | ||
93 | if [ $VERBOSE -eq 2 ] ; then | ||
94 | echo "${SPATCH_PID[$i]} running" | ||
95 | fi | ||
96 | done | ||
97 | wait | ||
68 | } | 98 | } |
69 | 99 | ||
100 | kill_running() { | ||
101 | for i in $(seq $(( NPROC - 1 )) ); do | ||
102 | if [ $VERBOSE -eq 2 ] ; then | ||
103 | echo "Killing ${SPATCH_PID[$i]}" | ||
104 | fi | ||
105 | kill ${SPATCH_PID[$i]} 2>/dev/null | ||
106 | done | ||
107 | } | ||
70 | 108 | ||
71 | coccinelle () { | 109 | coccinelle () { |
72 | COCCI="$1" | 110 | COCCI="$1" |
73 | 111 | ||
74 | OPT=`grep "Option" $COCCI | cut -d':' -f2` | 112 | OPT=`grep "Option" $COCCI | cut -d':' -f2` |
75 | 113 | ||
76 | # The option '-parse_cocci' can be used to syntactically check the SmPL files. | 114 | # The option '--parse-cocci' can be used to syntactically check the SmPL files. |
77 | # | 115 | # |
78 | # $SPATCH -D $MODE $FLAGS -parse_cocci $COCCI $OPT > /dev/null | 116 | # $SPATCH -D $MODE $FLAGS -parse_cocci $COCCI $OPT > /dev/null |
79 | 117 | ||
@@ -114,20 +152,20 @@ coccinelle () { | |||
114 | 152 | ||
115 | if [ "$MODE" = "chain" ] ; then | 153 | if [ "$MODE" = "chain" ] ; then |
116 | run_cmd $SPATCH -D patch \ | 154 | run_cmd $SPATCH -D patch \ |
117 | $FLAGS -sp_file $COCCI $OPT $OPTIONS || \ | 155 | $FLAGS --cocci-file $COCCI $OPT $OPTIONS || \ |
118 | run_cmd $SPATCH -D report \ | 156 | run_cmd $SPATCH -D report \ |
119 | $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || \ | 157 | $FLAGS --cocci-file $COCCI $OPT $OPTIONS --no-show-diff || \ |
120 | run_cmd $SPATCH -D context \ | 158 | run_cmd $SPATCH -D context \ |
121 | $FLAGS -sp_file $COCCI $OPT $OPTIONS || \ | 159 | $FLAGS --cocci-file $COCCI $OPT $OPTIONS || \ |
122 | run_cmd $SPATCH -D org \ | 160 | run_cmd $SPATCH -D org \ |
123 | $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || exit 1 | 161 | $FLAGS --cocci-file $COCCI $OPT $OPTIONS --no-show-diff || exit 1 |
124 | elif [ "$MODE" = "rep+ctxt" ] ; then | 162 | elif [ "$MODE" = "rep+ctxt" ] ; then |
125 | run_cmd $SPATCH -D report \ | 163 | run_cmd $SPATCH -D report \ |
126 | $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff && \ | 164 | $FLAGS --cocci-file $COCCI $OPT $OPTIONS --no-show-diff && \ |
127 | run_cmd $SPATCH -D context \ | 165 | run_cmd $SPATCH -D context \ |
128 | $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 | 166 | $FLAGS --cocci-file $COCCI $OPT $OPTIONS || exit 1 |
129 | else | 167 | else |
130 | run_cmd $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 | 168 | run_cmd $SPATCH -D $MODE $FLAGS --cocci-file $COCCI $OPT $OPTIONS || exit 1 |
131 | fi | 169 | fi |
132 | 170 | ||
133 | } | 171 | } |
diff --git a/scripts/coccinelle/api/alloc/drop_kmalloc_cast.cocci b/scripts/coccinelle/api/alloc/drop_kmalloc_cast.cocci index 7d4771d449c3..bd5d08b882ee 100644 --- a/scripts/coccinelle/api/alloc/drop_kmalloc_cast.cocci +++ b/scripts/coccinelle/api/alloc/drop_kmalloc_cast.cocci | |||
@@ -5,7 +5,7 @@ | |||
5 | // Confidence: High | 5 | // Confidence: High |
6 | // Copyright: 2009,2010 Nicolas Palix, DIKU. GPLv2. | 6 | // Copyright: 2009,2010 Nicolas Palix, DIKU. GPLv2. |
7 | // URL: http://coccinelle.lip6.fr/ | 7 | // URL: http://coccinelle.lip6.fr/ |
8 | // Options: -no_includes -include_headers | 8 | // Options: --no-includes --include-headers |
9 | // | 9 | // |
10 | // Keywords: kmalloc, kzalloc, kcalloc | 10 | // Keywords: kmalloc, kzalloc, kcalloc |
11 | // Version min: < 2.6.12 kmalloc | 11 | // Version min: < 2.6.12 kmalloc |
diff --git a/scripts/coccinelle/api/alloc/kzalloc-simple.cocci b/scripts/coccinelle/api/alloc/kzalloc-simple.cocci index 046b9b16f8f9..52c55e4fa67d 100644 --- a/scripts/coccinelle/api/alloc/kzalloc-simple.cocci +++ b/scripts/coccinelle/api/alloc/kzalloc-simple.cocci | |||
@@ -9,7 +9,7 @@ | |||
9 | // Copyright: (C) 2009-2010 Julia Lawall, Nicolas Palix, DIKU. GPLv2. | 9 | // Copyright: (C) 2009-2010 Julia Lawall, Nicolas Palix, DIKU. GPLv2. |
10 | // Copyright: (C) 2009-2010 Gilles Muller, INRIA/LiP6. GPLv2. | 10 | // Copyright: (C) 2009-2010 Gilles Muller, INRIA/LiP6. GPLv2. |
11 | // URL: http://coccinelle.lip6.fr/rules/kzalloc.html | 11 | // URL: http://coccinelle.lip6.fr/rules/kzalloc.html |
12 | // Options: -no_includes -include_headers | 12 | // Options: --no-includes --include-headers |
13 | // | 13 | // |
14 | // Keywords: kmalloc, kzalloc | 14 | // Keywords: kmalloc, kzalloc |
15 | // Version min: < 2.6.12 kmalloc | 15 | // Version min: < 2.6.12 kmalloc |
diff --git a/scripts/coccinelle/api/d_find_alias.cocci b/scripts/coccinelle/api/d_find_alias.cocci index a9694a8d3e5a..9594c9f7eb8d 100644 --- a/scripts/coccinelle/api/d_find_alias.cocci +++ b/scripts/coccinelle/api/d_find_alias.cocci | |||
@@ -4,7 +4,7 @@ | |||
4 | // | 4 | // |
5 | // Confidence: Moderate | 5 | // Confidence: Moderate |
6 | // URL: http://coccinelle.lip6.fr/ | 6 | // URL: http://coccinelle.lip6.fr/ |
7 | // Options: -include_headers | 7 | // Options: --include-headers |
8 | 8 | ||
9 | virtual context | 9 | virtual context |
10 | virtual org | 10 | virtual org |
diff --git a/scripts/coccinelle/api/devm_request_and_ioremap.cocci b/scripts/coccinelle/api/devm_request_and_ioremap.cocci index 46beb81406ab..562ec88b6352 100644 --- a/scripts/coccinelle/api/devm_request_and_ioremap.cocci +++ b/scripts/coccinelle/api/devm_request_and_ioremap.cocci | |||
@@ -10,7 +10,7 @@ | |||
10 | // Copyright: (C) 2011 Gilles Muller, INRIA/LiP6. GPLv2. | 10 | // Copyright: (C) 2011 Gilles Muller, INRIA/LiP6. GPLv2. |
11 | // URL: http://coccinelle.lip6.fr/ | 11 | // URL: http://coccinelle.lip6.fr/ |
12 | // Comments: | 12 | // Comments: |
13 | // Options: -no_includes -include_headers | 13 | // Options: --no-includes --include-headers |
14 | 14 | ||
15 | virtual patch | 15 | virtual patch |
16 | virtual org | 16 | virtual org |
diff --git a/scripts/coccinelle/api/kstrdup.cocci b/scripts/coccinelle/api/kstrdup.cocci index 07a74b2c6196..09cba54ed0cf 100644 --- a/scripts/coccinelle/api/kstrdup.cocci +++ b/scripts/coccinelle/api/kstrdup.cocci | |||
@@ -6,7 +6,7 @@ | |||
6 | // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. | 6 | // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. |
7 | // URL: http://coccinelle.lip6.fr/ | 7 | // URL: http://coccinelle.lip6.fr/ |
8 | // Comments: | 8 | // Comments: |
9 | // Options: -no_includes -include_headers | 9 | // Options: --no-includes --include-headers |
10 | 10 | ||
11 | virtual patch | 11 | virtual patch |
12 | virtual context | 12 | virtual context |
diff --git a/scripts/coccinelle/api/memdup.cocci b/scripts/coccinelle/api/memdup.cocci index 4dceab6d54de..3d1aa71b7579 100644 --- a/scripts/coccinelle/api/memdup.cocci +++ b/scripts/coccinelle/api/memdup.cocci | |||
@@ -6,7 +6,7 @@ | |||
6 | // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. | 6 | // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. |
7 | // URL: http://coccinelle.lip6.fr/ | 7 | // URL: http://coccinelle.lip6.fr/ |
8 | // Comments: | 8 | // Comments: |
9 | // Options: -no_includes -include_headers | 9 | // Options: --no-includes --include-headers |
10 | 10 | ||
11 | virtual patch | 11 | virtual patch |
12 | virtual context | 12 | virtual context |
diff --git a/scripts/coccinelle/api/memdup_user.cocci b/scripts/coccinelle/api/memdup_user.cocci index 2b131a8a1306..c606231b0e46 100644 --- a/scripts/coccinelle/api/memdup_user.cocci +++ b/scripts/coccinelle/api/memdup_user.cocci | |||
@@ -7,7 +7,7 @@ | |||
7 | // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. | 7 | // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. |
8 | // URL: http://coccinelle.lip6.fr/ | 8 | // URL: http://coccinelle.lip6.fr/ |
9 | // Comments: | 9 | // Comments: |
10 | // Options: -no_includes -include_headers | 10 | // Options: --no-includes --include-headers |
11 | 11 | ||
12 | virtual patch | 12 | virtual patch |
13 | virtual context | 13 | virtual context |
diff --git a/scripts/coccinelle/api/ptr_ret.cocci b/scripts/coccinelle/api/ptr_ret.cocci index 15f076fdecbe..2274638d005b 100644 --- a/scripts/coccinelle/api/ptr_ret.cocci +++ b/scripts/coccinelle/api/ptr_ret.cocci | |||
@@ -5,7 +5,7 @@ | |||
5 | // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. | 5 | // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. |
6 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. | 6 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. |
7 | // URL: http://coccinelle.lip6.fr/ | 7 | // URL: http://coccinelle.lip6.fr/ |
8 | // Options: -no_includes -include_headers | 8 | // Options: --no-includes --include-headers |
9 | // | 9 | // |
10 | // Keywords: ERR_PTR, PTR_ERR, PTR_RET | 10 | // Keywords: ERR_PTR, PTR_ERR, PTR_RET |
11 | // Version min: 2.6.39 | 11 | // Version min: 2.6.39 |
diff --git a/scripts/coccinelle/api/simple_open.cocci b/scripts/coccinelle/api/simple_open.cocci index 05962f7be155..b67e174f3d95 100644 --- a/scripts/coccinelle/api/simple_open.cocci +++ b/scripts/coccinelle/api/simple_open.cocci | |||
@@ -4,7 +4,7 @@ | |||
4 | /// | 4 | /// |
5 | // Confidence: High | 5 | // Confidence: High |
6 | // Comments: | 6 | // Comments: |
7 | // Options: -no_includes -include_headers | 7 | // Options: --no-includes --include-headers |
8 | 8 | ||
9 | virtual patch | 9 | virtual patch |
10 | virtual report | 10 | virtual report |
diff --git a/scripts/coccinelle/free/devm_free.cocci b/scripts/coccinelle/free/devm_free.cocci index 0a1e36146d76..3d9349012bb3 100644 --- a/scripts/coccinelle/free/devm_free.cocci +++ b/scripts/coccinelle/free/devm_free.cocci | |||
@@ -18,7 +18,7 @@ | |||
18 | // Copyright: (C) 2011 Gilles Muller, INRIA/LiP6. GPLv2. | 18 | // Copyright: (C) 2011 Gilles Muller, INRIA/LiP6. GPLv2. |
19 | // URL: http://coccinelle.lip6.fr/ | 19 | // URL: http://coccinelle.lip6.fr/ |
20 | // Comments: | 20 | // Comments: |
21 | // Options: -no_includes -include_headers | 21 | // Options: --no-includes --include-headers |
22 | 22 | ||
23 | virtual org | 23 | virtual org |
24 | virtual report | 24 | virtual report |
diff --git a/scripts/coccinelle/free/kfree.cocci b/scripts/coccinelle/free/kfree.cocci index d9ae6d89c2f5..577b78056990 100644 --- a/scripts/coccinelle/free/kfree.cocci +++ b/scripts/coccinelle/free/kfree.cocci | |||
@@ -10,7 +10,7 @@ | |||
10 | // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. | 10 | // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. |
11 | // URL: http://coccinelle.lip6.fr/ | 11 | // URL: http://coccinelle.lip6.fr/ |
12 | // Comments: | 12 | // Comments: |
13 | // Options: -no_includes -include_headers | 13 | // Options: --no-includes --include-headers |
14 | 14 | ||
15 | virtual org | 15 | virtual org |
16 | virtual report | 16 | virtual report |
diff --git a/scripts/coccinelle/free/kfreeaddr.cocci b/scripts/coccinelle/free/kfreeaddr.cocci new file mode 100644 index 000000000000..ce8aacc314cb --- /dev/null +++ b/scripts/coccinelle/free/kfreeaddr.cocci | |||
@@ -0,0 +1,32 @@ | |||
1 | /// Free of a structure field | ||
2 | /// | ||
3 | // Confidence: High | ||
4 | // Copyright: (C) 2013 Julia Lawall, INRIA/LIP6. GPLv2. | ||
5 | // URL: http://coccinelle.lip6.fr/ | ||
6 | // Comments: | ||
7 | // Options: --no-includes --include-headers | ||
8 | |||
9 | virtual org | ||
10 | virtual report | ||
11 | virtual context | ||
12 | |||
13 | @r depends on context || report || org @ | ||
14 | expression e; | ||
15 | identifier f; | ||
16 | position p; | ||
17 | @@ | ||
18 | |||
19 | * kfree@p(&e->f) | ||
20 | |||
21 | @script:python depends on org@ | ||
22 | p << r.p; | ||
23 | @@ | ||
24 | |||
25 | cocci.print_main("kfree",p) | ||
26 | |||
27 | @script:python depends on report@ | ||
28 | p << r.p; | ||
29 | @@ | ||
30 | |||
31 | msg = "ERROR: kfree of structure field" | ||
32 | coccilib.report.print_report(p[0],msg) | ||
diff --git a/scripts/coccinelle/free/pci_free_consistent.cocci b/scripts/coccinelle/free/pci_free_consistent.cocci new file mode 100644 index 000000000000..43600ccb62a8 --- /dev/null +++ b/scripts/coccinelle/free/pci_free_consistent.cocci | |||
@@ -0,0 +1,52 @@ | |||
1 | /// Find missing pci_free_consistent for every pci_alloc_consistent. | ||
2 | /// | ||
3 | // Confidence: Moderate | ||
4 | // Copyright: (C) 2013 Petr Strnad. GPLv2. | ||
5 | // URL: http://coccinelle.lip6.fr/ | ||
6 | // Keywords: pci_free_consistent, pci_alloc_consistent | ||
7 | // Options: --no-includes --include-headers | ||
8 | |||
9 | virtual report | ||
10 | virtual org | ||
11 | |||
12 | @search@ | ||
13 | local idexpression id; | ||
14 | expression x,y,z,e; | ||
15 | position p1,p2; | ||
16 | type T; | ||
17 | @@ | ||
18 | |||
19 | id = pci_alloc_consistent@p1(x,y,&z) | ||
20 | ... when != e = id | ||
21 | if (id == NULL || ...) { ... return ...; } | ||
22 | ... when != pci_free_consistent(x,y,id,z) | ||
23 | when != if (id) { ... pci_free_consistent(x,y,id,z) ... } | ||
24 | when != if (y) { ... pci_free_consistent(x,y,id,z) ... } | ||
25 | when != e = (T)id | ||
26 | when exists | ||
27 | ( | ||
28 | return 0; | ||
29 | | | ||
30 | return 1; | ||
31 | | | ||
32 | return id; | ||
33 | | | ||
34 | return@p2 ...; | ||
35 | ) | ||
36 | |||
37 | @script:python depends on report@ | ||
38 | p1 << search.p1; | ||
39 | p2 << search.p2; | ||
40 | @@ | ||
41 | |||
42 | msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line) | ||
43 | coccilib.report.print_report(p2[0],msg) | ||
44 | |||
45 | @script:python depends on org@ | ||
46 | p1 << search.p1; | ||
47 | p2 << search.p2; | ||
48 | @@ | ||
49 | |||
50 | msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line) | ||
51 | cocci.print_main(msg,p1) | ||
52 | cocci.print_secs("",p2) | ||
diff --git a/scripts/coccinelle/iterators/fen.cocci b/scripts/coccinelle/iterators/fen.cocci index 0a40af828c43..48c152f224e1 100644 --- a/scripts/coccinelle/iterators/fen.cocci +++ b/scripts/coccinelle/iterators/fen.cocci | |||
@@ -7,7 +7,7 @@ | |||
7 | // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. | 7 | // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. |
8 | // URL: http://coccinelle.lip6.fr/ | 8 | // URL: http://coccinelle.lip6.fr/ |
9 | // Comments: | 9 | // Comments: |
10 | // Options: -no_includes -include_headers | 10 | // Options: --no-includes --include-headers |
11 | 11 | ||
12 | virtual patch | 12 | virtual patch |
13 | virtual context | 13 | virtual context |
diff --git a/scripts/coccinelle/iterators/itnull.cocci b/scripts/coccinelle/iterators/itnull.cocci index 259899f6838e..f58732b56a40 100644 --- a/scripts/coccinelle/iterators/itnull.cocci +++ b/scripts/coccinelle/iterators/itnull.cocci | |||
@@ -11,7 +11,7 @@ | |||
11 | // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. | 11 | // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. |
12 | // URL: http://coccinelle.lip6.fr/ | 12 | // URL: http://coccinelle.lip6.fr/ |
13 | // Comments: | 13 | // Comments: |
14 | // Options: -no_includes -include_headers | 14 | // Options: --no-includes --include-headers |
15 | 15 | ||
16 | virtual patch | 16 | virtual patch |
17 | virtual context | 17 | virtual context |
diff --git a/scripts/coccinelle/iterators/list_entry_update.cocci b/scripts/coccinelle/iterators/list_entry_update.cocci index b2967475679b..873f444e7137 100644 --- a/scripts/coccinelle/iterators/list_entry_update.cocci +++ b/scripts/coccinelle/iterators/list_entry_update.cocci | |||
@@ -9,7 +9,7 @@ | |||
9 | // Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. | 9 | // Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. |
10 | // URL: http://coccinelle.lip6.fr/ | 10 | // URL: http://coccinelle.lip6.fr/ |
11 | // Comments: | 11 | // Comments: |
12 | // Options: -no_includes -include_headers | 12 | // Options: --no-includes --include-headers |
13 | 13 | ||
14 | virtual context | 14 | virtual context |
15 | virtual org | 15 | virtual org |
diff --git a/scripts/coccinelle/iterators/use_after_iter.cocci b/scripts/coccinelle/iterators/use_after_iter.cocci index 06284c57a951..f085f5968c52 100644 --- a/scripts/coccinelle/iterators/use_after_iter.cocci +++ b/scripts/coccinelle/iterators/use_after_iter.cocci | |||
@@ -11,7 +11,7 @@ | |||
11 | // Copyright: (C) 2012 Gilles Muller, INRIA/LIP6. GPLv2. | 11 | // Copyright: (C) 2012 Gilles Muller, INRIA/LIP6. GPLv2. |
12 | // URL: http://coccinelle.lip6.fr/ | 12 | // URL: http://coccinelle.lip6.fr/ |
13 | // Comments: | 13 | // Comments: |
14 | // Options: -no_includes -include_headers | 14 | // Options: --no-includes --include-headers |
15 | 15 | ||
16 | virtual context | 16 | virtual context |
17 | virtual org | 17 | virtual org |
diff --git a/scripts/coccinelle/locks/call_kern.cocci b/scripts/coccinelle/locks/call_kern.cocci index 8f10b49603c3..669b24436248 100644 --- a/scripts/coccinelle/locks/call_kern.cocci +++ b/scripts/coccinelle/locks/call_kern.cocci | |||
@@ -9,7 +9,7 @@ | |||
9 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. | 9 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. |
10 | // URL: http://coccinelle.lip6.fr/ | 10 | // URL: http://coccinelle.lip6.fr/ |
11 | // Comments: | 11 | // Comments: |
12 | // Options: -no_includes -include_headers | 12 | // Options: --no-includes --include-headers |
13 | 13 | ||
14 | virtual patch | 14 | virtual patch |
15 | virtual context | 15 | virtual context |
diff --git a/scripts/coccinelle/locks/double_lock.cocci b/scripts/coccinelle/locks/double_lock.cocci index 63b24e682fad..002752f97dca 100644 --- a/scripts/coccinelle/locks/double_lock.cocci +++ b/scripts/coccinelle/locks/double_lock.cocci | |||
@@ -8,7 +8,7 @@ | |||
8 | // Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. | 8 | // Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. |
9 | // URL: http://coccinelle.lip6.fr/ | 9 | // URL: http://coccinelle.lip6.fr/ |
10 | // Comments: | 10 | // Comments: |
11 | // Options: -no_includes -include_headers | 11 | // Options: --no-includes --include-headers |
12 | 12 | ||
13 | virtual org | 13 | virtual org |
14 | virtual report | 14 | virtual report |
diff --git a/scripts/coccinelle/locks/flags.cocci b/scripts/coccinelle/locks/flags.cocci index 1c4ffe6fd846..debd70e46267 100644 --- a/scripts/coccinelle/locks/flags.cocci +++ b/scripts/coccinelle/locks/flags.cocci | |||
@@ -6,7 +6,7 @@ | |||
6 | // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. | 6 | // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. |
7 | // URL: http://coccinelle.lip6.fr/ | 7 | // URL: http://coccinelle.lip6.fr/ |
8 | // Comments: | 8 | // Comments: |
9 | // Options: -no_includes -include_headers | 9 | // Options: --no-includes --include-headers |
10 | 10 | ||
11 | virtual context | 11 | virtual context |
12 | virtual org | 12 | virtual org |
diff --git a/scripts/coccinelle/locks/mini_lock.cocci b/scripts/coccinelle/locks/mini_lock.cocci index 3267d7410bd5..47f649b0ea87 100644 --- a/scripts/coccinelle/locks/mini_lock.cocci +++ b/scripts/coccinelle/locks/mini_lock.cocci | |||
@@ -11,7 +11,7 @@ | |||
11 | // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. | 11 | // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. |
12 | // URL: http://coccinelle.lip6.fr/ | 12 | // URL: http://coccinelle.lip6.fr/ |
13 | // Comments: | 13 | // Comments: |
14 | // Options: -no_includes -include_headers | 14 | // Options: --no-includes --include-headers |
15 | 15 | ||
16 | virtual context | 16 | virtual context |
17 | virtual org | 17 | virtual org |
diff --git a/scripts/coccinelle/misc/boolinit.cocci b/scripts/coccinelle/misc/boolinit.cocci index 97ce41ce8135..b9abed49cd95 100644 --- a/scripts/coccinelle/misc/boolinit.cocci +++ b/scripts/coccinelle/misc/boolinit.cocci | |||
@@ -6,7 +6,7 @@ | |||
6 | // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. | 6 | // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. |
7 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. | 7 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. |
8 | // URL: http://coccinelle.lip6.fr/ | 8 | // URL: http://coccinelle.lip6.fr/ |
9 | // Options: -include_headers | 9 | // Options: --include-headers |
10 | 10 | ||
11 | virtual patch | 11 | virtual patch |
12 | virtual context | 12 | virtual context |
diff --git a/scripts/coccinelle/misc/cstptr.cocci b/scripts/coccinelle/misc/cstptr.cocci index d42564484528..f0368b3d4563 100644 --- a/scripts/coccinelle/misc/cstptr.cocci +++ b/scripts/coccinelle/misc/cstptr.cocci | |||
@@ -6,7 +6,7 @@ | |||
6 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. | 6 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. |
7 | // URL: http://coccinelle.lip6.fr/ | 7 | // URL: http://coccinelle.lip6.fr/ |
8 | // Comments: | 8 | // Comments: |
9 | // Options: -no_includes -include_headers | 9 | // Options: --no-includes --include-headers |
10 | 10 | ||
11 | virtual org | 11 | virtual org |
12 | virtual report | 12 | virtual report |
diff --git a/scripts/coccinelle/misc/doubleinit.cocci b/scripts/coccinelle/misc/doubleinit.cocci index cf74a00cf597..c0c3371d25e0 100644 --- a/scripts/coccinelle/misc/doubleinit.cocci +++ b/scripts/coccinelle/misc/doubleinit.cocci | |||
@@ -8,7 +8,7 @@ | |||
8 | // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. | 8 | // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. |
9 | // URL: http://coccinelle.lip6.fr/ | 9 | // URL: http://coccinelle.lip6.fr/ |
10 | // Comments: requires at least Coccinelle 0.2.4, lex or parse error otherwise | 10 | // Comments: requires at least Coccinelle 0.2.4, lex or parse error otherwise |
11 | // Options: -no_includes -include_headers | 11 | // Options: --no-includes --include-headers |
12 | 12 | ||
13 | virtual org | 13 | virtual org |
14 | virtual report | 14 | virtual report |
diff --git a/scripts/coccinelle/misc/ifaddr.cocci b/scripts/coccinelle/misc/ifaddr.cocci index 3e4089a77000..8aebd1875e75 100644 --- a/scripts/coccinelle/misc/ifaddr.cocci +++ b/scripts/coccinelle/misc/ifaddr.cocci | |||
@@ -6,7 +6,7 @@ | |||
6 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. | 6 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. |
7 | // URL: http://coccinelle.lip6.fr/ | 7 | // URL: http://coccinelle.lip6.fr/ |
8 | // Comments: | 8 | // Comments: |
9 | // Options: -no_includes -include_headers | 9 | // Options: --no-includes --include-headers |
10 | 10 | ||
11 | virtual org | 11 | virtual org |
12 | virtual report | 12 | virtual report |
diff --git a/scripts/coccinelle/misc/ifcol.cocci b/scripts/coccinelle/misc/ifcol.cocci index b7ed91dbeb95..d0d00ef1f12a 100644 --- a/scripts/coccinelle/misc/ifcol.cocci +++ b/scripts/coccinelle/misc/ifcol.cocci | |||
@@ -13,7 +13,7 @@ | |||
13 | // Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. | 13 | // Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. |
14 | // URL: http://coccinelle.lip6.fr/ | 14 | // URL: http://coccinelle.lip6.fr/ |
15 | // Comments: | 15 | // Comments: |
16 | // Options: -no_includes -include_headers | 16 | // Options: --no-includes --include-headers |
17 | 17 | ||
18 | virtual org | 18 | virtual org |
19 | virtual report | 19 | virtual report |
diff --git a/scripts/coccinelle/misc/noderef.cocci b/scripts/coccinelle/misc/noderef.cocci index c1707214e602..80a831c91161 100644 --- a/scripts/coccinelle/misc/noderef.cocci +++ b/scripts/coccinelle/misc/noderef.cocci | |||
@@ -6,7 +6,7 @@ | |||
6 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. | 6 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. |
7 | // URL: http://coccinelle.lip6.fr/ | 7 | // URL: http://coccinelle.lip6.fr/ |
8 | // Comments: | 8 | // Comments: |
9 | // Options: -no_includes -include_headers | 9 | // Options: --no-includes --include-headers |
10 | 10 | ||
11 | virtual org | 11 | virtual org |
12 | virtual report | 12 | virtual report |
diff --git a/scripts/coccinelle/misc/orplus.cocci b/scripts/coccinelle/misc/orplus.cocci index 4a28cef1484e..81fabf379390 100644 --- a/scripts/coccinelle/misc/orplus.cocci +++ b/scripts/coccinelle/misc/orplus.cocci | |||
@@ -7,7 +7,7 @@ | |||
7 | // Copyright: (C) 2013 Gilles Muller, INRIA/LIP6. GPLv2. | 7 | // Copyright: (C) 2013 Gilles Muller, INRIA/LIP6. GPLv2. |
8 | // URL: http://coccinelle.lip6.fr/ | 8 | // URL: http://coccinelle.lip6.fr/ |
9 | // Comments: | 9 | // Comments: |
10 | // Options: -no_includes -include_headers | 10 | // Options: --no-includes --include-headers |
11 | 11 | ||
12 | virtual org | 12 | virtual org |
13 | virtual report | 13 | virtual report |
diff --git a/scripts/coccinelle/misc/warn.cocci b/scripts/coccinelle/misc/warn.cocci index fda8c3558e4f..d2e5b6cedb84 100644 --- a/scripts/coccinelle/misc/warn.cocci +++ b/scripts/coccinelle/misc/warn.cocci | |||
@@ -5,7 +5,7 @@ | |||
5 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. | 5 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. |
6 | // URL: http://coccinelle.lip6.fr/ | 6 | // URL: http://coccinelle.lip6.fr/ |
7 | // Comments: | 7 | // Comments: |
8 | // Options: -no_includes -include_headers | 8 | // Options: --no-includes --include-headers |
9 | 9 | ||
10 | virtual patch | 10 | virtual patch |
11 | virtual context | 11 | virtual context |
diff --git a/scripts/coccinelle/null/eno.cocci b/scripts/coccinelle/null/eno.cocci index ed961a1f7d11..9bd29aa83399 100644 --- a/scripts/coccinelle/null/eno.cocci +++ b/scripts/coccinelle/null/eno.cocci | |||
@@ -6,7 +6,7 @@ | |||
6 | // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. | 6 | // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. |
7 | // URL: http://coccinelle.lip6.fr/ | 7 | // URL: http://coccinelle.lip6.fr/ |
8 | // Comments: | 8 | // Comments: |
9 | // Options: -no_includes -include_headers | 9 | // Options: --no-includes --include-headers |
10 | 10 | ||
11 | virtual patch | 11 | virtual patch |
12 | virtual context | 12 | virtual context |
diff --git a/scripts/coccinelle/null/kmerr.cocci b/scripts/coccinelle/null/kmerr.cocci index 949bf656c64c..5354a7903ccb 100644 --- a/scripts/coccinelle/null/kmerr.cocci +++ b/scripts/coccinelle/null/kmerr.cocci | |||
@@ -10,7 +10,7 @@ | |||
10 | // Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. | 10 | // Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. |
11 | // URL: http://coccinelle.lip6.fr/ | 11 | // URL: http://coccinelle.lip6.fr/ |
12 | // Comments: | 12 | // Comments: |
13 | // Options: -no_includes -include_headers | 13 | // Options: --no-includes --include-headers |
14 | 14 | ||
15 | virtual context | 15 | virtual context |
16 | virtual org | 16 | virtual org |
diff --git a/scripts/coccinelle/tests/doublebitand.cocci b/scripts/coccinelle/tests/doublebitand.cocci index 9ba73d05a77e..72f1572aaec3 100644 --- a/scripts/coccinelle/tests/doublebitand.cocci +++ b/scripts/coccinelle/tests/doublebitand.cocci | |||
@@ -10,7 +10,7 @@ | |||
10 | // Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. | 10 | // Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. |
11 | // URL: http://coccinelle.lip6.fr/ | 11 | // URL: http://coccinelle.lip6.fr/ |
12 | // Comments: | 12 | // Comments: |
13 | // Options: -no_includes -include_headers | 13 | // Options: --no-includes --include-headers |
14 | 14 | ||
15 | virtual context | 15 | virtual context |
16 | virtual org | 16 | virtual org |
diff --git a/scripts/coccinelle/tests/doubletest.cocci b/scripts/coccinelle/tests/doubletest.cocci index 13a2c0e8a4bf..78d74c22ca12 100644 --- a/scripts/coccinelle/tests/doubletest.cocci +++ b/scripts/coccinelle/tests/doubletest.cocci | |||
@@ -8,7 +8,7 @@ | |||
8 | // Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. | 8 | // Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. |
9 | // URL: http://coccinelle.lip6.fr/ | 9 | // URL: http://coccinelle.lip6.fr/ |
10 | // Comments: | 10 | // Comments: |
11 | // Options: -no_includes -include_headers | 11 | // Options: --no-includes --include-headers |
12 | 12 | ||
13 | virtual context | 13 | virtual context |
14 | virtual org | 14 | virtual org |
diff --git a/scripts/coccinelle/tests/odd_ptr_err.cocci b/scripts/coccinelle/tests/odd_ptr_err.cocci index e8dd8a6b28a2..cfe0a35cf2dd 100644 --- a/scripts/coccinelle/tests/odd_ptr_err.cocci +++ b/scripts/coccinelle/tests/odd_ptr_err.cocci | |||
@@ -7,7 +7,7 @@ | |||
7 | // Copyright: (C) 2012 Gilles Muller, INRIA. GPLv2. | 7 | // Copyright: (C) 2012 Gilles Muller, INRIA. GPLv2. |
8 | // URL: http://coccinelle.lip6.fr/ | 8 | // URL: http://coccinelle.lip6.fr/ |
9 | // Comments: | 9 | // Comments: |
10 | // Options: -no_includes -include_headers | 10 | // Options: --no-includes --include-headers |
11 | 11 | ||
12 | virtual patch | 12 | virtual patch |
13 | virtual context | 13 | virtual context |
diff --git a/scripts/config b/scripts/config index a65ecbbdd32a..567120a87c39 100755 --- a/scripts/config +++ b/scripts/config | |||
@@ -1,6 +1,8 @@ | |||
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 | myname=${0##*/} | ||
5 | |||
4 | # If no prefix forced, use the default CONFIG_ | 6 | # If no prefix forced, use the default CONFIG_ |
5 | CONFIG_="${CONFIG_-CONFIG_}" | 7 | CONFIG_="${CONFIG_-CONFIG_}" |
6 | 8 | ||
@@ -8,7 +10,7 @@ usage() { | |||
8 | cat >&2 <<EOL | 10 | cat >&2 <<EOL |
9 | Manipulate options in a .config file from the command line. | 11 | Manipulate options in a .config file from the command line. |
10 | Usage: | 12 | Usage: |
11 | config options command ... | 13 | $myname options command ... |
12 | commands: | 14 | commands: |
13 | --enable|-e option Enable option | 15 | --enable|-e option Enable option |
14 | --disable|-d option Disable option | 16 | --disable|-d option Disable option |
@@ -33,14 +35,14 @@ options: | |||
33 | --file config-file .config file to change (default .config) | 35 | --file config-file .config file to change (default .config) |
34 | --keep-case|-k Keep next symbols' case (dont' upper-case it) | 36 | --keep-case|-k Keep next symbols' case (dont' upper-case it) |
35 | 37 | ||
36 | config doesn't check the validity of the .config file. This is done at next | 38 | $myname doesn't check the validity of the .config file. This is done at next |
37 | make time. | 39 | make time. |
38 | 40 | ||
39 | By default, config will upper-case the given symbol. Use --keep-case to keep | 41 | By default, $myname will upper-case the given symbol. Use --keep-case to keep |
40 | the case of all following symbols unchanged. | 42 | the case of all following symbols unchanged. |
41 | 43 | ||
42 | config uses 'CONFIG_' as the default symbol prefix. Set the environment | 44 | $myname uses 'CONFIG_' as the default symbol prefix. Set the environment |
43 | variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" config ... | 45 | variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" $myname ... |
44 | EOL | 46 | EOL |
45 | exit 1 | 47 | exit 1 |
46 | } | 48 | } |
diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh index 643764f53ea7..5de5660cb708 100644 --- a/scripts/headers_install.sh +++ b/scripts/headers_install.sh | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | if [ $# -lt 1 ] | 3 | if [ $# -lt 1 ] |
4 | then | 4 | then |
5 | echo "Usage: headers_install.sh OUTDIR [FILES...] | 5 | echo "Usage: headers_install.sh OUTDIR SRCDIR [FILES...] |
6 | echo | 6 | echo |
7 | echo "Prepares kernel header files for use by user space, by removing" | 7 | echo "Prepares kernel header files for use by user space, by removing" |
8 | echo "all compiler.h definitions and #includes, removing any" | 8 | echo "all compiler.h definitions and #includes, removing any" |
@@ -10,6 +10,7 @@ then | |||
10 | echo "asm/inline/volatile keywords." | 10 | echo "asm/inline/volatile keywords." |
11 | echo | 11 | echo |
12 | echo "OUTDIR: directory to write each userspace header FILE to." | 12 | echo "OUTDIR: directory to write each userspace header FILE to." |
13 | echo "SRCDIR: source directory where files are picked." | ||
13 | echo "FILES: list of header files to operate on." | 14 | echo "FILES: list of header files to operate on." |
14 | 15 | ||
15 | exit 1 | 16 | exit 1 |
@@ -19,6 +20,8 @@ fi | |||
19 | 20 | ||
20 | OUTDIR="$1" | 21 | OUTDIR="$1" |
21 | shift | 22 | shift |
23 | SRCDIR="$1" | ||
24 | shift | ||
22 | 25 | ||
23 | # Iterate through files listed on command line | 26 | # Iterate through files listed on command line |
24 | 27 | ||
@@ -34,7 +37,7 @@ do | |||
34 | -e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \ | 37 | -e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \ |
35 | -e 's/(^|[ \t(])(inline|asm|volatile)([ \t(]|$)/\1__\2__\3/g' \ | 38 | -e 's/(^|[ \t(])(inline|asm|volatile)([ \t(]|$)/\1__\2__\3/g' \ |
36 | -e 's@#(ifndef|define|endif[ \t]*/[*])[ \t]*_UAPI@#\1 @' \ | 39 | -e 's@#(ifndef|define|endif[ \t]*/[*])[ \t]*_UAPI@#\1 @' \ |
37 | "$i" > "$OUTDIR/$FILE.sed" || exit 1 | 40 | "$SRCDIR/$i" > "$OUTDIR/$FILE.sed" || exit 1 |
38 | scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$OUTDIR/$FILE.sed" \ | 41 | scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$OUTDIR/$FILE.sed" \ |
39 | > "$OUTDIR/$FILE" | 42 | > "$OUTDIR/$FILE" |
40 | [ $? -gt 1 ] && exit 1 | 43 | [ $? -gt 1 ] && exit 1 |
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index bde5b95c8c19..d19944f9c3ac 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c | |||
@@ -527,11 +527,12 @@ int main(int ac, char **av) | |||
527 | seed_env = getenv("KCONFIG_SEED"); | 527 | seed_env = getenv("KCONFIG_SEED"); |
528 | if( seed_env && *seed_env ) { | 528 | if( seed_env && *seed_env ) { |
529 | char *endp; | 529 | char *endp; |
530 | int tmp = (int)strtol(seed_env, &endp, 10); | 530 | int tmp = (int)strtol(seed_env, &endp, 0); |
531 | if (*endp == '\0') { | 531 | if (*endp == '\0') { |
532 | seed = tmp; | 532 | seed = tmp; |
533 | } | 533 | } |
534 | } | 534 | } |
535 | fprintf( stderr, "KCONFIG_SEED=0x%X\n", seed ); | ||
535 | srand(seed); | 536 | srand(seed); |
536 | break; | 537 | break; |
537 | } | 538 | } |
@@ -653,7 +654,8 @@ int main(int ac, char **av) | |||
653 | conf_set_all_new_symbols(def_default); | 654 | conf_set_all_new_symbols(def_default); |
654 | break; | 655 | break; |
655 | case randconfig: | 656 | case randconfig: |
656 | conf_set_all_new_symbols(def_random); | 657 | /* Really nothing to do in this loop */ |
658 | while (conf_set_all_new_symbols(def_random)) ; | ||
657 | break; | 659 | break; |
658 | case defconfig: | 660 | case defconfig: |
659 | conf_set_all_new_symbols(def_default); | 661 | conf_set_all_new_symbols(def_default); |
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 43eda40c3838..c55c227af463 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
@@ -1040,7 +1040,7 @@ void conf_set_changed_callback(void (*fn)(void)) | |||
1040 | conf_changed_callback = fn; | 1040 | conf_changed_callback = fn; |
1041 | } | 1041 | } |
1042 | 1042 | ||
1043 | static void randomize_choice_values(struct symbol *csym) | 1043 | static bool randomize_choice_values(struct symbol *csym) |
1044 | { | 1044 | { |
1045 | struct property *prop; | 1045 | struct property *prop; |
1046 | struct symbol *sym; | 1046 | struct symbol *sym; |
@@ -1053,7 +1053,7 @@ static void randomize_choice_values(struct symbol *csym) | |||
1053 | * In both cases stop. | 1053 | * In both cases stop. |
1054 | */ | 1054 | */ |
1055 | if (csym->curr.tri != yes) | 1055 | if (csym->curr.tri != yes) |
1056 | return; | 1056 | return false; |
1057 | 1057 | ||
1058 | prop = sym_get_choice_prop(csym); | 1058 | prop = sym_get_choice_prop(csym); |
1059 | 1059 | ||
@@ -1077,13 +1077,18 @@ static void randomize_choice_values(struct symbol *csym) | |||
1077 | else { | 1077 | else { |
1078 | sym->def[S_DEF_USER].tri = no; | 1078 | sym->def[S_DEF_USER].tri = no; |
1079 | } | 1079 | } |
1080 | sym->flags |= SYMBOL_DEF_USER; | ||
1081 | /* clear VALID to get value calculated */ | ||
1082 | sym->flags &= ~SYMBOL_VALID; | ||
1080 | } | 1083 | } |
1081 | csym->flags |= SYMBOL_DEF_USER; | 1084 | csym->flags |= SYMBOL_DEF_USER; |
1082 | /* clear VALID to get value calculated */ | 1085 | /* clear VALID to get value calculated */ |
1083 | csym->flags &= ~(SYMBOL_VALID); | 1086 | csym->flags &= ~(SYMBOL_VALID); |
1087 | |||
1088 | return true; | ||
1084 | } | 1089 | } |
1085 | 1090 | ||
1086 | static void set_all_choice_values(struct symbol *csym) | 1091 | void set_all_choice_values(struct symbol *csym) |
1087 | { | 1092 | { |
1088 | struct property *prop; | 1093 | struct property *prop; |
1089 | struct symbol *sym; | 1094 | struct symbol *sym; |
@@ -1100,10 +1105,10 @@ static void set_all_choice_values(struct symbol *csym) | |||
1100 | } | 1105 | } |
1101 | csym->flags |= SYMBOL_DEF_USER; | 1106 | csym->flags |= SYMBOL_DEF_USER; |
1102 | /* clear VALID to get value calculated */ | 1107 | /* clear VALID to get value calculated */ |
1103 | csym->flags &= ~(SYMBOL_VALID); | 1108 | csym->flags &= ~(SYMBOL_VALID | SYMBOL_NEED_SET_CHOICE_VALUES); |
1104 | } | 1109 | } |
1105 | 1110 | ||
1106 | void conf_set_all_new_symbols(enum conf_def_mode mode) | 1111 | bool conf_set_all_new_symbols(enum conf_def_mode mode) |
1107 | { | 1112 | { |
1108 | struct symbol *sym, *csym; | 1113 | struct symbol *sym, *csym; |
1109 | int i, cnt, pby, pty, ptm; /* pby: probability of boolean = y | 1114 | int i, cnt, pby, pty, ptm; /* pby: probability of boolean = y |
@@ -1151,6 +1156,7 @@ void conf_set_all_new_symbols(enum conf_def_mode mode) | |||
1151 | exit( 1 ); | 1156 | exit( 1 ); |
1152 | } | 1157 | } |
1153 | } | 1158 | } |
1159 | bool has_changed = false; | ||
1154 | 1160 | ||
1155 | for_all_symbols(i, sym) { | 1161 | for_all_symbols(i, sym) { |
1156 | if (sym_has_value(sym) || (sym->flags & SYMBOL_VALID)) | 1162 | if (sym_has_value(sym) || (sym->flags & SYMBOL_VALID)) |
@@ -1158,6 +1164,7 @@ void conf_set_all_new_symbols(enum conf_def_mode mode) | |||
1158 | switch (sym_get_type(sym)) { | 1164 | switch (sym_get_type(sym)) { |
1159 | case S_BOOLEAN: | 1165 | case S_BOOLEAN: |
1160 | case S_TRISTATE: | 1166 | case S_TRISTATE: |
1167 | has_changed = true; | ||
1161 | switch (mode) { | 1168 | switch (mode) { |
1162 | case def_yes: | 1169 | case def_yes: |
1163 | sym->def[S_DEF_USER].tri = yes; | 1170 | sym->def[S_DEF_USER].tri = yes; |
@@ -1202,14 +1209,26 @@ void conf_set_all_new_symbols(enum conf_def_mode mode) | |||
1202 | * selected in a choice block and we set it to yes, | 1209 | * selected in a choice block and we set it to yes, |
1203 | * and the rest to no. | 1210 | * and the rest to no. |
1204 | */ | 1211 | */ |
1212 | if (mode != def_random) { | ||
1213 | for_all_symbols(i, csym) { | ||
1214 | if ((sym_is_choice(csym) && !sym_has_value(csym)) || | ||
1215 | sym_is_choice_value(csym)) | ||
1216 | csym->flags |= SYMBOL_NEED_SET_CHOICE_VALUES; | ||
1217 | } | ||
1218 | } | ||
1219 | |||
1205 | for_all_symbols(i, csym) { | 1220 | for_all_symbols(i, csym) { |
1206 | if (sym_has_value(csym) || !sym_is_choice(csym)) | 1221 | if (sym_has_value(csym) || !sym_is_choice(csym)) |
1207 | continue; | 1222 | continue; |
1208 | 1223 | ||
1209 | sym_calc_value(csym); | 1224 | sym_calc_value(csym); |
1210 | if (mode == def_random) | 1225 | if (mode == def_random) |
1211 | randomize_choice_values(csym); | 1226 | has_changed = randomize_choice_values(csym); |
1212 | else | 1227 | else { |
1213 | set_all_choice_values(csym); | 1228 | set_all_choice_values(csym); |
1229 | has_changed = true; | ||
1230 | } | ||
1214 | } | 1231 | } |
1232 | |||
1233 | return has_changed; | ||
1215 | } | 1234 | } |
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index cdd48600e02a..df198a5f4822 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h | |||
@@ -106,6 +106,9 @@ struct symbol { | |||
106 | #define SYMBOL_DEF3 0x40000 /* symbol.def[S_DEF_3] is valid */ | 106 | #define SYMBOL_DEF3 0x40000 /* symbol.def[S_DEF_3] is valid */ |
107 | #define SYMBOL_DEF4 0x80000 /* symbol.def[S_DEF_4] is valid */ | 107 | #define SYMBOL_DEF4 0x80000 /* symbol.def[S_DEF_4] is valid */ |
108 | 108 | ||
109 | /* choice values need to be set before calculating this symbol value */ | ||
110 | #define SYMBOL_NEED_SET_CHOICE_VALUES 0x100000 | ||
111 | |||
109 | #define SYMBOL_MAXLENGTH 256 | 112 | #define SYMBOL_MAXLENGTH 256 |
110 | #define SYMBOL_HASHSIZE 9973 | 113 | #define SYMBOL_HASHSIZE 9973 |
111 | 114 | ||
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index f8aee5fc6d5e..09f4edfdc911 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h | |||
@@ -86,7 +86,8 @@ const char *conf_get_autoconfig_name(void); | |||
86 | char *conf_get_default_confname(void); | 86 | char *conf_get_default_confname(void); |
87 | void sym_set_change_count(int count); | 87 | void sym_set_change_count(int count); |
88 | void sym_add_change_count(int count); | 88 | void sym_add_change_count(int count); |
89 | void conf_set_all_new_symbols(enum conf_def_mode mode); | 89 | bool conf_set_all_new_symbols(enum conf_def_mode mode); |
90 | void set_all_choice_values(struct symbol *csym); | ||
90 | 91 | ||
91 | struct conf_printer { | 92 | struct conf_printer { |
92 | void (*print_symbol)(FILE *, struct symbol *, const char *, void *); | 93 | void (*print_symbol)(FILE *, struct symbol *, const char *, void *); |
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index ef1a7381f956..ecdb9659b67d 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h | |||
@@ -14,6 +14,7 @@ P(conf_set_message_callback, void,(void (*fn)(const char *fmt, va_list ap))); | |||
14 | /* menu.c */ | 14 | /* menu.c */ |
15 | P(rootmenu,struct menu,); | 15 | P(rootmenu,struct menu,); |
16 | 16 | ||
17 | P(menu_is_empty, bool, (struct menu *menu)); | ||
17 | P(menu_is_visible, bool, (struct menu *menu)); | 18 | P(menu_is_visible, bool, (struct menu *menu)); |
18 | P(menu_has_prompt, bool, (struct menu *menu)); | 19 | P(menu_has_prompt, bool, (struct menu *menu)); |
19 | P(menu_get_prompt,const char *,(struct menu *menu)); | 20 | P(menu_get_prompt,const char *,(struct menu *menu)); |
diff --git a/scripts/kconfig/lxdialog/checklist.c b/scripts/kconfig/lxdialog/checklist.c index a2eb80fbc896..3b15c08ec1fa 100644 --- a/scripts/kconfig/lxdialog/checklist.c +++ b/scripts/kconfig/lxdialog/checklist.c | |||
@@ -132,16 +132,16 @@ int dialog_checklist(const char *title, const char *prompt, int height, | |||
132 | } | 132 | } |
133 | 133 | ||
134 | do_resize: | 134 | do_resize: |
135 | if (getmaxy(stdscr) < (height + 6)) | 135 | if (getmaxy(stdscr) < (height + CHECKLIST_HEIGTH_MIN)) |
136 | return -ERRDISPLAYTOOSMALL; | 136 | return -ERRDISPLAYTOOSMALL; |
137 | if (getmaxx(stdscr) < (width + 6)) | 137 | if (getmaxx(stdscr) < (width + CHECKLIST_WIDTH_MIN)) |
138 | return -ERRDISPLAYTOOSMALL; | 138 | return -ERRDISPLAYTOOSMALL; |
139 | 139 | ||
140 | max_choice = MIN(list_height, item_count()); | 140 | max_choice = MIN(list_height, item_count()); |
141 | 141 | ||
142 | /* center dialog box on screen */ | 142 | /* center dialog box on screen */ |
143 | x = (COLS - width) / 2; | 143 | x = (getmaxx(stdscr) - width) / 2; |
144 | y = (LINES - height) / 2; | 144 | y = (getmaxy(stdscr) - height) / 2; |
145 | 145 | ||
146 | draw_shadow(stdscr, y, x, height, width); | 146 | draw_shadow(stdscr, y, x, height, width); |
147 | 147 | ||
diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h index 1099337079b6..b4343d384926 100644 --- a/scripts/kconfig/lxdialog/dialog.h +++ b/scripts/kconfig/lxdialog/dialog.h | |||
@@ -200,6 +200,20 @@ int item_is_tag(char tag); | |||
200 | int on_key_esc(WINDOW *win); | 200 | int on_key_esc(WINDOW *win); |
201 | int on_key_resize(void); | 201 | int on_key_resize(void); |
202 | 202 | ||
203 | /* minimum (re)size values */ | ||
204 | #define CHECKLIST_HEIGTH_MIN 6 /* For dialog_checklist() */ | ||
205 | #define CHECKLIST_WIDTH_MIN 6 | ||
206 | #define INPUTBOX_HEIGTH_MIN 2 /* For dialog_inputbox() */ | ||
207 | #define INPUTBOX_WIDTH_MIN 2 | ||
208 | #define MENUBOX_HEIGTH_MIN 15 /* For dialog_menu() */ | ||
209 | #define MENUBOX_WIDTH_MIN 65 | ||
210 | #define TEXTBOX_HEIGTH_MIN 8 /* For dialog_textbox() */ | ||
211 | #define TEXTBOX_WIDTH_MIN 8 | ||
212 | #define YESNO_HEIGTH_MIN 4 /* For dialog_yesno() */ | ||
213 | #define YESNO_WIDTH_MIN 4 | ||
214 | #define WINDOW_HEIGTH_MIN 19 /* For init_dialog() */ | ||
215 | #define WINDOW_WIDTH_MIN 80 | ||
216 | |||
203 | int init_dialog(const char *backtitle); | 217 | int init_dialog(const char *backtitle); |
204 | void set_dialog_backtitle(const char *backtitle); | 218 | void set_dialog_backtitle(const char *backtitle); |
205 | void set_dialog_subtitles(struct subtitle_list *subtitles); | 219 | void set_dialog_subtitles(struct subtitle_list *subtitles); |
diff --git a/scripts/kconfig/lxdialog/inputbox.c b/scripts/kconfig/lxdialog/inputbox.c index 21404a04d7c3..447a582198c9 100644 --- a/scripts/kconfig/lxdialog/inputbox.c +++ b/scripts/kconfig/lxdialog/inputbox.c | |||
@@ -56,14 +56,14 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width | |||
56 | strcpy(instr, init); | 56 | strcpy(instr, init); |
57 | 57 | ||
58 | do_resize: | 58 | do_resize: |
59 | if (getmaxy(stdscr) <= (height - 2)) | 59 | if (getmaxy(stdscr) <= (height - INPUTBOX_HEIGTH_MIN)) |
60 | return -ERRDISPLAYTOOSMALL; | 60 | return -ERRDISPLAYTOOSMALL; |
61 | if (getmaxx(stdscr) <= (width - 2)) | 61 | if (getmaxx(stdscr) <= (width - INPUTBOX_WIDTH_MIN)) |
62 | return -ERRDISPLAYTOOSMALL; | 62 | return -ERRDISPLAYTOOSMALL; |
63 | 63 | ||
64 | /* center dialog box on screen */ | 64 | /* center dialog box on screen */ |
65 | x = (COLS - width) / 2; | 65 | x = (getmaxx(stdscr) - width) / 2; |
66 | y = (LINES - height) / 2; | 66 | y = (getmaxy(stdscr) - height) / 2; |
67 | 67 | ||
68 | draw_shadow(stdscr, y, x, height, width); | 68 | draw_shadow(stdscr, y, x, height, width); |
69 | 69 | ||
diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c index 38cd69c5660e..c93de0b2faca 100644 --- a/scripts/kconfig/lxdialog/menubox.c +++ b/scripts/kconfig/lxdialog/menubox.c | |||
@@ -193,7 +193,7 @@ int dialog_menu(const char *title, const char *prompt, | |||
193 | do_resize: | 193 | do_resize: |
194 | height = getmaxy(stdscr); | 194 | height = getmaxy(stdscr); |
195 | width = getmaxx(stdscr); | 195 | width = getmaxx(stdscr); |
196 | if (height < 15 || width < 65) | 196 | if (height < MENUBOX_HEIGTH_MIN || width < MENUBOX_WIDTH_MIN) |
197 | return -ERRDISPLAYTOOSMALL; | 197 | return -ERRDISPLAYTOOSMALL; |
198 | 198 | ||
199 | height -= 4; | 199 | height -= 4; |
@@ -203,8 +203,8 @@ do_resize: | |||
203 | max_choice = MIN(menu_height, item_count()); | 203 | max_choice = MIN(menu_height, item_count()); |
204 | 204 | ||
205 | /* center dialog box on screen */ | 205 | /* center dialog box on screen */ |
206 | x = (COLS - width) / 2; | 206 | x = (getmaxx(stdscr) - width) / 2; |
207 | y = (LINES - height) / 2; | 207 | y = (getmaxy(stdscr) - height) / 2; |
208 | 208 | ||
209 | draw_shadow(stdscr, y, x, height, width); | 209 | draw_shadow(stdscr, y, x, height, width); |
210 | 210 | ||
diff --git a/scripts/kconfig/lxdialog/textbox.c b/scripts/kconfig/lxdialog/textbox.c index a48bb93e0907..1773319b95e7 100644 --- a/scripts/kconfig/lxdialog/textbox.c +++ b/scripts/kconfig/lxdialog/textbox.c | |||
@@ -80,7 +80,7 @@ int dialog_textbox(const char *title, char *tbuf, int initial_height, | |||
80 | 80 | ||
81 | do_resize: | 81 | do_resize: |
82 | getmaxyx(stdscr, height, width); | 82 | getmaxyx(stdscr, height, width); |
83 | if (height < 8 || width < 8) | 83 | if (height < TEXTBOX_HEIGTH_MIN || width < TEXTBOX_WIDTH_MIN) |
84 | return -ERRDISPLAYTOOSMALL; | 84 | return -ERRDISPLAYTOOSMALL; |
85 | if (initial_height != 0) | 85 | if (initial_height != 0) |
86 | height = initial_height; | 86 | height = initial_height; |
@@ -98,8 +98,8 @@ do_resize: | |||
98 | width = 0; | 98 | width = 0; |
99 | 99 | ||
100 | /* center dialog box on screen */ | 100 | /* center dialog box on screen */ |
101 | x = (COLS - width) / 2; | 101 | x = (getmaxx(stdscr) - width) / 2; |
102 | y = (LINES - height) / 2; | 102 | y = (getmaxy(stdscr) - height) / 2; |
103 | 103 | ||
104 | draw_shadow(stdscr, y, x, height, width); | 104 | draw_shadow(stdscr, y, x, height, width); |
105 | 105 | ||
diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c index a0e97c299410..58a8289dd650 100644 --- a/scripts/kconfig/lxdialog/util.c +++ b/scripts/kconfig/lxdialog/util.c | |||
@@ -254,7 +254,12 @@ void attr_clear(WINDOW * win, int height, int width, chtype attr) | |||
254 | 254 | ||
255 | void dialog_clear(void) | 255 | void dialog_clear(void) |
256 | { | 256 | { |
257 | attr_clear(stdscr, LINES, COLS, dlg.screen.atr); | 257 | int lines, columns; |
258 | |||
259 | lines = getmaxy(stdscr); | ||
260 | columns = getmaxx(stdscr); | ||
261 | |||
262 | attr_clear(stdscr, lines, columns, dlg.screen.atr); | ||
258 | /* Display background title if it exists ... - SLH */ | 263 | /* Display background title if it exists ... - SLH */ |
259 | if (dlg.backtitle != NULL) { | 264 | if (dlg.backtitle != NULL) { |
260 | int i, len = 0, skip = 0; | 265 | int i, len = 0, skip = 0; |
@@ -269,10 +274,10 @@ void dialog_clear(void) | |||
269 | } | 274 | } |
270 | 275 | ||
271 | wmove(stdscr, 1, 1); | 276 | wmove(stdscr, 1, 1); |
272 | if (len > COLS - 2) { | 277 | if (len > columns - 2) { |
273 | const char *ellipsis = "[...] "; | 278 | const char *ellipsis = "[...] "; |
274 | waddstr(stdscr, ellipsis); | 279 | waddstr(stdscr, ellipsis); |
275 | skip = len - (COLS - 2 - strlen(ellipsis)); | 280 | skip = len - (columns - 2 - strlen(ellipsis)); |
276 | } | 281 | } |
277 | 282 | ||
278 | for (pos = dlg.subtitles; pos != NULL; pos = pos->next) { | 283 | for (pos = dlg.subtitles; pos != NULL; pos = pos->next) { |
@@ -298,7 +303,7 @@ void dialog_clear(void) | |||
298 | skip--; | 303 | skip--; |
299 | } | 304 | } |
300 | 305 | ||
301 | for (i = len + 1; i < COLS - 1; i++) | 306 | for (i = len + 1; i < columns - 1; i++) |
302 | waddch(stdscr, ACS_HLINE); | 307 | waddch(stdscr, ACS_HLINE); |
303 | } | 308 | } |
304 | wnoutrefresh(stdscr); | 309 | wnoutrefresh(stdscr); |
@@ -317,7 +322,7 @@ int init_dialog(const char *backtitle) | |||
317 | getyx(stdscr, saved_y, saved_x); | 322 | getyx(stdscr, saved_y, saved_x); |
318 | 323 | ||
319 | getmaxyx(stdscr, height, width); | 324 | getmaxyx(stdscr, height, width); |
320 | if (height < 19 || width < 80) { | 325 | if (height < WINDOW_HEIGTH_MIN || width < WINDOW_WIDTH_MIN) { |
321 | endwin(); | 326 | endwin(); |
322 | return -ERRDISPLAYTOOSMALL; | 327 | return -ERRDISPLAYTOOSMALL; |
323 | } | 328 | } |
@@ -371,27 +376,19 @@ void print_title(WINDOW *dialog, const char *title, int width) | |||
371 | /* | 376 | /* |
372 | * Print a string of text in a window, automatically wrap around to the | 377 | * Print a string of text in a window, automatically wrap around to the |
373 | * next line if the string is too long to fit on one line. Newline | 378 | * next line if the string is too long to fit on one line. Newline |
374 | * characters '\n' are replaced by spaces. We start on a new line | 379 | * characters '\n' are propperly processed. We start on a new line |
375 | * if there is no room for at least 4 nonblanks following a double-space. | 380 | * if there is no room for at least 4 nonblanks following a double-space. |
376 | */ | 381 | */ |
377 | void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x) | 382 | void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x) |
378 | { | 383 | { |
379 | int newl, cur_x, cur_y; | 384 | int newl, cur_x, cur_y; |
380 | int i, prompt_len, room, wlen; | 385 | int prompt_len, room, wlen; |
381 | char tempstr[MAX_LEN + 1], *word, *sp, *sp2; | 386 | char tempstr[MAX_LEN + 1], *word, *sp, *sp2, *newline_separator = 0; |
382 | 387 | ||
383 | strcpy(tempstr, prompt); | 388 | strcpy(tempstr, prompt); |
384 | 389 | ||
385 | prompt_len = strlen(tempstr); | 390 | prompt_len = strlen(tempstr); |
386 | 391 | ||
387 | /* | ||
388 | * Remove newlines | ||
389 | */ | ||
390 | for (i = 0; i < prompt_len; i++) { | ||
391 | if (tempstr[i] == '\n') | ||
392 | tempstr[i] = ' '; | ||
393 | } | ||
394 | |||
395 | if (prompt_len <= width - x * 2) { /* If prompt is short */ | 392 | if (prompt_len <= width - x * 2) { /* If prompt is short */ |
396 | wmove(win, y, (width - prompt_len) / 2); | 393 | wmove(win, y, (width - prompt_len) / 2); |
397 | waddstr(win, tempstr); | 394 | waddstr(win, tempstr); |
@@ -401,7 +398,10 @@ void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x) | |||
401 | newl = 1; | 398 | newl = 1; |
402 | word = tempstr; | 399 | word = tempstr; |
403 | while (word && *word) { | 400 | while (word && *word) { |
404 | sp = strchr(word, ' '); | 401 | sp = strpbrk(word, "\n "); |
402 | if (sp && *sp == '\n') | ||
403 | newline_separator = sp; | ||
404 | |||
405 | if (sp) | 405 | if (sp) |
406 | *sp++ = 0; | 406 | *sp++ = 0; |
407 | 407 | ||
@@ -413,7 +413,7 @@ void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x) | |||
413 | if (wlen > room || | 413 | if (wlen > room || |
414 | (newl && wlen < 4 && sp | 414 | (newl && wlen < 4 && sp |
415 | && wlen + 1 + strlen(sp) > room | 415 | && wlen + 1 + strlen(sp) > room |
416 | && (!(sp2 = strchr(sp, ' ')) | 416 | && (!(sp2 = strpbrk(sp, "\n ")) |
417 | || wlen + 1 + (sp2 - sp) > room))) { | 417 | || wlen + 1 + (sp2 - sp) > room))) { |
418 | cur_y++; | 418 | cur_y++; |
419 | cur_x = x; | 419 | cur_x = x; |
@@ -421,7 +421,15 @@ void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x) | |||
421 | wmove(win, cur_y, cur_x); | 421 | wmove(win, cur_y, cur_x); |
422 | waddstr(win, word); | 422 | waddstr(win, word); |
423 | getyx(win, cur_y, cur_x); | 423 | getyx(win, cur_y, cur_x); |
424 | cur_x++; | 424 | |
425 | /* Move to the next line if the word separator was a newline */ | ||
426 | if (newline_separator) { | ||
427 | cur_y++; | ||
428 | cur_x = x; | ||
429 | newline_separator = 0; | ||
430 | } else | ||
431 | cur_x++; | ||
432 | |||
425 | if (sp && *sp == ' ') { | 433 | if (sp && *sp == ' ') { |
426 | cur_x++; /* double space */ | 434 | cur_x++; /* double space */ |
427 | while (*++sp == ' ') ; | 435 | while (*++sp == ' ') ; |
diff --git a/scripts/kconfig/lxdialog/yesno.c b/scripts/kconfig/lxdialog/yesno.c index 4e6e8090c20b..676fb2f824a3 100644 --- a/scripts/kconfig/lxdialog/yesno.c +++ b/scripts/kconfig/lxdialog/yesno.c | |||
@@ -45,14 +45,14 @@ int dialog_yesno(const char *title, const char *prompt, int height, int width) | |||
45 | WINDOW *dialog; | 45 | WINDOW *dialog; |
46 | 46 | ||
47 | do_resize: | 47 | do_resize: |
48 | if (getmaxy(stdscr) < (height + 4)) | 48 | if (getmaxy(stdscr) < (height + YESNO_HEIGTH_MIN)) |
49 | return -ERRDISPLAYTOOSMALL; | 49 | return -ERRDISPLAYTOOSMALL; |
50 | if (getmaxx(stdscr) < (width + 4)) | 50 | if (getmaxx(stdscr) < (width + YESNO_WIDTH_MIN)) |
51 | return -ERRDISPLAYTOOSMALL; | 51 | return -ERRDISPLAYTOOSMALL; |
52 | 52 | ||
53 | /* center dialog box on screen */ | 53 | /* center dialog box on screen */ |
54 | x = (COLS - width) / 2; | 54 | x = (getmaxx(stdscr) - width) / 2; |
55 | y = (LINES - height) / 2; | 55 | y = (getmaxy(stdscr) - height) / 2; |
56 | 56 | ||
57 | draw_shadow(stdscr, y, x, height, width); | 57 | draw_shadow(stdscr, y, x, height, width); |
58 | 58 | ||
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index a69cbd78fb38..6c9c45f9fbba 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
@@ -48,7 +48,7 @@ static const char mconf_readme[] = N_( | |||
48 | "----------\n" | 48 | "----------\n" |
49 | "o Use the Up/Down arrow keys (cursor keys) to highlight the item\n" | 49 | "o Use the Up/Down arrow keys (cursor keys) to highlight the item\n" |
50 | " you wish to change or submenu wish to select and press <Enter>.\n" | 50 | " you wish to change or submenu wish to select and press <Enter>.\n" |
51 | " Submenus are designated by \"--->\".\n" | 51 | " Submenus are designated by \"--->\", empty ones by \"----\".\n" |
52 | "\n" | 52 | "\n" |
53 | " Shortcut: Press the option's highlighted letter (hotkey).\n" | 53 | " Shortcut: Press the option's highlighted letter (hotkey).\n" |
54 | " Pressing a hotkey more than once will sequence\n" | 54 | " Pressing a hotkey more than once will sequence\n" |
@@ -176,7 +176,7 @@ static const char mconf_readme[] = N_( | |||
176 | "\n"), | 176 | "\n"), |
177 | menu_instructions[] = N_( | 177 | menu_instructions[] = N_( |
178 | "Arrow keys navigate the menu. " | 178 | "Arrow keys navigate the menu. " |
179 | "<Enter> selects submenus --->. " | 179 | "<Enter> selects submenus ---> (or empty submenus ----). " |
180 | "Highlighted letters are hotkeys. " | 180 | "Highlighted letters are hotkeys. " |
181 | "Pressing <Y> includes, <N> excludes, <M> modularizes features. " | 181 | "Pressing <Y> includes, <N> excludes, <M> modularizes features. " |
182 | "Press <Esc><Esc> to exit, <?> for Help, </> for Search. " | 182 | "Press <Esc><Esc> to exit, <?> for Help, </> for Search. " |
@@ -401,7 +401,7 @@ static void search_conf(void) | |||
401 | struct subtitle_part stpart; | 401 | struct subtitle_part stpart; |
402 | 402 | ||
403 | title = str_new(); | 403 | title = str_new(); |
404 | str_printf( &title, _("Enter %s (sub)string to search for " | 404 | str_printf( &title, _("Enter %s (sub)string or regexp to search for " |
405 | "(with or without \"%s\")"), CONFIG_, CONFIG_); | 405 | "(with or without \"%s\")"), CONFIG_, CONFIG_); |
406 | 406 | ||
407 | again: | 407 | again: |
@@ -498,8 +498,9 @@ static void build_conf(struct menu *menu) | |||
498 | menu->data ? "-->" : "++>", | 498 | menu->data ? "-->" : "++>", |
499 | indent + 1, ' ', prompt); | 499 | indent + 1, ' ', prompt); |
500 | } else | 500 | } else |
501 | item_make(" %*c%s --->", indent + 1, ' ', prompt); | 501 | item_make(" %*c%s %s", |
502 | 502 | indent + 1, ' ', prompt, | |
503 | menu_is_empty(menu) ? "----" : "--->"); | ||
503 | item_set_tag('m'); | 504 | item_set_tag('m'); |
504 | item_set_data(menu); | 505 | item_set_data(menu); |
505 | if (single_menu_mode && menu->data) | 506 | if (single_menu_mode && menu->data) |
@@ -630,7 +631,7 @@ static void build_conf(struct menu *menu) | |||
630 | (sym_has_value(sym) || !sym_is_changable(sym)) ? | 631 | (sym_has_value(sym) || !sym_is_changable(sym)) ? |
631 | "" : _(" (NEW)")); | 632 | "" : _(" (NEW)")); |
632 | if (menu->prompt->type == P_MENU) { | 633 | if (menu->prompt->type == P_MENU) { |
633 | item_add_str(" --->"); | 634 | item_add_str(" %s", menu_is_empty(menu) ? "----" : "--->"); |
634 | return; | 635 | return; |
635 | } | 636 | } |
636 | } | 637 | } |
@@ -826,7 +827,9 @@ static void conf_choice(struct menu *menu) | |||
826 | dialog_clear(); | 827 | dialog_clear(); |
827 | res = dialog_checklist(prompt ? _(prompt) : _("Main Menu"), | 828 | res = dialog_checklist(prompt ? _(prompt) : _("Main Menu"), |
828 | _(radiolist_instructions), | 829 | _(radiolist_instructions), |
829 | 15, 70, 6); | 830 | MENUBOX_HEIGTH_MIN, |
831 | MENUBOX_WIDTH_MIN, | ||
832 | CHECKLIST_HEIGTH_MIN); | ||
830 | selected = item_activate_selected(); | 833 | selected = item_activate_selected(); |
831 | switch (res) { | 834 | switch (res) { |
832 | case 0: | 835 | case 0: |
@@ -957,8 +960,8 @@ static int handle_exit(void) | |||
957 | dialog_clear(); | 960 | dialog_clear(); |
958 | if (conf_get_changed()) | 961 | if (conf_get_changed()) |
959 | res = dialog_yesno(NULL, | 962 | res = dialog_yesno(NULL, |
960 | _("Do you wish to save your new configuration ?\n" | 963 | _("Do you wish to save your new configuration?\n" |
961 | "<ESC><ESC> to continue."), | 964 | "(Press <ESC><ESC> to continue kernel configuration.)"), |
962 | 6, 60); | 965 | 6, 60); |
963 | else | 966 | else |
964 | res = -1; | 967 | res = -1; |
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index fd3f0180e08f..7e233a6ca64e 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c | |||
@@ -443,6 +443,22 @@ bool menu_has_prompt(struct menu *menu) | |||
443 | return true; | 443 | return true; |
444 | } | 444 | } |
445 | 445 | ||
446 | /* | ||
447 | * Determine if a menu is empty. | ||
448 | * A menu is considered empty if it contains no or only | ||
449 | * invisible entries. | ||
450 | */ | ||
451 | bool menu_is_empty(struct menu *menu) | ||
452 | { | ||
453 | struct menu *child; | ||
454 | |||
455 | for (child = menu->list; child; child = child->next) { | ||
456 | if (menu_is_visible(child)) | ||
457 | return(false); | ||
458 | } | ||
459 | return(true); | ||
460 | } | ||
461 | |||
446 | bool menu_is_visible(struct menu *menu) | 462 | bool menu_is_visible(struct menu *menu) |
447 | { | 463 | { |
448 | struct menu *child; | 464 | struct menu *child; |
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c index dbf31edd22b2..7975d8d258c3 100644 --- a/scripts/kconfig/nconf.c +++ b/scripts/kconfig/nconf.c | |||
@@ -45,8 +45,8 @@ static const char nconf_global_help[] = N_( | |||
45 | "<n> to remove it. You may press the <Space> key to cycle through the\n" | 45 | "<n> to remove it. You may press the <Space> key to cycle through the\n" |
46 | "available options.\n" | 46 | "available options.\n" |
47 | "\n" | 47 | "\n" |
48 | "A trailing \"--->\" designates a submenu.\n" | 48 | "A trailing \"--->\" designates a submenu, a trailing \"----\" an\n" |
49 | "\n" | 49 | "empty submenu.\n" |
50 | "\n" | 50 | "\n" |
51 | "Menu navigation keys\n" | 51 | "Menu navigation keys\n" |
52 | "----------------------------------------------------------------------\n" | 52 | "----------------------------------------------------------------------\n" |
@@ -131,7 +131,7 @@ static const char nconf_global_help[] = N_( | |||
131 | "\n"), | 131 | "\n"), |
132 | menu_no_f_instructions[] = N_( | 132 | menu_no_f_instructions[] = N_( |
133 | "Legend: [*] built-in [ ] excluded <M> module < > module capable.\n" | 133 | "Legend: [*] built-in [ ] excluded <M> module < > module capable.\n" |
134 | "Submenus are designated by a trailing \"--->\".\n" | 134 | "Submenus are designated by a trailing \"--->\", empty ones by \"----\".\n" |
135 | "\n" | 135 | "\n" |
136 | "Use the following keys to navigate the menus:\n" | 136 | "Use the following keys to navigate the menus:\n" |
137 | "Move up or down with <Up> and <Down>.\n" | 137 | "Move up or down with <Up> and <Down>.\n" |
@@ -148,7 +148,7 @@ menu_no_f_instructions[] = N_( | |||
148 | "For help related to the current menu entry press <?> or <h>.\n"), | 148 | "For help related to the current menu entry press <?> or <h>.\n"), |
149 | menu_instructions[] = N_( | 149 | menu_instructions[] = N_( |
150 | "Legend: [*] built-in [ ] excluded <M> module < > module capable.\n" | 150 | "Legend: [*] built-in [ ] excluded <M> module < > module capable.\n" |
151 | "Submenus are designated by a trailing \"--->\".\n" | 151 | "Submenus are designated by a trailing \"--->\", empty ones by \"----\".\n" |
152 | "\n" | 152 | "\n" |
153 | "Use the following keys to navigate the menus:\n" | 153 | "Use the following keys to navigate the menus:\n" |
154 | "Move up or down with <Up> or <Down>.\n" | 154 | "Move up or down with <Up> or <Down>.\n" |
@@ -365,15 +365,16 @@ static void print_function_line(void) | |||
365 | int i; | 365 | int i; |
366 | int offset = 1; | 366 | int offset = 1; |
367 | const int skip = 1; | 367 | const int skip = 1; |
368 | int lines = getmaxy(stdscr); | ||
368 | 369 | ||
369 | for (i = 0; i < function_keys_num; i++) { | 370 | for (i = 0; i < function_keys_num; i++) { |
370 | (void) wattrset(main_window, attributes[FUNCTION_HIGHLIGHT]); | 371 | (void) wattrset(main_window, attributes[FUNCTION_HIGHLIGHT]); |
371 | mvwprintw(main_window, LINES-3, offset, | 372 | mvwprintw(main_window, lines-3, offset, |
372 | "%s", | 373 | "%s", |
373 | function_keys[i].key_str); | 374 | function_keys[i].key_str); |
374 | (void) wattrset(main_window, attributes[FUNCTION_TEXT]); | 375 | (void) wattrset(main_window, attributes[FUNCTION_TEXT]); |
375 | offset += strlen(function_keys[i].key_str); | 376 | offset += strlen(function_keys[i].key_str); |
376 | mvwprintw(main_window, LINES-3, | 377 | mvwprintw(main_window, lines-3, |
377 | offset, "%s", | 378 | offset, "%s", |
378 | function_keys[i].func); | 379 | function_keys[i].func); |
379 | offset += strlen(function_keys[i].func) + skip; | 380 | offset += strlen(function_keys[i].func) + skip; |
@@ -694,7 +695,7 @@ static void search_conf(void) | |||
694 | int dres; | 695 | int dres; |
695 | 696 | ||
696 | title = str_new(); | 697 | title = str_new(); |
697 | str_printf( &title, _("Enter %s (sub)string to search for " | 698 | str_printf( &title, _("Enter %s (sub)string or regexp to search for " |
698 | "(with or without \"%s\")"), CONFIG_, CONFIG_); | 699 | "(with or without \"%s\")"), CONFIG_, CONFIG_); |
699 | 700 | ||
700 | again: | 701 | again: |
@@ -759,9 +760,9 @@ static void build_conf(struct menu *menu) | |||
759 | indent + 1, ' ', prompt); | 760 | indent + 1, ' ', prompt); |
760 | } else | 761 | } else |
761 | item_make(menu, 'm', | 762 | item_make(menu, 'm', |
762 | " %*c%s --->", | 763 | " %*c%s %s", |
763 | indent + 1, | 764 | indent + 1, ' ', prompt, |
764 | ' ', prompt); | 765 | menu_is_empty(menu) ? "----" : "--->"); |
765 | 766 | ||
766 | if (single_menu_mode && menu->data) | 767 | if (single_menu_mode && menu->data) |
767 | goto conf_childs; | 768 | goto conf_childs; |
@@ -903,7 +904,7 @@ static void build_conf(struct menu *menu) | |||
903 | (sym_has_value(sym) || !sym_is_changable(sym)) ? | 904 | (sym_has_value(sym) || !sym_is_changable(sym)) ? |
904 | "" : _(" (NEW)")); | 905 | "" : _(" (NEW)")); |
905 | if (menu->prompt && menu->prompt->type == P_MENU) { | 906 | if (menu->prompt && menu->prompt->type == P_MENU) { |
906 | item_add_str(" --->"); | 907 | item_add_str(" %s", menu_is_empty(menu) ? "----" : "--->"); |
907 | return; | 908 | return; |
908 | } | 909 | } |
909 | } | 910 | } |
@@ -954,7 +955,7 @@ static void show_menu(const char *prompt, const char *instructions, | |||
954 | 955 | ||
955 | clear(); | 956 | clear(); |
956 | (void) wattrset(main_window, attributes[NORMAL]); | 957 | (void) wattrset(main_window, attributes[NORMAL]); |
957 | print_in_middle(stdscr, 1, 0, COLS, | 958 | print_in_middle(stdscr, 1, 0, getmaxx(stdscr), |
958 | menu_backtitle, | 959 | menu_backtitle, |
959 | attributes[MAIN_HEADING]); | 960 | attributes[MAIN_HEADING]); |
960 | 961 | ||
@@ -1455,14 +1456,18 @@ static void conf_save(void) | |||
1455 | 1456 | ||
1456 | void setup_windows(void) | 1457 | void setup_windows(void) |
1457 | { | 1458 | { |
1459 | int lines, columns; | ||
1460 | |||
1461 | getmaxyx(stdscr, lines, columns); | ||
1462 | |||
1458 | if (main_window != NULL) | 1463 | if (main_window != NULL) |
1459 | delwin(main_window); | 1464 | delwin(main_window); |
1460 | 1465 | ||
1461 | /* set up the menu and menu window */ | 1466 | /* set up the menu and menu window */ |
1462 | main_window = newwin(LINES-2, COLS-2, 2, 1); | 1467 | main_window = newwin(lines-2, columns-2, 2, 1); |
1463 | keypad(main_window, TRUE); | 1468 | keypad(main_window, TRUE); |
1464 | mwin_max_lines = LINES-7; | 1469 | mwin_max_lines = lines-7; |
1465 | mwin_max_cols = COLS-6; | 1470 | mwin_max_cols = columns-6; |
1466 | 1471 | ||
1467 | /* panels order is from bottom to top */ | 1472 | /* panels order is from bottom to top */ |
1468 | new_panel(main_window); | 1473 | new_panel(main_window); |
@@ -1470,6 +1475,7 @@ void setup_windows(void) | |||
1470 | 1475 | ||
1471 | int main(int ac, char **av) | 1476 | int main(int ac, char **av) |
1472 | { | 1477 | { |
1478 | int lines, columns; | ||
1473 | char *mode; | 1479 | char *mode; |
1474 | 1480 | ||
1475 | setlocale(LC_ALL, ""); | 1481 | setlocale(LC_ALL, ""); |
@@ -1495,7 +1501,8 @@ int main(int ac, char **av) | |||
1495 | keypad(stdscr, TRUE); | 1501 | keypad(stdscr, TRUE); |
1496 | curs_set(0); | 1502 | curs_set(0); |
1497 | 1503 | ||
1498 | if (COLS < 75 || LINES < 20) { | 1504 | getmaxyx(stdscr, lines, columns); |
1505 | if (columns < 75 || lines < 20) { | ||
1499 | endwin(); | 1506 | endwin(); |
1500 | printf("Your terminal should have at " | 1507 | printf("Your terminal should have at " |
1501 | "least 20 lines and 75 columns\n"); | 1508 | "least 20 lines and 75 columns\n"); |
diff --git a/scripts/kconfig/nconf.gui.c b/scripts/kconfig/nconf.gui.c index 9f8c44ecc703..8275f0e55106 100644 --- a/scripts/kconfig/nconf.gui.c +++ b/scripts/kconfig/nconf.gui.c | |||
@@ -276,8 +276,8 @@ int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...) | |||
276 | 276 | ||
277 | total_width = max(msg_width, btns_width); | 277 | total_width = max(msg_width, btns_width); |
278 | /* place dialog in middle of screen */ | 278 | /* place dialog in middle of screen */ |
279 | y = (LINES-(msg_lines+4))/2; | 279 | y = (getmaxy(stdscr)-(msg_lines+4))/2; |
280 | x = (COLS-(total_width+4))/2; | 280 | x = (getmaxx(stdscr)-(total_width+4))/2; |
281 | 281 | ||
282 | 282 | ||
283 | /* create the windows */ | 283 | /* create the windows */ |
@@ -387,8 +387,8 @@ int dialog_inputbox(WINDOW *main_window, | |||
387 | prompt_width = max(prompt_width, strlen(title)); | 387 | prompt_width = max(prompt_width, strlen(title)); |
388 | 388 | ||
389 | /* place dialog in middle of screen */ | 389 | /* place dialog in middle of screen */ |
390 | y = (LINES-(prompt_lines+4))/2; | 390 | y = (getmaxy(stdscr)-(prompt_lines+4))/2; |
391 | x = (COLS-(prompt_width+4))/2; | 391 | x = (getmaxx(stdscr)-(prompt_width+4))/2; |
392 | 392 | ||
393 | strncpy(result, init, *result_len); | 393 | strncpy(result, init, *result_len); |
394 | 394 | ||
@@ -545,7 +545,7 @@ void show_scroll_win(WINDOW *main_window, | |||
545 | { | 545 | { |
546 | int res; | 546 | int res; |
547 | int total_lines = get_line_no(text); | 547 | int total_lines = get_line_no(text); |
548 | int x, y; | 548 | int x, y, lines, columns; |
549 | int start_x = 0, start_y = 0; | 549 | int start_x = 0, start_y = 0; |
550 | int text_lines = 0, text_cols = 0; | 550 | int text_lines = 0, text_cols = 0; |
551 | int total_cols = 0; | 551 | int total_cols = 0; |
@@ -556,6 +556,8 @@ void show_scroll_win(WINDOW *main_window, | |||
556 | WINDOW *pad; | 556 | WINDOW *pad; |
557 | PANEL *panel; | 557 | PANEL *panel; |
558 | 558 | ||
559 | getmaxyx(stdscr, lines, columns); | ||
560 | |||
559 | /* find the widest line of msg: */ | 561 | /* find the widest line of msg: */ |
560 | total_lines = get_line_no(text); | 562 | total_lines = get_line_no(text); |
561 | for (i = 0; i < total_lines; i++) { | 563 | for (i = 0; i < total_lines; i++) { |
@@ -569,14 +571,14 @@ void show_scroll_win(WINDOW *main_window, | |||
569 | (void) wattrset(pad, attributes[SCROLLWIN_TEXT]); | 571 | (void) wattrset(pad, attributes[SCROLLWIN_TEXT]); |
570 | fill_window(pad, text); | 572 | fill_window(pad, text); |
571 | 573 | ||
572 | win_lines = min(total_lines+4, LINES-2); | 574 | win_lines = min(total_lines+4, lines-2); |
573 | win_cols = min(total_cols+2, COLS-2); | 575 | win_cols = min(total_cols+2, columns-2); |
574 | text_lines = max(win_lines-4, 0); | 576 | text_lines = max(win_lines-4, 0); |
575 | text_cols = max(win_cols-2, 0); | 577 | text_cols = max(win_cols-2, 0); |
576 | 578 | ||
577 | /* place window in middle of screen */ | 579 | /* place window in middle of screen */ |
578 | y = (LINES-win_lines)/2; | 580 | y = (lines-win_lines)/2; |
579 | x = (COLS-win_cols)/2; | 581 | x = (columns-win_cols)/2; |
580 | 582 | ||
581 | win = newwin(win_lines, win_cols, y, x); | 583 | win = newwin(win_lines, win_cols, y, x); |
582 | keypad(win, TRUE); | 584 | keypad(win, TRUE); |
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index ecc5aa5f865d..d550300ec00c 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c | |||
@@ -136,7 +136,7 @@ static struct property *sym_get_range_prop(struct symbol *sym) | |||
136 | return NULL; | 136 | return NULL; |
137 | } | 137 | } |
138 | 138 | ||
139 | static int sym_get_range_val(struct symbol *sym, int base) | 139 | static long sym_get_range_val(struct symbol *sym, int base) |
140 | { | 140 | { |
141 | sym_calc_value(sym); | 141 | sym_calc_value(sym); |
142 | switch (sym->type) { | 142 | switch (sym->type) { |
@@ -155,7 +155,7 @@ static int sym_get_range_val(struct symbol *sym, int base) | |||
155 | static void sym_validate_range(struct symbol *sym) | 155 | static void sym_validate_range(struct symbol *sym) |
156 | { | 156 | { |
157 | struct property *prop; | 157 | struct property *prop; |
158 | int base, val, val2; | 158 | long base, val, val2; |
159 | char str[64]; | 159 | char str[64]; |
160 | 160 | ||
161 | switch (sym->type) { | 161 | switch (sym->type) { |
@@ -179,9 +179,9 @@ static void sym_validate_range(struct symbol *sym) | |||
179 | return; | 179 | return; |
180 | } | 180 | } |
181 | if (sym->type == S_INT) | 181 | if (sym->type == S_INT) |
182 | sprintf(str, "%d", val2); | 182 | sprintf(str, "%ld", val2); |
183 | else | 183 | else |
184 | sprintf(str, "0x%x", val2); | 184 | sprintf(str, "0x%lx", val2); |
185 | sym->curr.val = strdup(str); | 185 | sym->curr.val = strdup(str); |
186 | } | 186 | } |
187 | 187 | ||
@@ -300,6 +300,14 @@ void sym_calc_value(struct symbol *sym) | |||
300 | 300 | ||
301 | if (sym->flags & SYMBOL_VALID) | 301 | if (sym->flags & SYMBOL_VALID) |
302 | return; | 302 | return; |
303 | |||
304 | if (sym_is_choice_value(sym) && | ||
305 | sym->flags & SYMBOL_NEED_SET_CHOICE_VALUES) { | ||
306 | sym->flags &= ~SYMBOL_NEED_SET_CHOICE_VALUES; | ||
307 | prop = sym_get_choice_prop(sym); | ||
308 | sym_calc_value(prop_get_symbol(prop)); | ||
309 | } | ||
310 | |||
303 | sym->flags |= SYMBOL_VALID; | 311 | sym->flags |= SYMBOL_VALID; |
304 | 312 | ||
305 | oldval = sym->curr; | 313 | oldval = sym->curr; |
@@ -425,6 +433,9 @@ void sym_calc_value(struct symbol *sym) | |||
425 | 433 | ||
426 | if (sym->flags & SYMBOL_AUTO) | 434 | if (sym->flags & SYMBOL_AUTO) |
427 | sym->flags &= ~SYMBOL_WRITE; | 435 | sym->flags &= ~SYMBOL_WRITE; |
436 | |||
437 | if (sym->flags & SYMBOL_NEED_SET_CHOICE_VALUES) | ||
438 | set_all_choice_values(sym); | ||
428 | } | 439 | } |
429 | 440 | ||
430 | void sym_clear_all_valid(void) | 441 | void sym_clear_all_valid(void) |
@@ -583,7 +594,7 @@ bool sym_string_valid(struct symbol *sym, const char *str) | |||
583 | bool sym_string_within_range(struct symbol *sym, const char *str) | 594 | bool sym_string_within_range(struct symbol *sym, const char *str) |
584 | { | 595 | { |
585 | struct property *prop; | 596 | struct property *prop; |
586 | int val; | 597 | long val; |
587 | 598 | ||
588 | switch (sym->type) { | 599 | switch (sym->type) { |
589 | case S_STRING: | 600 | case S_STRING: |
@@ -943,38 +954,98 @@ const char *sym_escape_string_value(const char *in) | |||
943 | return res; | 954 | return res; |
944 | } | 955 | } |
945 | 956 | ||
957 | struct sym_match { | ||
958 | struct symbol *sym; | ||
959 | off_t so, eo; | ||
960 | }; | ||
961 | |||
962 | /* Compare matched symbols as thus: | ||
963 | * - first, symbols that match exactly | ||
964 | * - then, alphabetical sort | ||
965 | */ | ||
966 | static int sym_rel_comp( const void *sym1, const void *sym2 ) | ||
967 | { | ||
968 | struct sym_match *s1 = *(struct sym_match **)sym1; | ||
969 | struct sym_match *s2 = *(struct sym_match **)sym2; | ||
970 | int l1, l2; | ||
971 | |||
972 | /* Exact match: | ||
973 | * - if matched length on symbol s1 is the length of that symbol, | ||
974 | * then this symbol should come first; | ||
975 | * - if matched length on symbol s2 is the length of that symbol, | ||
976 | * then this symbol should come first. | ||
977 | * Note: since the search can be a regexp, both symbols may match | ||
978 | * exactly; if this is the case, we can't decide which comes first, | ||
979 | * and we fallback to sorting alphabetically. | ||
980 | */ | ||
981 | l1 = s1->eo - s1->so; | ||
982 | l2 = s2->eo - s2->so; | ||
983 | if (l1 == strlen(s1->sym->name) && l2 != strlen(s2->sym->name)) | ||
984 | return -1; | ||
985 | if (l1 != strlen(s1->sym->name) && l2 == strlen(s2->sym->name)) | ||
986 | return 1; | ||
987 | |||
988 | /* As a fallback, sort symbols alphabetically */ | ||
989 | return strcmp(s1->sym->name, s2->sym->name); | ||
990 | } | ||
991 | |||
946 | struct symbol **sym_re_search(const char *pattern) | 992 | struct symbol **sym_re_search(const char *pattern) |
947 | { | 993 | { |
948 | struct symbol *sym, **sym_arr = NULL; | 994 | struct symbol *sym, **sym_arr = NULL; |
995 | struct sym_match **sym_match_arr = NULL; | ||
949 | int i, cnt, size; | 996 | int i, cnt, size; |
950 | regex_t re; | 997 | regex_t re; |
998 | regmatch_t match[1]; | ||
951 | 999 | ||
952 | cnt = size = 0; | 1000 | cnt = size = 0; |
953 | /* Skip if empty */ | 1001 | /* Skip if empty */ |
954 | if (strlen(pattern) == 0) | 1002 | if (strlen(pattern) == 0) |
955 | return NULL; | 1003 | return NULL; |
956 | if (regcomp(&re, pattern, REG_EXTENDED|REG_NOSUB|REG_ICASE)) | 1004 | if (regcomp(&re, pattern, REG_EXTENDED|REG_ICASE)) |
957 | return NULL; | 1005 | return NULL; |
958 | 1006 | ||
959 | for_all_symbols(i, sym) { | 1007 | for_all_symbols(i, sym) { |
1008 | struct sym_match *tmp_sym_match; | ||
960 | if (sym->flags & SYMBOL_CONST || !sym->name) | 1009 | if (sym->flags & SYMBOL_CONST || !sym->name) |
961 | continue; | 1010 | continue; |
962 | if (regexec(&re, sym->name, 0, NULL, 0)) | 1011 | if (regexec(&re, sym->name, 1, match, 0)) |
963 | continue; | 1012 | continue; |
964 | if (cnt + 1 >= size) { | 1013 | if (cnt + 1 >= size) { |
965 | void *tmp = sym_arr; | 1014 | void *tmp; |
966 | size += 16; | 1015 | size += 16; |
967 | sym_arr = realloc(sym_arr, size * sizeof(struct symbol *)); | 1016 | tmp = realloc(sym_match_arr, size * sizeof(struct sym_match *)); |
968 | if (!sym_arr) { | 1017 | if (!tmp) { |
969 | free(tmp); | 1018 | goto sym_re_search_free; |
970 | return NULL; | ||
971 | } | 1019 | } |
1020 | sym_match_arr = tmp; | ||
972 | } | 1021 | } |
973 | sym_calc_value(sym); | 1022 | sym_calc_value(sym); |
974 | sym_arr[cnt++] = sym; | 1023 | tmp_sym_match = (struct sym_match*)malloc(sizeof(struct sym_match)); |
1024 | if (!tmp_sym_match) | ||
1025 | goto sym_re_search_free; | ||
1026 | tmp_sym_match->sym = sym; | ||
1027 | /* As regexec return 0, we know we have a match, so | ||
1028 | * we can use match[0].rm_[se]o without further checks | ||
1029 | */ | ||
1030 | tmp_sym_match->so = match[0].rm_so; | ||
1031 | tmp_sym_match->eo = match[0].rm_eo; | ||
1032 | sym_match_arr[cnt++] = tmp_sym_match; | ||
975 | } | 1033 | } |
976 | if (sym_arr) | 1034 | if (sym_match_arr) { |
1035 | qsort(sym_match_arr, cnt, sizeof(struct sym_match*), sym_rel_comp); | ||
1036 | sym_arr = malloc((cnt+1) * sizeof(struct symbol)); | ||
1037 | if (!sym_arr) | ||
1038 | goto sym_re_search_free; | ||
1039 | for (i = 0; i < cnt; i++) | ||
1040 | sym_arr[i] = sym_match_arr[i]->sym; | ||
977 | sym_arr[cnt] = NULL; | 1041 | sym_arr[cnt] = NULL; |
1042 | } | ||
1043 | sym_re_search_free: | ||
1044 | if (sym_match_arr) { | ||
1045 | for (i = 0; i < cnt; i++) | ||
1046 | free(sym_match_arr[i]); | ||
1047 | free(sym_match_arr); | ||
1048 | } | ||
978 | regfree(&re); | 1049 | regfree(&re); |
979 | 1050 | ||
980 | return sym_arr; | 1051 | return sym_arr; |
diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile index 75d59fcd48b8..c11212ff3510 100644 --- a/scripts/mod/Makefile +++ b/scripts/mod/Makefile | |||
@@ -15,8 +15,8 @@ endef | |||
15 | quiet_cmd_offsets = GEN $@ | 15 | quiet_cmd_offsets = GEN $@ |
16 | define cmd_offsets | 16 | define cmd_offsets |
17 | (set -e; \ | 17 | (set -e; \ |
18 | echo "#ifndef __DEVICEVTABLE_OFFSETS_H__"; \ | 18 | echo "#ifndef __DEVICETABLE_OFFSETS_H__"; \ |
19 | echo "#define __DEVICEVTABLE_OFFSETS_H__"; \ | 19 | echo "#define __DEVICETABLE_OFFSETS_H__"; \ |
20 | echo "/*"; \ | 20 | echo "/*"; \ |
21 | echo " * DO NOT MODIFY."; \ | 21 | echo " * DO NOT MODIFY."; \ |
22 | echo " *"; \ | 22 | echo " *"; \ |
@@ -29,15 +29,10 @@ define cmd_offsets | |||
29 | echo "#endif" ) > $@ | 29 | echo "#endif" ) > $@ |
30 | endef | 30 | endef |
31 | 31 | ||
32 | # We use internal kbuild rules to avoid the "is up to date" message from make | 32 | $(obj)/$(devicetable-offsets-file): $(obj)/devicetable-offsets.s |
33 | scripts/mod/devicetable-offsets.s: scripts/mod/devicetable-offsets.c FORCE | 33 | $(call if_changed,offsets) |
34 | $(Q)mkdir -p $(dir $@) | ||
35 | $(call if_changed_dep,cc_s_c) | ||
36 | 34 | ||
37 | $(obj)/$(devicetable-offsets-file): scripts/mod/devicetable-offsets.s | 35 | targets += $(devicetable-offsets-file) devicetable-offsets.s |
38 | $(call cmd,offsets) | ||
39 | |||
40 | targets += $(devicetable-offsets-file) | ||
41 | 36 | ||
42 | # dependencies on generated files need to be listed explicitly | 37 | # dependencies on generated files need to be listed explicitly |
43 | 38 | ||
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index d9e67b719f08..23708636b05c 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -79,10 +79,12 @@ struct devtable **__start___devtable, **__stop___devtable; | |||
79 | extern struct devtable *__start___devtable[], *__stop___devtable[]; | 79 | extern struct devtable *__start___devtable[], *__stop___devtable[]; |
80 | #endif /* __MACH__ */ | 80 | #endif /* __MACH__ */ |
81 | 81 | ||
82 | #if __GNUC__ == 3 && __GNUC_MINOR__ < 3 | 82 | #if !defined(__used) |
83 | # define __used __attribute__((__unused__)) | 83 | # if __GNUC__ == 3 && __GNUC_MINOR__ < 3 |
84 | #else | 84 | # define __used __attribute__((__unused__)) |
85 | # define __used __attribute__((__used__)) | 85 | # else |
86 | # define __used __attribute__((__used__)) | ||
87 | # endif | ||
86 | #endif | 88 | #endif |
87 | 89 | ||
88 | /* Define a variable f that holds the value of field f of struct devid | 90 | /* Define a variable f that holds the value of field f of struct devid |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 3d155dd27eb6..62164348ecf7 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -861,24 +861,23 @@ static void check_section(const char *modname, struct elf_info *elf, | |||
861 | 861 | ||
862 | 862 | ||
863 | #define ALL_INIT_DATA_SECTIONS \ | 863 | #define ALL_INIT_DATA_SECTIONS \ |
864 | ".init.setup$", ".init.rodata$", \ | 864 | ".init.setup$", ".init.rodata$", ".meminit.rodata$", \ |
865 | ".cpuinit.rodata$", ".meminit.rodata$", \ | 865 | ".init.data$", ".meminit.data$" |
866 | ".init.data$", ".cpuinit.data$", ".meminit.data$" | ||
867 | #define ALL_EXIT_DATA_SECTIONS \ | 866 | #define ALL_EXIT_DATA_SECTIONS \ |
868 | ".exit.data$", ".cpuexit.data$", ".memexit.data$" | 867 | ".exit.data$", ".memexit.data$" |
869 | 868 | ||
870 | #define ALL_INIT_TEXT_SECTIONS \ | 869 | #define ALL_INIT_TEXT_SECTIONS \ |
871 | ".init.text$", ".cpuinit.text$", ".meminit.text$" | 870 | ".init.text$", ".meminit.text$" |
872 | #define ALL_EXIT_TEXT_SECTIONS \ | 871 | #define ALL_EXIT_TEXT_SECTIONS \ |
873 | ".exit.text$", ".cpuexit.text$", ".memexit.text$" | 872 | ".exit.text$", ".memexit.text$" |
874 | 873 | ||
875 | #define ALL_PCI_INIT_SECTIONS \ | 874 | #define ALL_PCI_INIT_SECTIONS \ |
876 | ".pci_fixup_early$", ".pci_fixup_header$", ".pci_fixup_final$", \ | 875 | ".pci_fixup_early$", ".pci_fixup_header$", ".pci_fixup_final$", \ |
877 | ".pci_fixup_enable$", ".pci_fixup_resume$", \ | 876 | ".pci_fixup_enable$", ".pci_fixup_resume$", \ |
878 | ".pci_fixup_resume_early$", ".pci_fixup_suspend$" | 877 | ".pci_fixup_resume_early$", ".pci_fixup_suspend$" |
879 | 878 | ||
880 | #define ALL_XXXINIT_SECTIONS CPU_INIT_SECTIONS, MEM_INIT_SECTIONS | 879 | #define ALL_XXXINIT_SECTIONS MEM_INIT_SECTIONS |
881 | #define ALL_XXXEXIT_SECTIONS CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS | 880 | #define ALL_XXXEXIT_SECTIONS MEM_EXIT_SECTIONS |
882 | 881 | ||
883 | #define ALL_INIT_SECTIONS INIT_SECTIONS, ALL_XXXINIT_SECTIONS | 882 | #define ALL_INIT_SECTIONS INIT_SECTIONS, ALL_XXXINIT_SECTIONS |
884 | #define ALL_EXIT_SECTIONS EXIT_SECTIONS, ALL_XXXEXIT_SECTIONS | 883 | #define ALL_EXIT_SECTIONS EXIT_SECTIONS, ALL_XXXEXIT_SECTIONS |
@@ -887,11 +886,9 @@ static void check_section(const char *modname, struct elf_info *elf, | |||
887 | #define TEXT_SECTIONS ".text$", ".text.unlikely$" | 886 | #define TEXT_SECTIONS ".text$", ".text.unlikely$" |
888 | 887 | ||
889 | #define INIT_SECTIONS ".init.*" | 888 | #define INIT_SECTIONS ".init.*" |
890 | #define CPU_INIT_SECTIONS ".cpuinit.*" | ||
891 | #define MEM_INIT_SECTIONS ".meminit.*" | 889 | #define MEM_INIT_SECTIONS ".meminit.*" |
892 | 890 | ||
893 | #define EXIT_SECTIONS ".exit.*" | 891 | #define EXIT_SECTIONS ".exit.*" |
894 | #define CPU_EXIT_SECTIONS ".cpuexit.*" | ||
895 | #define MEM_EXIT_SECTIONS ".memexit.*" | 892 | #define MEM_EXIT_SECTIONS ".memexit.*" |
896 | 893 | ||
897 | /* init data sections */ | 894 | /* init data sections */ |
@@ -979,48 +976,20 @@ const struct sectioncheck sectioncheck[] = { | |||
979 | .mismatch = DATA_TO_ANY_EXIT, | 976 | .mismatch = DATA_TO_ANY_EXIT, |
980 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | 977 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, |
981 | }, | 978 | }, |
982 | /* Do not reference init code/data from cpuinit/meminit code/data */ | 979 | /* Do not reference init code/data from meminit code/data */ |
983 | { | 980 | { |
984 | .fromsec = { ALL_XXXINIT_SECTIONS, NULL }, | 981 | .fromsec = { ALL_XXXINIT_SECTIONS, NULL }, |
985 | .tosec = { INIT_SECTIONS, NULL }, | 982 | .tosec = { INIT_SECTIONS, NULL }, |
986 | .mismatch = XXXINIT_TO_SOME_INIT, | 983 | .mismatch = XXXINIT_TO_SOME_INIT, |
987 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | 984 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, |
988 | }, | 985 | }, |
989 | /* Do not reference cpuinit code/data from meminit code/data */ | 986 | /* Do not reference exit code/data from memexit code/data */ |
990 | { | ||
991 | .fromsec = { MEM_INIT_SECTIONS, NULL }, | ||
992 | .tosec = { CPU_INIT_SECTIONS, NULL }, | ||
993 | .mismatch = XXXINIT_TO_SOME_INIT, | ||
994 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | ||
995 | }, | ||
996 | /* Do not reference meminit code/data from cpuinit code/data */ | ||
997 | { | ||
998 | .fromsec = { CPU_INIT_SECTIONS, NULL }, | ||
999 | .tosec = { MEM_INIT_SECTIONS, NULL }, | ||
1000 | .mismatch = XXXINIT_TO_SOME_INIT, | ||
1001 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | ||
1002 | }, | ||
1003 | /* Do not reference exit code/data from cpuexit/memexit code/data */ | ||
1004 | { | 987 | { |
1005 | .fromsec = { ALL_XXXEXIT_SECTIONS, NULL }, | 988 | .fromsec = { ALL_XXXEXIT_SECTIONS, NULL }, |
1006 | .tosec = { EXIT_SECTIONS, NULL }, | 989 | .tosec = { EXIT_SECTIONS, NULL }, |
1007 | .mismatch = XXXEXIT_TO_SOME_EXIT, | 990 | .mismatch = XXXEXIT_TO_SOME_EXIT, |
1008 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | 991 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, |
1009 | }, | 992 | }, |
1010 | /* Do not reference cpuexit code/data from memexit code/data */ | ||
1011 | { | ||
1012 | .fromsec = { MEM_EXIT_SECTIONS, NULL }, | ||
1013 | .tosec = { CPU_EXIT_SECTIONS, NULL }, | ||
1014 | .mismatch = XXXEXIT_TO_SOME_EXIT, | ||
1015 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | ||
1016 | }, | ||
1017 | /* Do not reference memexit code/data from cpuexit code/data */ | ||
1018 | { | ||
1019 | .fromsec = { CPU_EXIT_SECTIONS, NULL }, | ||
1020 | .tosec = { MEM_EXIT_SECTIONS, NULL }, | ||
1021 | .mismatch = XXXEXIT_TO_SOME_EXIT, | ||
1022 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | ||
1023 | }, | ||
1024 | /* Do not use exit code/data from init code */ | 993 | /* Do not use exit code/data from init code */ |
1025 | { | 994 | { |
1026 | .fromsec = { ALL_INIT_SECTIONS, NULL }, | 995 | .fromsec = { ALL_INIT_SECTIONS, NULL }, |
@@ -1089,8 +1058,6 @@ static const struct sectioncheck *section_mismatch( | |||
1089 | * Pattern 2: | 1058 | * Pattern 2: |
1090 | * Many drivers utilise a *driver container with references to | 1059 | * Many drivers utilise a *driver container with references to |
1091 | * add, remove, probe functions etc. | 1060 | * add, remove, probe functions etc. |
1092 | * These functions may often be marked __cpuinit and we do not want to | ||
1093 | * warn here. | ||
1094 | * the pattern is identified by: | 1061 | * the pattern is identified by: |
1095 | * tosec = init or exit section | 1062 | * tosec = init or exit section |
1096 | * fromsec = data section | 1063 | * fromsec = data section |
@@ -1249,7 +1216,6 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr, | |||
1249 | /* | 1216 | /* |
1250 | * Convert a section name to the function/data attribute | 1217 | * Convert a section name to the function/data attribute |
1251 | * .init.text => __init | 1218 | * .init.text => __init |
1252 | * .cpuinit.data => __cpudata | ||
1253 | * .memexitconst => __memconst | 1219 | * .memexitconst => __memconst |
1254 | * etc. | 1220 | * etc. |
1255 | * | 1221 | * |
diff --git a/scripts/package/mkspec b/scripts/package/mkspec index fbbfd08853d3..fdd3fbf4d4a4 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec | |||
@@ -74,6 +74,7 @@ echo "" | |||
74 | fi | 74 | fi |
75 | 75 | ||
76 | echo "%install" | 76 | echo "%install" |
77 | echo 'KBUILD_IMAGE=$(make image_name)' | ||
77 | echo "%ifarch ia64" | 78 | echo "%ifarch ia64" |
78 | echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules' | 79 | echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules' |
79 | echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware' | 80 | echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware' |
diff --git a/scripts/setlocalversion b/scripts/setlocalversion index 84b88f109b80..d105a44b68f6 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion | |||
@@ -71,9 +71,6 @@ scm_version() | |||
71 | printf -- '-svn%s' "`git svn find-rev $head`" | 71 | printf -- '-svn%s' "`git svn find-rev $head`" |
72 | fi | 72 | fi |
73 | 73 | ||
74 | # Update index only on r/w media | ||
75 | [ -w . ] && git update-index --refresh --unmerged > /dev/null | ||
76 | |||
77 | # Check for uncommitted changes | 74 | # Check for uncommitted changes |
78 | if git diff-index --name-only HEAD | grep -qv "^scripts/package"; then | 75 | if git diff-index --name-only HEAD | grep -qv "^scripts/package"; then |
79 | printf '%s' -dirty | 76 | printf '%s' -dirty |