diff options
author | James Morris <jmorris@namei.org> | 2009-09-29 17:47:33 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2009-09-29 17:47:33 -0400 |
commit | 1669b049db50fc7f1d4e694fb115a0f408c63fce (patch) | |
tree | 9b3b90b5cbff9b8f30ecf0b2a44896ce8bef0c20 /scripts | |
parent | 7f366784f5c2b8fc0658b5b374f4c63ee42c789f (diff) | |
parent | 17d857be649a21ca90008c6dc425d849fa83db5c (diff) |
Merge branch 'master' into next
Diffstat (limited to 'scripts')
36 files changed, 1113 insertions, 425 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index c29be8f90248..4f9c1908593b 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
@@ -83,11 +83,12 @@ TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/) | |||
83 | # is automatically cleaned up. | 83 | # is automatically cleaned up. |
84 | try-run = $(shell set -e; \ | 84 | try-run = $(shell set -e; \ |
85 | TMP="$(TMPOUT).$$$$.tmp"; \ | 85 | TMP="$(TMPOUT).$$$$.tmp"; \ |
86 | TMPO="$(TMPOUT).$$$$.o"; \ | ||
86 | if ($(1)) >/dev/null 2>&1; \ | 87 | if ($(1)) >/dev/null 2>&1; \ |
87 | then echo "$(2)"; \ | 88 | then echo "$(2)"; \ |
88 | else echo "$(3)"; \ | 89 | else echo "$(3)"; \ |
89 | fi; \ | 90 | fi; \ |
90 | rm -f "$$TMP") | 91 | rm -f "$$TMP" "$$TMPO") |
91 | 92 | ||
92 | # as-option | 93 | # as-option |
93 | # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,) | 94 | # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,) |
@@ -105,12 +106,12 @@ as-instr = $(call try-run,\ | |||
105 | # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) | 106 | # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) |
106 | 107 | ||
107 | cc-option = $(call try-run,\ | 108 | cc-option = $(call try-run,\ |
108 | $(CC) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",$(1),$(2)) | 109 | $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",$(1),$(2)) |
109 | 110 | ||
110 | # cc-option-yn | 111 | # cc-option-yn |
111 | # Usage: flag := $(call cc-option-yn,-march=winchip-c6) | 112 | # Usage: flag := $(call cc-option-yn,-march=winchip-c6) |
112 | cc-option-yn = $(call try-run,\ | 113 | cc-option-yn = $(call try-run,\ |
113 | $(CC) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",y,n) | 114 | $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",y,n) |
114 | 115 | ||
115 | # cc-option-align | 116 | # cc-option-align |
116 | # Prefix align with either -falign or -malign | 117 | # Prefix align with either -falign or -malign |
@@ -130,10 +131,15 @@ cc-fullversion = $(shell $(CONFIG_SHELL) \ | |||
130 | # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) | 131 | # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) |
131 | cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3)) | 132 | cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3)) |
132 | 133 | ||
134 | # cc-ldoption | ||
135 | # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both) | ||
136 | cc-ldoption = $(call try-run,\ | ||
137 | $(CC) $(1) -nostdlib -xc /dev/null -o "$$TMP",$(1),$(2)) | ||
138 | |||
133 | # ld-option | 139 | # ld-option |
134 | # Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both) | 140 | # Usage: LDFLAGS += $(call ld-option, -X) |
135 | ld-option = $(call try-run,\ | 141 | ld-option = $(call try-run,\ |
136 | $(CC) $(1) -nostdlib -xc /dev/null -o "$$TMP",$(1),$(2)) | 142 | $(CC) /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2)) |
137 | 143 | ||
138 | ###### | 144 | ###### |
139 | 145 | ||
diff --git a/scripts/Makefile b/scripts/Makefile index 9dd5b25a1d53..842dbc2d5aed 100644 --- a/scripts/Makefile +++ b/scripts/Makefile | |||
@@ -10,7 +10,6 @@ | |||
10 | hostprogs-$(CONFIG_KALLSYMS) += kallsyms | 10 | hostprogs-$(CONFIG_KALLSYMS) += kallsyms |
11 | hostprogs-$(CONFIG_LOGO) += pnmtologo | 11 | hostprogs-$(CONFIG_LOGO) += pnmtologo |
12 | hostprogs-$(CONFIG_VT) += conmakehash | 12 | hostprogs-$(CONFIG_VT) += conmakehash |
13 | hostprogs-$(CONFIG_PROM_CONSOLE) += conmakehash | ||
14 | hostprogs-$(CONFIG_IKCONFIG) += bin2c | 13 | hostprogs-$(CONFIG_IKCONFIG) += bin2c |
15 | 14 | ||
16 | always := $(hostprogs-y) $(hostprogs-m) | 15 | always := $(hostprogs-y) $(hostprogs-m) |
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 5c4b7a400c18..341b58902ffc 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
@@ -206,7 +206,7 @@ cmd_modversions = \ | |||
206 | endif | 206 | endif |
207 | 207 | ||
208 | ifdef CONFIG_FTRACE_MCOUNT_RECORD | 208 | ifdef CONFIG_FTRACE_MCOUNT_RECORD |
209 | cmd_record_mcount = perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ | 209 | cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ |
210 | "$(if $(CONFIG_64BIT),64,32)" \ | 210 | "$(if $(CONFIG_64BIT),64,32)" \ |
211 | "$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" "$(NM)" "$(RM)" "$(MV)" \ | 211 | "$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" "$(NM)" "$(RM)" "$(MV)" \ |
212 | "$(if $(part-of-module),1,0)" "$(@)"; | 212 | "$(if $(part-of-module),1,0)" "$(@)"; |
@@ -216,6 +216,7 @@ define rule_cc_o_c | |||
216 | $(call echo-cmd,checksrc) $(cmd_checksrc) \ | 216 | $(call echo-cmd,checksrc) $(cmd_checksrc) \ |
217 | $(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \ | 217 | $(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \ |
218 | $(cmd_modversions) \ | 218 | $(cmd_modversions) \ |
219 | $(call echo-cmd,record_mcount) \ | ||
219 | $(cmd_record_mcount) \ | 220 | $(cmd_record_mcount) \ |
220 | scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \ | 221 | scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \ |
221 | $(dot-target).tmp; \ | 222 | $(dot-target).tmp; \ |
@@ -269,7 +270,8 @@ targets += $(extra-y) $(MAKECMDGOALS) $(always) | |||
269 | # Linker scripts preprocessor (.lds.S -> .lds) | 270 | # Linker scripts preprocessor (.lds.S -> .lds) |
270 | # --------------------------------------------------------------------------- | 271 | # --------------------------------------------------------------------------- |
271 | quiet_cmd_cpp_lds_S = LDS $@ | 272 | quiet_cmd_cpp_lds_S = LDS $@ |
272 | cmd_cpp_lds_S = $(CPP) $(cpp_flags) -D__ASSEMBLY__ -o $@ $< | 273 | cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -C -U$(ARCH) \ |
274 | -D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $< | ||
273 | 275 | ||
274 | $(obj)/%.lds: $(src)/%.lds.S FORCE | 276 | $(obj)/%.lds: $(src)/%.lds.S FORCE |
275 | $(call if_changed_dep,cpp_lds_S) | 277 | $(call if_changed_dep,cpp_lds_S) |
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index f4053dc7b5d6..8f14c81abbc7 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost | |||
@@ -13,7 +13,6 @@ | |||
13 | # 2) modpost is then used to | 13 | # 2) modpost is then used to |
14 | # 3) create one <module>.mod.c file pr. module | 14 | # 3) create one <module>.mod.c file pr. module |
15 | # 4) create one Module.symvers file with CRC for all exported symbols | 15 | # 4) create one Module.symvers file with CRC for all exported symbols |
16 | # 4a) [CONFIG_MARKERS] create one Module.markers file listing defined markers | ||
17 | # 5) compile all <module>.mod.c files | 16 | # 5) compile all <module>.mod.c files |
18 | # 6) final link of the module to a <module.ko> file | 17 | # 6) final link of the module to a <module.ko> file |
19 | 18 | ||
@@ -59,10 +58,6 @@ include scripts/Makefile.lib | |||
59 | 58 | ||
60 | kernelsymfile := $(objtree)/Module.symvers | 59 | kernelsymfile := $(objtree)/Module.symvers |
61 | modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers | 60 | modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers |
62 | kernelmarkersfile := $(objtree)/Module.markers | ||
63 | modulemarkersfile := $(firstword $(KBUILD_EXTMOD))/Module.markers | ||
64 | |||
65 | markersfile = $(if $(KBUILD_EXTMOD),$(modulemarkersfile),$(kernelmarkersfile)) | ||
66 | 61 | ||
67 | # Step 1), find all modules listed in $(MODVERDIR)/ | 62 | # Step 1), find all modules listed in $(MODVERDIR)/ |
68 | __modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) | 63 | __modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) |
@@ -85,8 +80,6 @@ modpost = scripts/mod/modpost \ | |||
85 | $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \ | 80 | $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \ |
86 | $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ | 81 | $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ |
87 | $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ | 82 | $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ |
88 | $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \ | ||
89 | $(if $(CONFIG_MARKERS),-M $(markersfile)) \ | ||
90 | $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \ | 83 | $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \ |
91 | $(if $(cross_build),-c) | 84 | $(if $(cross_build),-c) |
92 | 85 | ||
@@ -101,17 +94,12 @@ quiet_cmd_kernel-mod = MODPOST $@ | |||
101 | cmd_kernel-mod = $(modpost) $@ | 94 | cmd_kernel-mod = $(modpost) $@ |
102 | 95 | ||
103 | vmlinux.o: FORCE | 96 | vmlinux.o: FORCE |
104 | @rm -fr $(kernelmarkersfile) | ||
105 | $(call cmd,kernel-mod) | 97 | $(call cmd,kernel-mod) |
106 | 98 | ||
107 | # Declare generated files as targets for modpost | 99 | # Declare generated files as targets for modpost |
108 | $(symverfile): __modpost ; | 100 | $(symverfile): __modpost ; |
109 | $(modules:.ko=.mod.c): __modpost ; | 101 | $(modules:.ko=.mod.c): __modpost ; |
110 | 102 | ||
111 | ifdef CONFIG_MARKERS | ||
112 | $(markersfile): __modpost ; | ||
113 | endif | ||
114 | |||
115 | 103 | ||
116 | # Step 5), compile all *.mod.c files | 104 | # Step 5), compile all *.mod.c files |
117 | 105 | ||
diff --git a/scripts/basic/docproc.c b/scripts/basic/docproc.c index 99ca7a698687..79ab973fb43a 100644 --- a/scripts/basic/docproc.c +++ b/scripts/basic/docproc.c | |||
@@ -71,7 +71,7 @@ FILELINE * docsection; | |||
71 | 71 | ||
72 | static char *srctree, *kernsrctree; | 72 | static char *srctree, *kernsrctree; |
73 | 73 | ||
74 | void usage (void) | 74 | static void usage (void) |
75 | { | 75 | { |
76 | fprintf(stderr, "Usage: docproc {doc|depend} file\n"); | 76 | fprintf(stderr, "Usage: docproc {doc|depend} file\n"); |
77 | fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n"); | 77 | fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n"); |
@@ -84,7 +84,7 @@ void usage (void) | |||
84 | /* | 84 | /* |
85 | * Execute kernel-doc with parameters given in svec | 85 | * Execute kernel-doc with parameters given in svec |
86 | */ | 86 | */ |
87 | void exec_kernel_doc(char **svec) | 87 | static void exec_kernel_doc(char **svec) |
88 | { | 88 | { |
89 | pid_t pid; | 89 | pid_t pid; |
90 | int ret; | 90 | int ret; |
@@ -129,7 +129,7 @@ struct symfile | |||
129 | struct symfile symfilelist[MAXFILES]; | 129 | struct symfile symfilelist[MAXFILES]; |
130 | int symfilecnt = 0; | 130 | int symfilecnt = 0; |
131 | 131 | ||
132 | void add_new_symbol(struct symfile *sym, char * symname) | 132 | static void add_new_symbol(struct symfile *sym, char * symname) |
133 | { | 133 | { |
134 | sym->symbollist = | 134 | sym->symbollist = |
135 | realloc(sym->symbollist, (sym->symbolcnt + 1) * sizeof(char *)); | 135 | realloc(sym->symbollist, (sym->symbolcnt + 1) * sizeof(char *)); |
@@ -137,14 +137,14 @@ void add_new_symbol(struct symfile *sym, char * symname) | |||
137 | } | 137 | } |
138 | 138 | ||
139 | /* Add a filename to the list */ | 139 | /* Add a filename to the list */ |
140 | struct symfile * add_new_file(char * filename) | 140 | static struct symfile * add_new_file(char * filename) |
141 | { | 141 | { |
142 | symfilelist[symfilecnt++].filename = strdup(filename); | 142 | symfilelist[symfilecnt++].filename = strdup(filename); |
143 | return &symfilelist[symfilecnt - 1]; | 143 | return &symfilelist[symfilecnt - 1]; |
144 | } | 144 | } |
145 | 145 | ||
146 | /* Check if file already are present in the list */ | 146 | /* Check if file already are present in the list */ |
147 | struct symfile * filename_exist(char * filename) | 147 | static struct symfile * filename_exist(char * filename) |
148 | { | 148 | { |
149 | int i; | 149 | int i; |
150 | for (i=0; i < symfilecnt; i++) | 150 | for (i=0; i < symfilecnt; i++) |
@@ -157,20 +157,20 @@ struct symfile * filename_exist(char * filename) | |||
157 | * List all files referenced within the template file. | 157 | * List all files referenced within the template file. |
158 | * Files are separated by tabs. | 158 | * Files are separated by tabs. |
159 | */ | 159 | */ |
160 | void adddep(char * file) { printf("\t%s", file); } | 160 | static void adddep(char * file) { printf("\t%s", file); } |
161 | void adddep2(char * file, char * line) { line = line; adddep(file); } | 161 | static void adddep2(char * file, char * line) { line = line; adddep(file); } |
162 | void noaction(char * line) { line = line; } | 162 | static void noaction(char * line) { line = line; } |
163 | void noaction2(char * file, char * line) { file = file; line = line; } | 163 | static void noaction2(char * file, char * line) { file = file; line = line; } |
164 | 164 | ||
165 | /* Echo the line without further action */ | 165 | /* Echo the line without further action */ |
166 | void printline(char * line) { printf("%s", line); } | 166 | static void printline(char * line) { printf("%s", line); } |
167 | 167 | ||
168 | /* | 168 | /* |
169 | * Find all symbols in filename that are exported with EXPORT_SYMBOL & | 169 | * Find all symbols in filename that are exported with EXPORT_SYMBOL & |
170 | * EXPORT_SYMBOL_GPL (& EXPORT_SYMBOL_GPL_FUTURE implicitly). | 170 | * EXPORT_SYMBOL_GPL (& EXPORT_SYMBOL_GPL_FUTURE implicitly). |
171 | * All symbols located are stored in symfilelist. | 171 | * All symbols located are stored in symfilelist. |
172 | */ | 172 | */ |
173 | void find_export_symbols(char * filename) | 173 | static void find_export_symbols(char * filename) |
174 | { | 174 | { |
175 | FILE * fp; | 175 | FILE * fp; |
176 | struct symfile *sym; | 176 | struct symfile *sym; |
@@ -227,7 +227,7 @@ void find_export_symbols(char * filename) | |||
227 | * intfunc uses -nofunction | 227 | * intfunc uses -nofunction |
228 | * extfunc uses -function | 228 | * extfunc uses -function |
229 | */ | 229 | */ |
230 | void docfunctions(char * filename, char * type) | 230 | static void docfunctions(char * filename, char * type) |
231 | { | 231 | { |
232 | int i,j; | 232 | int i,j; |
233 | int symcnt = 0; | 233 | int symcnt = 0; |
@@ -258,15 +258,15 @@ void docfunctions(char * filename, char * type) | |||
258 | fflush(stdout); | 258 | fflush(stdout); |
259 | free(vec); | 259 | free(vec); |
260 | } | 260 | } |
261 | void intfunc(char * filename) { docfunctions(filename, NOFUNCTION); } | 261 | static void intfunc(char * filename) { docfunctions(filename, NOFUNCTION); } |
262 | void extfunc(char * filename) { docfunctions(filename, FUNCTION); } | 262 | static void extfunc(char * filename) { docfunctions(filename, FUNCTION); } |
263 | 263 | ||
264 | /* | 264 | /* |
265 | * Document specific function(s) in a file. | 265 | * Document specific function(s) in a file. |
266 | * Call kernel-doc with the following parameters: | 266 | * Call kernel-doc with the following parameters: |
267 | * kernel-doc -docbook -function function1 [-function function2] | 267 | * kernel-doc -docbook -function function1 [-function function2] |
268 | */ | 268 | */ |
269 | void singfunc(char * filename, char * line) | 269 | static void singfunc(char * filename, char * line) |
270 | { | 270 | { |
271 | char *vec[200]; /* Enough for specific functions */ | 271 | char *vec[200]; /* Enough for specific functions */ |
272 | int i, idx = 0; | 272 | int i, idx = 0; |
@@ -297,7 +297,7 @@ void singfunc(char * filename, char * line) | |||
297 | * Call kernel-doc with the following parameters: | 297 | * Call kernel-doc with the following parameters: |
298 | * kernel-doc -docbook -function "doc section" filename | 298 | * kernel-doc -docbook -function "doc section" filename |
299 | */ | 299 | */ |
300 | void docsect(char *filename, char *line) | 300 | static void docsect(char *filename, char *line) |
301 | { | 301 | { |
302 | char *vec[6]; /* kerneldoc -docbook -function "section" file NULL */ | 302 | char *vec[6]; /* kerneldoc -docbook -function "section" file NULL */ |
303 | char *s; | 303 | char *s; |
@@ -324,7 +324,7 @@ void docsect(char *filename, char *line) | |||
324 | * 5) Lines containing !P | 324 | * 5) Lines containing !P |
325 | * 6) Default lines - lines not matching the above | 325 | * 6) Default lines - lines not matching the above |
326 | */ | 326 | */ |
327 | void parse_file(FILE *infile) | 327 | static void parse_file(FILE *infile) |
328 | { | 328 | { |
329 | char line[MAXLINESZ]; | 329 | char line[MAXLINESZ]; |
330 | char * s; | 330 | char * s; |
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 72c15205bb2b..6bf21f83837d 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c | |||
@@ -16,8 +16,7 @@ | |||
16 | * tells make when to remake a file. | 16 | * tells make when to remake a file. |
17 | * | 17 | * |
18 | * To use this list as-is however has the drawback that virtually | 18 | * To use this list as-is however has the drawback that virtually |
19 | * every file in the kernel includes <linux/config.h> which then again | 19 | * every file in the kernel includes <linux/autoconf.h>. |
20 | * includes <linux/autoconf.h> | ||
21 | * | 20 | * |
22 | * If the user re-runs make *config, linux/autoconf.h will be | 21 | * If the user re-runs make *config, linux/autoconf.h will be |
23 | * regenerated. make notices that and will rebuild every file which | 22 | * regenerated. make notices that and will rebuild every file which |
@@ -125,8 +124,7 @@ char *target; | |||
125 | char *depfile; | 124 | char *depfile; |
126 | char *cmdline; | 125 | char *cmdline; |
127 | 126 | ||
128 | void usage(void) | 127 | static void usage(void) |
129 | |||
130 | { | 128 | { |
131 | fprintf(stderr, "Usage: fixdep <depfile> <target> <cmdline>\n"); | 129 | fprintf(stderr, "Usage: fixdep <depfile> <target> <cmdline>\n"); |
132 | exit(1); | 130 | exit(1); |
@@ -135,7 +133,7 @@ void usage(void) | |||
135 | /* | 133 | /* |
136 | * Print out the commandline prefixed with cmd_<target filename> := | 134 | * Print out the commandline prefixed with cmd_<target filename> := |
137 | */ | 135 | */ |
138 | void print_cmdline(void) | 136 | static void print_cmdline(void) |
139 | { | 137 | { |
140 | printf("cmd_%s := %s\n\n", target, cmdline); | 138 | printf("cmd_%s := %s\n\n", target, cmdline); |
141 | } | 139 | } |
@@ -148,7 +146,7 @@ int len_config = 0; | |||
148 | * Grow the configuration string to a desired length. | 146 | * Grow the configuration string to a desired length. |
149 | * Usually the first growth is plenty. | 147 | * Usually the first growth is plenty. |
150 | */ | 148 | */ |
151 | void grow_config(int len) | 149 | static void grow_config(int len) |
152 | { | 150 | { |
153 | while (len_config + len > size_config) { | 151 | while (len_config + len > size_config) { |
154 | if (size_config == 0) | 152 | if (size_config == 0) |
@@ -164,7 +162,7 @@ void grow_config(int len) | |||
164 | /* | 162 | /* |
165 | * Lookup a value in the configuration string. | 163 | * Lookup a value in the configuration string. |
166 | */ | 164 | */ |
167 | int is_defined_config(const char * name, int len) | 165 | static int is_defined_config(const char * name, int len) |
168 | { | 166 | { |
169 | const char * pconfig; | 167 | const char * pconfig; |
170 | const char * plast = str_config + len_config - len; | 168 | const char * plast = str_config + len_config - len; |
@@ -180,7 +178,7 @@ int is_defined_config(const char * name, int len) | |||
180 | /* | 178 | /* |
181 | * Add a new value to the configuration string. | 179 | * Add a new value to the configuration string. |
182 | */ | 180 | */ |
183 | void define_config(const char * name, int len) | 181 | static void define_config(const char * name, int len) |
184 | { | 182 | { |
185 | grow_config(len + 1); | 183 | grow_config(len + 1); |
186 | 184 | ||
@@ -192,7 +190,7 @@ void define_config(const char * name, int len) | |||
192 | /* | 190 | /* |
193 | * Clear the set of configuration strings. | 191 | * Clear the set of configuration strings. |
194 | */ | 192 | */ |
195 | void clear_config(void) | 193 | static void clear_config(void) |
196 | { | 194 | { |
197 | len_config = 0; | 195 | len_config = 0; |
198 | define_config("", 0); | 196 | define_config("", 0); |
@@ -201,7 +199,7 @@ void clear_config(void) | |||
201 | /* | 199 | /* |
202 | * Record the use of a CONFIG_* word. | 200 | * Record the use of a CONFIG_* word. |
203 | */ | 201 | */ |
204 | void use_config(char *m, int slen) | 202 | static void use_config(char *m, int slen) |
205 | { | 203 | { |
206 | char s[PATH_MAX]; | 204 | char s[PATH_MAX]; |
207 | char *p; | 205 | char *p; |
@@ -222,7 +220,7 @@ void use_config(char *m, int slen) | |||
222 | printf(" $(wildcard include/config/%s.h) \\\n", s); | 220 | printf(" $(wildcard include/config/%s.h) \\\n", s); |
223 | } | 221 | } |
224 | 222 | ||
225 | void parse_config_file(char *map, size_t len) | 223 | static void parse_config_file(char *map, size_t len) |
226 | { | 224 | { |
227 | int *end = (int *) (map + len); | 225 | int *end = (int *) (map + len); |
228 | /* start at +1, so that p can never be < map */ | 226 | /* start at +1, so that p can never be < map */ |
@@ -256,7 +254,7 @@ void parse_config_file(char *map, size_t len) | |||
256 | } | 254 | } |
257 | 255 | ||
258 | /* test is s ends in sub */ | 256 | /* test is s ends in sub */ |
259 | int strrcmp(char *s, char *sub) | 257 | static int strrcmp(char *s, char *sub) |
260 | { | 258 | { |
261 | int slen = strlen(s); | 259 | int slen = strlen(s); |
262 | int sublen = strlen(sub); | 260 | int sublen = strlen(sub); |
@@ -267,7 +265,7 @@ int strrcmp(char *s, char *sub) | |||
267 | return memcmp(s + slen - sublen, sub, sublen); | 265 | return memcmp(s + slen - sublen, sub, sublen); |
268 | } | 266 | } |
269 | 267 | ||
270 | void do_config_file(char *filename) | 268 | static void do_config_file(char *filename) |
271 | { | 269 | { |
272 | struct stat st; | 270 | struct stat st; |
273 | int fd; | 271 | int fd; |
@@ -298,7 +296,7 @@ void do_config_file(char *filename) | |||
298 | close(fd); | 296 | close(fd); |
299 | } | 297 | } |
300 | 298 | ||
301 | void parse_dep_file(void *map, size_t len) | 299 | static void parse_dep_file(void *map, size_t len) |
302 | { | 300 | { |
303 | char *m = map; | 301 | char *m = map; |
304 | char *end = m + len; | 302 | char *end = m + len; |
@@ -338,7 +336,7 @@ void parse_dep_file(void *map, size_t len) | |||
338 | printf("$(deps_%s):\n", target); | 336 | printf("$(deps_%s):\n", target); |
339 | } | 337 | } |
340 | 338 | ||
341 | void print_deps(void) | 339 | static void print_deps(void) |
342 | { | 340 | { |
343 | struct stat st; | 341 | struct stat st; |
344 | int fd; | 342 | int fd; |
@@ -370,7 +368,7 @@ void print_deps(void) | |||
370 | close(fd); | 368 | close(fd); |
371 | } | 369 | } |
372 | 370 | ||
373 | void traps(void) | 371 | static void traps(void) |
374 | { | 372 | { |
375 | static char test[] __attribute__((aligned(sizeof(int)))) = "CONF"; | 373 | static char test[] __attribute__((aligned(sizeof(int)))) = "CONF"; |
376 | int *p = (int *)test; | 374 | int *p = (int *)test; |
diff --git a/scripts/basic/hash.c b/scripts/basic/hash.c index 3299ad7fc8c0..2ef5d3f666b8 100644 --- a/scripts/basic/hash.c +++ b/scripts/basic/hash.c | |||
@@ -21,7 +21,7 @@ static void usage(void) | |||
21 | * http://www.cse.yorku.ca/~oz/hash.html | 21 | * http://www.cse.yorku.ca/~oz/hash.html |
22 | */ | 22 | */ |
23 | 23 | ||
24 | unsigned int djb2_hash(char *str) | 24 | static unsigned int djb2_hash(char *str) |
25 | { | 25 | { |
26 | unsigned long hash = 5381; | 26 | unsigned long hash = 5381; |
27 | int c; | 27 | int c; |
@@ -34,7 +34,7 @@ unsigned int djb2_hash(char *str) | |||
34 | return (unsigned int)(hash & ((1 << DYNAMIC_DEBUG_HASH_BITS) - 1)); | 34 | return (unsigned int)(hash & ((1 << DYNAMIC_DEBUG_HASH_BITS) - 1)); |
35 | } | 35 | } |
36 | 36 | ||
37 | unsigned int r5_hash(char *str) | 37 | static unsigned int r5_hash(char *str) |
38 | { | 38 | { |
39 | unsigned long hash = 0; | 39 | unsigned long hash = 0; |
40 | int c; | 40 | int c; |
diff --git a/scripts/checkincludes.pl b/scripts/checkincludes.pl index 8e6b716c191c..676ddc07d6fa 100755 --- a/scripts/checkincludes.pl +++ b/scripts/checkincludes.pl | |||
@@ -1,24 +1,85 @@ | |||
1 | #!/usr/bin/perl | 1 | #!/usr/bin/perl |
2 | # | 2 | # |
3 | # checkincludes: Find files included more than once in (other) files. | 3 | # checkincludes: find/remove files included more than once |
4 | # | ||
4 | # Copyright abandoned, 2000, Niels Kristian Bech Jensen <nkbj@image.dk>. | 5 | # Copyright abandoned, 2000, Niels Kristian Bech Jensen <nkbj@image.dk>. |
6 | # Copyright 2009 Luis R. Rodriguez <mcgrof@gmail.com> | ||
7 | # | ||
8 | # This script checks for duplicate includes. It also has support | ||
9 | # to remove them in place. Note that this will not take into | ||
10 | # consideration macros so you should run this only if you know | ||
11 | # you do have real dups and do not have them under #ifdef's. You | ||
12 | # could also just review the results. | ||
13 | |||
14 | sub usage { | ||
15 | print "Usage: checkincludes.pl [-r]\n"; | ||
16 | print "By default we just warn of duplicates\n"; | ||
17 | print "To remove duplicated includes in place use -r\n"; | ||
18 | exit 1; | ||
19 | } | ||
20 | |||
21 | my $remove = 0; | ||
22 | |||
23 | if ($#ARGV < 0) { | ||
24 | usage(); | ||
25 | } | ||
26 | |||
27 | if ($#ARGV >= 1) { | ||
28 | if ($ARGV[0] =~ /^-/) { | ||
29 | if ($ARGV[0] eq "-r") { | ||
30 | $remove = 1; | ||
31 | shift; | ||
32 | } else { | ||
33 | usage(); | ||
34 | } | ||
35 | } | ||
36 | } | ||
5 | 37 | ||
6 | foreach $file (@ARGV) { | 38 | foreach $file (@ARGV) { |
7 | open(FILE, $file) or die "Cannot open $file: $!.\n"; | 39 | open(FILE, $file) or die "Cannot open $file: $!.\n"; |
8 | 40 | ||
9 | my %includedfiles = (); | 41 | my %includedfiles = (); |
42 | my @file_lines = (); | ||
10 | 43 | ||
11 | while (<FILE>) { | 44 | while (<FILE>) { |
12 | if (m/^\s*#\s*include\s*[<"](\S*)[>"]/o) { | 45 | if (m/^\s*#\s*include\s*[<"](\S*)[>"]/o) { |
13 | ++$includedfiles{$1}; | 46 | ++$includedfiles{$1}; |
14 | } | 47 | } |
48 | push(@file_lines, $_); | ||
15 | } | 49 | } |
16 | 50 | ||
17 | foreach $filename (keys %includedfiles) { | 51 | close(FILE); |
18 | if ($includedfiles{$filename} > 1) { | 52 | |
19 | print "$file: $filename is included more than once.\n"; | 53 | if (!$remove) { |
54 | foreach $filename (keys %includedfiles) { | ||
55 | if ($includedfiles{$filename} > 1) { | ||
56 | print "$file: $filename is included more than once.\n"; | ||
57 | } | ||
20 | } | 58 | } |
59 | next; | ||
21 | } | 60 | } |
22 | 61 | ||
62 | open(FILE,">$file") || die("Cannot write to $file: $!"); | ||
63 | |||
64 | my $dups = 0; | ||
65 | foreach (@file_lines) { | ||
66 | if (m/^\s*#\s*include\s*[<"](\S*)[>"]/o) { | ||
67 | foreach $filename (keys %includedfiles) { | ||
68 | if ($1 eq $filename) { | ||
69 | if ($includedfiles{$filename} > 1) { | ||
70 | $includedfiles{$filename}--; | ||
71 | $dups++; | ||
72 | } else { | ||
73 | print FILE $_; | ||
74 | } | ||
75 | } | ||
76 | } | ||
77 | } else { | ||
78 | print FILE $_; | ||
79 | } | ||
80 | } | ||
81 | if ($dups > 0) { | ||
82 | print "$file: removed $dups duplicate includes\n"; | ||
83 | } | ||
23 | close(FILE); | 84 | close(FILE); |
24 | } | 85 | } |
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 2d5ece798c4c..87bbb8bce9bf 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -10,7 +10,7 @@ use strict; | |||
10 | my $P = $0; | 10 | my $P = $0; |
11 | $P =~ s@.*/@@g; | 11 | $P =~ s@.*/@@g; |
12 | 12 | ||
13 | my $V = '0.28'; | 13 | my $V = '0.29'; |
14 | 14 | ||
15 | use Getopt::Long qw(:config no_auto_abbrev); | 15 | use Getopt::Long qw(:config no_auto_abbrev); |
16 | 16 | ||
@@ -28,6 +28,41 @@ my $mailback = 0; | |||
28 | my $summary_file = 0; | 28 | my $summary_file = 0; |
29 | my $root; | 29 | my $root; |
30 | my %debug; | 30 | my %debug; |
31 | my $help = 0; | ||
32 | |||
33 | sub help { | ||
34 | my ($exitcode) = @_; | ||
35 | |||
36 | print << "EOM"; | ||
37 | Usage: $P [OPTION]... [FILE]... | ||
38 | Version: $V | ||
39 | |||
40 | Options: | ||
41 | -q, --quiet quiet | ||
42 | --no-tree run without a kernel tree | ||
43 | --no-signoff do not check for 'Signed-off-by' line | ||
44 | --patch treat FILE as patchfile (default) | ||
45 | --emacs emacs compile window format | ||
46 | --terse one line per report | ||
47 | -f, --file treat FILE as regular source file | ||
48 | --subjective, --strict enable more subjective tests | ||
49 | --root=PATH PATH to the kernel tree root | ||
50 | --no-summary suppress the per-file summary | ||
51 | --mailback only produce a report in case of warnings/errors | ||
52 | --summary-file include the filename in summary | ||
53 | --debug KEY=[0|1] turn on/off debugging of KEY, where KEY is one of | ||
54 | 'values', 'possible', 'type', and 'attr' (default | ||
55 | is all off) | ||
56 | --test-only=WORD report only warnings/errors containing WORD | ||
57 | literally | ||
58 | -h, --help, --version display this help and exit | ||
59 | |||
60 | When FILE is - read standard input. | ||
61 | EOM | ||
62 | |||
63 | exit($exitcode); | ||
64 | } | ||
65 | |||
31 | GetOptions( | 66 | GetOptions( |
32 | 'q|quiet+' => \$quiet, | 67 | 'q|quiet+' => \$quiet, |
33 | 'tree!' => \$tree, | 68 | 'tree!' => \$tree, |
@@ -35,7 +70,7 @@ GetOptions( | |||
35 | 'patch!' => \$chk_patch, | 70 | 'patch!' => \$chk_patch, |
36 | 'emacs!' => \$emacs, | 71 | 'emacs!' => \$emacs, |
37 | 'terse!' => \$terse, | 72 | 'terse!' => \$terse, |
38 | 'file!' => \$file, | 73 | 'f|file!' => \$file, |
39 | 'subjective!' => \$check, | 74 | 'subjective!' => \$check, |
40 | 'strict!' => \$check, | 75 | 'strict!' => \$check, |
41 | 'root=s' => \$root, | 76 | 'root=s' => \$root, |
@@ -45,22 +80,16 @@ GetOptions( | |||
45 | 80 | ||
46 | 'debug=s' => \%debug, | 81 | 'debug=s' => \%debug, |
47 | 'test-only=s' => \$tst_only, | 82 | 'test-only=s' => \$tst_only, |
48 | ) or exit; | 83 | 'h|help' => \$help, |
84 | 'version' => \$help | ||
85 | ) or help(1); | ||
86 | |||
87 | help(0) if ($help); | ||
49 | 88 | ||
50 | my $exit = 0; | 89 | my $exit = 0; |
51 | 90 | ||
52 | if ($#ARGV < 0) { | 91 | if ($#ARGV < 0) { |
53 | print "usage: $P [options] patchfile\n"; | 92 | print "$P: no input files\n"; |
54 | print "version: $V\n"; | ||
55 | print "options: -q => quiet\n"; | ||
56 | print " --no-tree => run without a kernel tree\n"; | ||
57 | print " --terse => one line per report\n"; | ||
58 | print " --emacs => emacs compile window format\n"; | ||
59 | print " --file => check a source file\n"; | ||
60 | print " --strict => enable more subjective tests\n"; | ||
61 | print " --root => path to the kernel tree root\n"; | ||
62 | print " --no-summary => suppress the per-file summary\n"; | ||
63 | print " --summary-file => include the filename in summary\n"; | ||
64 | exit(1); | 93 | exit(1); |
65 | } | 94 | } |
66 | 95 | ||
@@ -153,7 +182,7 @@ our $UTF8 = qr { | |||
153 | }x; | 182 | }x; |
154 | 183 | ||
155 | our $typeTypedefs = qr{(?x: | 184 | our $typeTypedefs = qr{(?x: |
156 | (?:__)?(?:u|s|be|le)(?:\d|\d\d)| | 185 | (?:__)?(?:u|s|be|le)(?:8|16|32|64)| |
157 | atomic_t | 186 | atomic_t |
158 | )}; | 187 | )}; |
159 | 188 | ||
@@ -356,6 +385,13 @@ sub sanitise_line { | |||
356 | $off++; | 385 | $off++; |
357 | next; | 386 | next; |
358 | } | 387 | } |
388 | if ($sanitise_quote eq '' && substr($line, $off, 2) eq '//') { | ||
389 | $sanitise_quote = '//'; | ||
390 | |||
391 | substr($res, $off, 2, $sanitise_quote); | ||
392 | $off++; | ||
393 | next; | ||
394 | } | ||
359 | 395 | ||
360 | # A \ in a string means ignore the next character. | 396 | # A \ in a string means ignore the next character. |
361 | if (($sanitise_quote eq "'" || $sanitise_quote eq '"') && | 397 | if (($sanitise_quote eq "'" || $sanitise_quote eq '"') && |
@@ -379,6 +415,8 @@ sub sanitise_line { | |||
379 | #print "c<$c> SQ<$sanitise_quote>\n"; | 415 | #print "c<$c> SQ<$sanitise_quote>\n"; |
380 | if ($off != 0 && $sanitise_quote eq '*/' && $c ne "\t") { | 416 | if ($off != 0 && $sanitise_quote eq '*/' && $c ne "\t") { |
381 | substr($res, $off, 1, $;); | 417 | substr($res, $off, 1, $;); |
418 | } elsif ($off != 0 && $sanitise_quote eq '//' && $c ne "\t") { | ||
419 | substr($res, $off, 1, $;); | ||
382 | } elsif ($off != 0 && $sanitise_quote && $c ne "\t") { | 420 | } elsif ($off != 0 && $sanitise_quote && $c ne "\t") { |
383 | substr($res, $off, 1, 'X'); | 421 | substr($res, $off, 1, 'X'); |
384 | } else { | 422 | } else { |
@@ -386,6 +424,10 @@ sub sanitise_line { | |||
386 | } | 424 | } |
387 | } | 425 | } |
388 | 426 | ||
427 | if ($sanitise_quote eq '//') { | ||
428 | $sanitise_quote = ''; | ||
429 | } | ||
430 | |||
389 | # The pathname on a #include may be surrounded by '<' and '>'. | 431 | # The pathname on a #include may be surrounded by '<' and '>'. |
390 | if ($res =~ /^.\s*\#\s*include\s+\<(.*)\>/) { | 432 | if ($res =~ /^.\s*\#\s*include\s+\<(.*)\>/) { |
391 | my $clean = 'X' x length($1); | 433 | my $clean = 'X' x length($1); |
@@ -1336,6 +1378,18 @@ sub process { | |||
1336 | WARN("adding a line without newline at end of file\n" . $herecurr); | 1378 | WARN("adding a line without newline at end of file\n" . $herecurr); |
1337 | } | 1379 | } |
1338 | 1380 | ||
1381 | # Blackfin: use hi/lo macros | ||
1382 | if ($realfile =~ m@arch/blackfin/.*\.S$@) { | ||
1383 | if ($line =~ /\.[lL][[:space:]]*=.*&[[:space:]]*0x[fF][fF][fF][fF]/) { | ||
1384 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | ||
1385 | ERROR("use the LO() macro, not (... & 0xFFFF)\n" . $herevet); | ||
1386 | } | ||
1387 | if ($line =~ /\.[hH][[:space:]]*=.*>>[[:space:]]*16/) { | ||
1388 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | ||
1389 | ERROR("use the HI() macro, not (... >> 16)\n" . $herevet); | ||
1390 | } | ||
1391 | } | ||
1392 | |||
1339 | # check we are in a valid source file C or perl if not then ignore this hunk | 1393 | # check we are in a valid source file C or perl if not then ignore this hunk |
1340 | next if ($realfile !~ /\.(h|c|pl)$/); | 1394 | next if ($realfile !~ /\.(h|c|pl)$/); |
1341 | 1395 | ||
@@ -1355,6 +1409,16 @@ sub process { | |||
1355 | WARN("CVS style keyword markers, these will _not_ be updated\n". $herecurr); | 1409 | WARN("CVS style keyword markers, these will _not_ be updated\n". $herecurr); |
1356 | } | 1410 | } |
1357 | 1411 | ||
1412 | # Blackfin: don't use __builtin_bfin_[cs]sync | ||
1413 | if ($line =~ /__builtin_bfin_csync/) { | ||
1414 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | ||
1415 | ERROR("use the CSYNC() macro in asm/blackfin.h\n" . $herevet); | ||
1416 | } | ||
1417 | if ($line =~ /__builtin_bfin_ssync/) { | ||
1418 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | ||
1419 | ERROR("use the SSYNC() macro in asm/blackfin.h\n" . $herevet); | ||
1420 | } | ||
1421 | |||
1358 | # Check for potential 'bare' types | 1422 | # Check for potential 'bare' types |
1359 | my ($stat, $cond, $line_nr_next, $remain_next, $off_next); | 1423 | my ($stat, $cond, $line_nr_next, $remain_next, $off_next); |
1360 | if ($realcnt && $line =~ /.\s*\S/) { | 1424 | if ($realcnt && $line =~ /.\s*\S/) { |
@@ -1372,6 +1436,8 @@ sub process { | |||
1372 | # Ignore functions being called | 1436 | # Ignore functions being called |
1373 | } elsif ($s =~ /^.\s*$Ident\s*\(/s) { | 1437 | } elsif ($s =~ /^.\s*$Ident\s*\(/s) { |
1374 | 1438 | ||
1439 | } elsif ($s =~ /^.\s*else\b/s) { | ||
1440 | |||
1375 | # declarations always start with types | 1441 | # declarations always start with types |
1376 | } elsif ($prev_values eq 'E' && $s =~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?((?:\s*$Ident)+?)\b(?:\s+$Sparse)?\s*\**\s*(?:$Ident|\(\*[^\)]*\))(?:\s*$Modifier)?\s*(?:;|=|,|\()/s) { | 1442 | } elsif ($prev_values eq 'E' && $s =~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?((?:\s*$Ident)+?)\b(?:\s+$Sparse)?\s*\**\s*(?:$Ident|\(\*[^\)]*\))(?:\s*$Modifier)?\s*(?:;|=|,|\()/s) { |
1377 | my $type = $1; | 1443 | my $type = $1; |
@@ -1532,8 +1598,9 @@ sub process { | |||
1532 | $s =~ /^\s*#\s*?/ || | 1598 | $s =~ /^\s*#\s*?/ || |
1533 | $s =~ /^\s*$Ident\s*:/) { | 1599 | $s =~ /^\s*$Ident\s*:/) { |
1534 | $continuation = ($s =~ /^.*?\\\n/) ? 1 : 0; | 1600 | $continuation = ($s =~ /^.*?\\\n/) ? 1 : 0; |
1535 | $s =~ s/^.*?\n//; | 1601 | if ($s =~ s/^.*?\n//) { |
1536 | $cond_lines++; | 1602 | $cond_lines++; |
1603 | } | ||
1537 | } | 1604 | } |
1538 | } | 1605 | } |
1539 | 1606 | ||
@@ -1891,7 +1958,7 @@ sub process { | |||
1891 | # A unary '*' may be const | 1958 | # A unary '*' may be const |
1892 | 1959 | ||
1893 | } elsif ($ctx =~ /.xW/) { | 1960 | } elsif ($ctx =~ /.xW/) { |
1894 | ERROR("Aspace prohibited after that '$op' $at\n" . $hereptr); | 1961 | ERROR("space prohibited after that '$op' $at\n" . $hereptr); |
1895 | } | 1962 | } |
1896 | 1963 | ||
1897 | # unary ++ and unary -- are allowed no space on one side. | 1964 | # unary ++ and unary -- are allowed no space on one side. |
@@ -2243,7 +2310,8 @@ sub process { | |||
2243 | DECLARE_PER_CPU| | 2310 | DECLARE_PER_CPU| |
2244 | DEFINE_PER_CPU| | 2311 | DEFINE_PER_CPU| |
2245 | __typeof__\(| | 2312 | __typeof__\(| |
2246 | \.$Ident\s*=\s* | 2313 | \.$Ident\s*=\s*| |
2314 | ^\"|\"$ | ||
2247 | }x; | 2315 | }x; |
2248 | #print "REST<$rest> dstat<$dstat>\n"; | 2316 | #print "REST<$rest> dstat<$dstat>\n"; |
2249 | if ($rest ne '') { | 2317 | if ($rest ne '') { |
diff --git a/scripts/conmakehash.c b/scripts/conmakehash.c index e0c6891a9ad4..263a44d57fa9 100644 --- a/scripts/conmakehash.c +++ b/scripts/conmakehash.c | |||
@@ -24,14 +24,14 @@ | |||
24 | 24 | ||
25 | typedef unsigned short unicode; | 25 | typedef unsigned short unicode; |
26 | 26 | ||
27 | void usage(char *argv0) | 27 | static void usage(char *argv0) |
28 | { | 28 | { |
29 | fprintf(stderr, "Usage: \n" | 29 | fprintf(stderr, "Usage: \n" |
30 | " %s chartable [hashsize] [hashstep] [maxhashlevel]\n", argv0); | 30 | " %s chartable [hashsize] [hashstep] [maxhashlevel]\n", argv0); |
31 | exit(EX_USAGE); | 31 | exit(EX_USAGE); |
32 | } | 32 | } |
33 | 33 | ||
34 | int getunicode(char **p0) | 34 | static int getunicode(char **p0) |
35 | { | 35 | { |
36 | char *p = *p0; | 36 | char *p = *p0; |
37 | 37 | ||
@@ -49,7 +49,7 @@ unicode unitable[MAX_FONTLEN][255]; | |||
49 | /* Massive overkill, but who cares? */ | 49 | /* Massive overkill, but who cares? */ |
50 | int unicount[MAX_FONTLEN]; | 50 | int unicount[MAX_FONTLEN]; |
51 | 51 | ||
52 | void addpair(int fp, int un) | 52 | static void addpair(int fp, int un) |
53 | { | 53 | { |
54 | int i; | 54 | int i; |
55 | 55 | ||
diff --git a/scripts/extract-ikconfig b/scripts/extract-ikconfig index 72997c353cb3..de233ff43c1c 100755 --- a/scripts/extract-ikconfig +++ b/scripts/extract-ikconfig | |||
@@ -17,6 +17,10 @@ dump_config() { | |||
17 | return | 17 | return |
18 | fi | 18 | fi |
19 | end=`$binoffset $file $IKCFG_ED 2>/dev/null` | 19 | end=`$binoffset $file $IKCFG_ED 2>/dev/null` |
20 | [ "$?" != "0" ] && end="-1" | ||
21 | if [ "$end" -eq "-1" ]; then | ||
22 | return | ||
23 | fi | ||
20 | 24 | ||
21 | start=`expr $start + 8` | 25 | start=`expr $start + 8` |
22 | size=`expr $end - $start` | 26 | size=`expr $end - $start` |
@@ -55,6 +59,8 @@ dump_config "$image" | |||
55 | GZHDR1="0x1f 0x8b 0x08 0x00" | 59 | GZHDR1="0x1f 0x8b 0x08 0x00" |
56 | GZHDR2="0x1f 0x8b 0x08 0x08" | 60 | GZHDR2="0x1f 0x8b 0x08 0x08" |
57 | 61 | ||
62 | ELFHDR="0x7f 0x45 0x4c 0x46" | ||
63 | |||
58 | # vmlinux.gz: Check for a compressed images | 64 | # vmlinux.gz: Check for a compressed images |
59 | off=`$binoffset "$image" $GZHDR1 2>/dev/null` | 65 | off=`$binoffset "$image" $GZHDR1 2>/dev/null` |
60 | [ "$?" != "0" ] && off="-1" | 66 | [ "$?" != "0" ] && off="-1" |
@@ -69,6 +75,14 @@ elif [ "$off" -ne "-1" ]; then | |||
69 | (dd ibs="$off" skip=1 count=0 && dd bs=512k) <"$image" 2>/dev/null | \ | 75 | (dd ibs="$off" skip=1 count=0 && dd bs=512k) <"$image" 2>/dev/null | \ |
70 | zcat >"$TMPFILE" | 76 | zcat >"$TMPFILE" |
71 | dump_config "$TMPFILE" | 77 | dump_config "$TMPFILE" |
78 | |||
79 | # check if this is simply an ELF file | ||
80 | else | ||
81 | off=`$binoffset "$image" $ELFHDR 2>/dev/null` | ||
82 | [ "$?" != "0" ] && off="-1" | ||
83 | if [ "$off" -eq "0" ]; then | ||
84 | dump_config "$image" | ||
85 | fi | ||
72 | fi | 86 | fi |
73 | 87 | ||
74 | echo "ERROR: Unable to extract kernel configuration information." | 88 | echo "ERROR: Unable to extract kernel configuration information." |
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c index 3a8297b5184c..af6b8363a2d5 100644 --- a/scripts/genksyms/genksyms.c +++ b/scripts/genksyms/genksyms.c | |||
@@ -176,7 +176,7 @@ static int is_unknown_symbol(struct symbol *sym) | |||
176 | strcmp(defn->string, "{") == 0); | 176 | strcmp(defn->string, "{") == 0); |
177 | } | 177 | } |
178 | 178 | ||
179 | struct symbol *__add_symbol(const char *name, enum symbol_type type, | 179 | static struct symbol *__add_symbol(const char *name, enum symbol_type type, |
180 | struct string_list *defn, int is_extern, | 180 | struct string_list *defn, int is_extern, |
181 | int is_reference) | 181 | int is_reference) |
182 | { | 182 | { |
@@ -265,7 +265,7 @@ struct symbol *add_symbol(const char *name, enum symbol_type type, | |||
265 | return __add_symbol(name, type, defn, is_extern, 0); | 265 | return __add_symbol(name, type, defn, is_extern, 0); |
266 | } | 266 | } |
267 | 267 | ||
268 | struct symbol *add_reference_symbol(const char *name, enum symbol_type type, | 268 | static struct symbol *add_reference_symbol(const char *name, enum symbol_type type, |
269 | struct string_list *defn, int is_extern) | 269 | struct string_list *defn, int is_extern) |
270 | { | 270 | { |
271 | return __add_symbol(name, type, defn, is_extern, 1); | 271 | return __add_symbol(name, type, defn, is_extern, 1); |
@@ -313,7 +313,7 @@ static int equal_list(struct string_list *a, struct string_list *b) | |||
313 | 313 | ||
314 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) | 314 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) |
315 | 315 | ||
316 | struct string_list *read_node(FILE *f) | 316 | static struct string_list *read_node(FILE *f) |
317 | { | 317 | { |
318 | char buffer[256]; | 318 | char buffer[256]; |
319 | struct string_list node = { | 319 | struct string_list node = { |
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 278a45bd45a5..cdb44b63342e 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl | |||
@@ -13,7 +13,7 @@ | |||
13 | use strict; | 13 | use strict; |
14 | 14 | ||
15 | my $P = $0; | 15 | my $P = $0; |
16 | my $V = '0.17'; | 16 | my $V = '0.20'; |
17 | 17 | ||
18 | use Getopt::Long qw(:config no_auto_abbrev); | 18 | use Getopt::Long qw(:config no_auto_abbrev); |
19 | 19 | ||
@@ -29,6 +29,8 @@ my $email_git_min_signatures = 1; | |||
29 | my $email_git_max_maintainers = 5; | 29 | my $email_git_max_maintainers = 5; |
30 | my $email_git_min_percent = 5; | 30 | my $email_git_min_percent = 5; |
31 | my $email_git_since = "1-year-ago"; | 31 | my $email_git_since = "1-year-ago"; |
32 | my $email_git_blame = 0; | ||
33 | my $email_remove_duplicates = 1; | ||
32 | my $output_multiline = 1; | 34 | my $output_multiline = 1; |
33 | my $output_separator = ", "; | 35 | my $output_separator = ", "; |
34 | my $scm = 0; | 36 | my $scm = 0; |
@@ -36,6 +38,7 @@ my $web = 0; | |||
36 | my $subsystem = 0; | 38 | my $subsystem = 0; |
37 | my $status = 0; | 39 | my $status = 0; |
38 | my $from_filename = 0; | 40 | my $from_filename = 0; |
41 | my $pattern_depth = 0; | ||
39 | my $version = 0; | 42 | my $version = 0; |
40 | my $help = 0; | 43 | my $help = 0; |
41 | 44 | ||
@@ -68,6 +71,8 @@ if (!GetOptions( | |||
68 | 'git-max-maintainers=i' => \$email_git_max_maintainers, | 71 | 'git-max-maintainers=i' => \$email_git_max_maintainers, |
69 | 'git-min-percent=i' => \$email_git_min_percent, | 72 | 'git-min-percent=i' => \$email_git_min_percent, |
70 | 'git-since=s' => \$email_git_since, | 73 | 'git-since=s' => \$email_git_since, |
74 | 'git-blame!' => \$email_git_blame, | ||
75 | 'remove-duplicates!' => \$email_remove_duplicates, | ||
71 | 'm!' => \$email_maintainer, | 76 | 'm!' => \$email_maintainer, |
72 | 'n!' => \$email_usename, | 77 | 'n!' => \$email_usename, |
73 | 'l!' => \$email_list, | 78 | 'l!' => \$email_list, |
@@ -78,6 +83,7 @@ if (!GetOptions( | |||
78 | 'status!' => \$status, | 83 | 'status!' => \$status, |
79 | 'scm!' => \$scm, | 84 | 'scm!' => \$scm, |
80 | 'web!' => \$web, | 85 | 'web!' => \$web, |
86 | 'pattern-depth=i' => \$pattern_depth, | ||
81 | 'f|file' => \$from_filename, | 87 | 'f|file' => \$from_filename, |
82 | 'v|version' => \$version, | 88 | 'v|version' => \$version, |
83 | 'h|help' => \$help, | 89 | 'h|help' => \$help, |
@@ -101,14 +107,19 @@ if ($#ARGV < 0) { | |||
101 | die "$P: argument missing: patchfile or -f file please\n"; | 107 | die "$P: argument missing: patchfile or -f file please\n"; |
102 | } | 108 | } |
103 | 109 | ||
110 | if ($output_separator ne ", ") { | ||
111 | $output_multiline = 0; | ||
112 | } | ||
113 | |||
104 | my $selections = $email + $scm + $status + $subsystem + $web; | 114 | my $selections = $email + $scm + $status + $subsystem + $web; |
105 | if ($selections == 0) { | 115 | if ($selections == 0) { |
106 | usage(); | 116 | usage(); |
107 | die "$P: Missing required option: email, scm, status, subsystem or web\n"; | 117 | die "$P: Missing required option: email, scm, status, subsystem or web\n"; |
108 | } | 118 | } |
109 | 119 | ||
110 | if ($email && ($email_maintainer + $email_list + $email_subscriber_list | 120 | if ($email && |
111 | + $email_git + $email_git_penguin_chiefs) == 0) { | 121 | ($email_maintainer + $email_list + $email_subscriber_list + |
122 | $email_git + $email_git_penguin_chiefs + $email_git_blame) == 0) { | ||
112 | usage(); | 123 | usage(); |
113 | die "$P: Please select at least 1 email option\n"; | 124 | die "$P: Please select at least 1 email option\n"; |
114 | } | 125 | } |
@@ -147,9 +158,36 @@ while (<MAINT>) { | |||
147 | } | 158 | } |
148 | close(MAINT); | 159 | close(MAINT); |
149 | 160 | ||
161 | my %mailmap; | ||
162 | |||
163 | if ($email_remove_duplicates) { | ||
164 | open(MAILMAP, "<${lk_path}.mailmap") || warn "$P: Can't open .mailmap\n"; | ||
165 | while (<MAILMAP>) { | ||
166 | my $line = $_; | ||
167 | |||
168 | next if ($line =~ m/^\s*#/); | ||
169 | next if ($line =~ m/^\s*$/); | ||
170 | |||
171 | my ($name, $address) = parse_email($line); | ||
172 | $line = format_email($name, $address); | ||
173 | |||
174 | next if ($line =~ m/^\s*$/); | ||
175 | |||
176 | if (exists($mailmap{$name})) { | ||
177 | my $obj = $mailmap{$name}; | ||
178 | push(@$obj, $address); | ||
179 | } else { | ||
180 | my @arr = ($address); | ||
181 | $mailmap{$name} = \@arr; | ||
182 | } | ||
183 | } | ||
184 | close(MAILMAP); | ||
185 | } | ||
186 | |||
150 | ## use the filenames on the command line or find the filenames in the patchfiles | 187 | ## use the filenames on the command line or find the filenames in the patchfiles |
151 | 188 | ||
152 | my @files = (); | 189 | my @files = (); |
190 | my @range = (); | ||
153 | 191 | ||
154 | foreach my $file (@ARGV) { | 192 | foreach my $file (@ARGV) { |
155 | ##if $file is a directory and it lacks a trailing slash, add one | 193 | ##if $file is a directory and it lacks a trailing slash, add one |
@@ -162,13 +200,19 @@ foreach my $file (@ARGV) { | |||
162 | push(@files, $file); | 200 | push(@files, $file); |
163 | } else { | 201 | } else { |
164 | my $file_cnt = @files; | 202 | my $file_cnt = @files; |
203 | my $lastfile; | ||
165 | open(PATCH, "<$file") or die "$P: Can't open ${file}\n"; | 204 | open(PATCH, "<$file") or die "$P: Can't open ${file}\n"; |
166 | while (<PATCH>) { | 205 | while (<PATCH>) { |
167 | if (m/^\+\+\+\s+(\S+)/) { | 206 | if (m/^\+\+\+\s+(\S+)/) { |
168 | my $filename = $1; | 207 | my $filename = $1; |
169 | $filename =~ s@^[^/]*/@@; | 208 | $filename =~ s@^[^/]*/@@; |
170 | $filename =~ s@\n@@; | 209 | $filename =~ s@\n@@; |
210 | $lastfile = $filename; | ||
171 | push(@files, $filename); | 211 | push(@files, $filename); |
212 | } elsif (m/^\@\@ -(\d+),(\d+)/) { | ||
213 | if ($email_git_blame) { | ||
214 | push(@range, "$lastfile:$1:$2"); | ||
215 | } | ||
172 | } | 216 | } |
173 | } | 217 | } |
174 | close(PATCH); | 218 | close(PATCH); |
@@ -201,6 +245,7 @@ foreach my $file (@files) { | |||
201 | if ($type eq 'X') { | 245 | if ($type eq 'X') { |
202 | if (file_match_pattern($file, $value)) { | 246 | if (file_match_pattern($file, $value)) { |
203 | $exclude = 1; | 247 | $exclude = 1; |
248 | last; | ||
204 | } | 249 | } |
205 | } | 250 | } |
206 | } | 251 | } |
@@ -208,35 +253,45 @@ foreach my $file (@files) { | |||
208 | 253 | ||
209 | if (!$exclude) { | 254 | if (!$exclude) { |
210 | my $tvi = 0; | 255 | my $tvi = 0; |
256 | my %hash; | ||
211 | foreach my $line (@typevalue) { | 257 | foreach my $line (@typevalue) { |
212 | if ($line =~ m/^(\C):\s*(.*)/) { | 258 | if ($line =~ m/^(\C):\s*(.*)/) { |
213 | my $type = $1; | 259 | my $type = $1; |
214 | my $value = $2; | 260 | my $value = $2; |
215 | if ($type eq 'F') { | 261 | if ($type eq 'F') { |
216 | if (file_match_pattern($file, $value)) { | 262 | if (file_match_pattern($file, $value)) { |
217 | add_categories($tvi); | 263 | my $value_pd = ($value =~ tr@/@@); |
264 | my $file_pd = ($file =~ tr@/@@); | ||
265 | $value_pd++ if (substr($value,-1,1) ne "/"); | ||
266 | if ($pattern_depth == 0 || | ||
267 | (($file_pd - $value_pd) < $pattern_depth)) { | ||
268 | $hash{$tvi} = $value_pd; | ||
269 | } | ||
218 | } | 270 | } |
219 | } | 271 | } |
220 | } | 272 | } |
221 | $tvi++; | 273 | $tvi++; |
222 | } | 274 | } |
275 | foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { | ||
276 | add_categories($line); | ||
277 | } | ||
223 | } | 278 | } |
224 | 279 | ||
225 | if ($email && $email_git) { | 280 | if ($email && $email_git) { |
226 | recent_git_signoffs($file); | 281 | recent_git_signoffs($file); |
227 | } | 282 | } |
228 | 283 | ||
284 | if ($email && $email_git_blame) { | ||
285 | git_assign_blame($file); | ||
286 | } | ||
229 | } | 287 | } |
230 | 288 | ||
231 | if ($email) { | 289 | if ($email) { |
232 | foreach my $chief (@penguin_chief) { | 290 | foreach my $chief (@penguin_chief) { |
233 | if ($chief =~ m/^(.*):(.*)/) { | 291 | if ($chief =~ m/^(.*):(.*)/) { |
234 | my $email_address; | 292 | my $email_address; |
235 | if ($email_usename) { | 293 | |
236 | $email_address = format_email($1, $2); | 294 | $email_address = format_email($1, $2); |
237 | } else { | ||
238 | $email_address = $2; | ||
239 | } | ||
240 | if ($email_git_penguin_chiefs) { | 295 | if ($email_git_penguin_chiefs) { |
241 | push(@email_to, $email_address); | 296 | push(@email_to, $email_address); |
242 | } else { | 297 | } else { |
@@ -258,22 +313,22 @@ if ($email || $email_list) { | |||
258 | } | 313 | } |
259 | 314 | ||
260 | if ($scm) { | 315 | if ($scm) { |
261 | @scm = sort_and_uniq(@scm); | 316 | @scm = uniq(@scm); |
262 | output(@scm); | 317 | output(@scm); |
263 | } | 318 | } |
264 | 319 | ||
265 | if ($status) { | 320 | if ($status) { |
266 | @status = sort_and_uniq(@status); | 321 | @status = uniq(@status); |
267 | output(@status); | 322 | output(@status); |
268 | } | 323 | } |
269 | 324 | ||
270 | if ($subsystem) { | 325 | if ($subsystem) { |
271 | @subsystem = sort_and_uniq(@subsystem); | 326 | @subsystem = uniq(@subsystem); |
272 | output(@subsystem); | 327 | output(@subsystem); |
273 | } | 328 | } |
274 | 329 | ||
275 | if ($web) { | 330 | if ($web) { |
276 | @web = sort_and_uniq(@web); | 331 | @web = uniq(@web); |
277 | output(@web); | 332 | output(@web); |
278 | } | 333 | } |
279 | 334 | ||
@@ -311,10 +366,12 @@ MAINTAINER field selection options: | |||
311 | --git-max-maintainers => maximum maintainers to add (default: 5) | 366 | --git-max-maintainers => maximum maintainers to add (default: 5) |
312 | --git-min-percent => minimum percentage of commits required (default: 5) | 367 | --git-min-percent => minimum percentage of commits required (default: 5) |
313 | --git-since => git history to use (default: 1-year-ago) | 368 | --git-since => git history to use (default: 1-year-ago) |
369 | --git-blame => use git blame to find modified commits for patch or file | ||
314 | --m => include maintainer(s) if any | 370 | --m => include maintainer(s) if any |
315 | --n => include name 'Full Name <addr\@domain.tld>' | 371 | --n => include name 'Full Name <addr\@domain.tld>' |
316 | --l => include list(s) if any | 372 | --l => include list(s) if any |
317 | --s => include subscriber only list(s) if any | 373 | --s => include subscriber only list(s) if any |
374 | --remove-duplicates => minimize duplicate email names/addresses | ||
318 | --scm => print SCM tree(s) if any | 375 | --scm => print SCM tree(s) if any |
319 | --status => print status if any | 376 | --status => print status if any |
320 | --subsystem => print subsystem name if any | 377 | --subsystem => print subsystem name if any |
@@ -322,24 +379,28 @@ MAINTAINER field selection options: | |||
322 | 379 | ||
323 | Output type options: | 380 | Output type options: |
324 | --separator [, ] => separator for multiple entries on 1 line | 381 | --separator [, ] => separator for multiple entries on 1 line |
382 | using --separator also sets --nomultiline if --separator is not [, ] | ||
325 | --multiline => print 1 entry per line | 383 | --multiline => print 1 entry per line |
326 | 384 | ||
327 | Default options: | ||
328 | [--email --git --m --n --l --multiline] | ||
329 | |||
330 | Other options: | 385 | Other options: |
386 | --pattern-depth => Number of pattern directory traversals (default: 0 (all)) | ||
331 | --version => show version | 387 | --version => show version |
332 | --help => show this help information | 388 | --help => show this help information |
333 | 389 | ||
390 | Default options: | ||
391 | [--email --git --m --n --l --multiline --pattern-depth=0 --remove-duplicates] | ||
392 | |||
334 | Notes: | 393 | Notes: |
335 | Using "-f directory" may give unexpected results: | 394 | Using "-f directory" may give unexpected results: |
336 | 395 | Used with "--git", git signators for _all_ files in and below | |
337 | Used with "--git", git signators for _all_ files in and below | 396 | directory are examined as git recurses directories. |
338 | directory are examined as git recurses directories. | 397 | Any specified X: (exclude) pattern matches are _not_ ignored. |
339 | Any specified X: (exclude) pattern matches are _not_ ignored. | 398 | Used with "--nogit", directory is used as a pattern match, |
340 | Used with "--nogit", directory is used as a pattern match, | 399 | no individual file within the directory or subdirectory |
341 | no individual file within the directory or subdirectory | 400 | is matched. |
342 | is matched. | 401 | Used with "--git-blame", does not iterate all files in directory |
402 | Using "--git-blame" is slow and may add old committers and authors | ||
403 | that are no longer active maintainers to the output. | ||
343 | EOT | 404 | EOT |
344 | } | 405 | } |
345 | 406 | ||
@@ -370,30 +431,100 @@ sub top_of_kernel_tree { | |||
370 | return 0; | 431 | return 0; |
371 | } | 432 | } |
372 | 433 | ||
373 | sub format_email { | 434 | sub parse_email { |
374 | my ($name, $email) = @_; | 435 | my ($formatted_email) = @_; |
436 | |||
437 | my $name = ""; | ||
438 | my $address = ""; | ||
439 | |||
440 | if ($formatted_email =~ /^([^<]+)<(.+\@.*)>.*$/) { | ||
441 | $name = $1; | ||
442 | $address = $2; | ||
443 | } elsif ($formatted_email =~ /^\s*<(.+\@\S*)>.*$/) { | ||
444 | $address = $1; | ||
445 | } elsif ($formatted_email =~ /^(.+\@\S*).*$/) { | ||
446 | $address = $1; | ||
447 | } | ||
375 | 448 | ||
376 | $name =~ s/^\s+|\s+$//g; | 449 | $name =~ s/^\s+|\s+$//g; |
377 | $name =~ s/^\"|\"$//g; | 450 | $name =~ s/^\"|\"$//g; |
378 | $email =~ s/^\s+|\s+$//g; | 451 | $address =~ s/^\s+|\s+$//g; |
452 | |||
453 | if ($name =~ /[^a-z0-9 \.\-]/i) { ##has "must quote" chars | ||
454 | $name =~ s/(?<!\\)"/\\"/g; ##escape quotes | ||
455 | $name = "\"$name\""; | ||
456 | } | ||
457 | |||
458 | return ($name, $address); | ||
459 | } | ||
460 | |||
461 | sub format_email { | ||
462 | my ($name, $address) = @_; | ||
379 | 463 | ||
380 | my $formatted_email = ""; | 464 | my $formatted_email; |
465 | |||
466 | $name =~ s/^\s+|\s+$//g; | ||
467 | $name =~ s/^\"|\"$//g; | ||
468 | $address =~ s/^\s+|\s+$//g; | ||
381 | 469 | ||
382 | if ($name =~ /[^a-z0-9 \.\-]/i) { ##has "must quote" chars | 470 | if ($name =~ /[^a-z0-9 \.\-]/i) { ##has "must quote" chars |
383 | $name =~ s/(?<!\\)"/\\"/g; ##escape quotes | 471 | $name =~ s/(?<!\\)"/\\"/g; ##escape quotes |
384 | $formatted_email = "\"${name}\"\ \<${email}\>"; | 472 | $name = "\"$name\""; |
473 | } | ||
474 | |||
475 | if ($email_usename) { | ||
476 | if ("$name" eq "") { | ||
477 | $formatted_email = "$address"; | ||
478 | } else { | ||
479 | $formatted_email = "$name <${address}>"; | ||
480 | } | ||
385 | } else { | 481 | } else { |
386 | $formatted_email = "${name} \<${email}\>"; | 482 | $formatted_email = $address; |
387 | } | 483 | } |
484 | |||
388 | return $formatted_email; | 485 | return $formatted_email; |
389 | } | 486 | } |
390 | 487 | ||
391 | sub add_categories { | 488 | sub find_starting_index { |
489 | |||
392 | my ($index) = @_; | 490 | my ($index) = @_; |
393 | 491 | ||
394 | $index = $index - 1; | 492 | while ($index > 0) { |
395 | while ($index >= 0) { | ||
396 | my $tv = $typevalue[$index]; | 493 | my $tv = $typevalue[$index]; |
494 | if (!($tv =~ m/^(\C):\s*(.*)/)) { | ||
495 | last; | ||
496 | } | ||
497 | $index--; | ||
498 | } | ||
499 | |||
500 | return $index; | ||
501 | } | ||
502 | |||
503 | sub find_ending_index { | ||
504 | my ($index) = @_; | ||
505 | |||
506 | while ($index < @typevalue) { | ||
507 | my $tv = $typevalue[$index]; | ||
508 | if (!($tv =~ m/^(\C):\s*(.*)/)) { | ||
509 | last; | ||
510 | } | ||
511 | $index++; | ||
512 | } | ||
513 | |||
514 | return $index; | ||
515 | } | ||
516 | |||
517 | sub add_categories { | ||
518 | my ($index) = @_; | ||
519 | |||
520 | my $i; | ||
521 | my $start = find_starting_index($index); | ||
522 | my $end = find_ending_index($index); | ||
523 | |||
524 | push(@subsystem, $typevalue[$start]); | ||
525 | |||
526 | for ($i = $start + 1; $i < $end; $i++) { | ||
527 | my $tv = $typevalue[$i]; | ||
397 | if ($tv =~ m/^(\C):\s*(.*)/) { | 528 | if ($tv =~ m/^(\C):\s*(.*)/) { |
398 | my $ptype = $1; | 529 | my $ptype = $1; |
399 | my $pvalue = $2; | 530 | my $pvalue = $2; |
@@ -414,19 +545,19 @@ sub add_categories { | |||
414 | } | 545 | } |
415 | } | 546 | } |
416 | } elsif ($ptype eq "M") { | 547 | } elsif ($ptype eq "M") { |
417 | my $p_used = 0; | 548 | my ($name, $address) = parse_email($pvalue); |
418 | if ($index >= 0) { | 549 | if ($name eq "") { |
419 | my $tv = $typevalue[$index - 1]; | 550 | if ($i > 0) { |
420 | if ($tv =~ m/^(\C):\s*(.*)/) { | 551 | my $tv = $typevalue[$i - 1]; |
421 | if ($1 eq "P") { | 552 | if ($tv =~ m/^(\C):\s*(.*)/) { |
422 | if ($email_usename) { | 553 | if ($1 eq "P") { |
423 | push_email_address(format_email($2, $pvalue)); | 554 | $name = $2; |
424 | $p_used = 1; | 555 | $pvalue = format_email($name, $address); |
425 | } | 556 | } |
426 | } | 557 | } |
427 | } | 558 | } |
428 | } | 559 | } |
429 | if (!$p_used) { | 560 | if ($email_maintainer) { |
430 | push_email_addresses($pvalue); | 561 | push_email_addresses($pvalue); |
431 | } | 562 | } |
432 | } elsif ($ptype eq "T") { | 563 | } elsif ($ptype eq "T") { |
@@ -436,31 +567,41 @@ sub add_categories { | |||
436 | } elsif ($ptype eq "S") { | 567 | } elsif ($ptype eq "S") { |
437 | push(@status, $pvalue); | 568 | push(@status, $pvalue); |
438 | } | 569 | } |
439 | |||
440 | $index--; | ||
441 | } else { | ||
442 | push(@subsystem,$tv); | ||
443 | $index = -1; | ||
444 | } | 570 | } |
445 | } | 571 | } |
446 | } | 572 | } |
447 | 573 | ||
574 | my %email_hash_name; | ||
575 | my %email_hash_address; | ||
576 | |||
577 | sub email_inuse { | ||
578 | my ($name, $address) = @_; | ||
579 | |||
580 | return 1 if (($name eq "") && ($address eq "")); | ||
581 | return 1 if (($name ne "") && exists($email_hash_name{$name})); | ||
582 | return 1 if (($address ne "") && exists($email_hash_address{$address})); | ||
583 | |||
584 | return 0; | ||
585 | } | ||
586 | |||
448 | sub push_email_address { | 587 | sub push_email_address { |
449 | my ($email_address) = @_; | 588 | my ($line) = @_; |
589 | |||
590 | my ($name, $address) = parse_email($line); | ||
450 | 591 | ||
451 | my $email_name = ""; | 592 | if ($address eq "") { |
452 | if ($email_address =~ m/([^<]+)<(.*\@.*)>$/) { | 593 | return 0; |
453 | $email_name = $1; | ||
454 | $email_address = $2; | ||
455 | } | 594 | } |
456 | 595 | ||
457 | if ($email_maintainer) { | 596 | if (!$email_remove_duplicates) { |
458 | if ($email_usename && $email_name) { | 597 | push(@email_to, format_email($name, $address)); |
459 | push(@email_to, format_email($email_name, $email_address)); | 598 | } elsif (!email_inuse($name, $address)) { |
460 | } else { | 599 | push(@email_to, format_email($name, $address)); |
461 | push(@email_to, $email_address); | 600 | $email_hash_name{$name}++; |
462 | } | 601 | $email_hash_address{$address}++; |
463 | } | 602 | } |
603 | |||
604 | return 1; | ||
464 | } | 605 | } |
465 | 606 | ||
466 | sub push_email_addresses { | 607 | sub push_email_addresses { |
@@ -476,7 +617,9 @@ sub push_email_addresses { | |||
476 | push_email_address($entry); | 617 | push_email_address($entry); |
477 | } | 618 | } |
478 | } else { | 619 | } else { |
479 | warn("Invalid MAINTAINERS address: '" . $address . "'\n"); | 620 | if (!push_email_address($address)) { |
621 | warn("Invalid MAINTAINERS address: '" . $address . "'\n"); | ||
622 | } | ||
480 | } | 623 | } |
481 | } | 624 | } |
482 | 625 | ||
@@ -492,6 +635,32 @@ sub which { | |||
492 | return ""; | 635 | return ""; |
493 | } | 636 | } |
494 | 637 | ||
638 | sub mailmap { | ||
639 | my @lines = @_; | ||
640 | my %hash; | ||
641 | |||
642 | foreach my $line (@lines) { | ||
643 | my ($name, $address) = parse_email($line); | ||
644 | if (!exists($hash{$name})) { | ||
645 | $hash{$name} = $address; | ||
646 | } elsif ($address ne $hash{$name}) { | ||
647 | $address = $hash{$name}; | ||
648 | $line = format_email($name, $address); | ||
649 | } | ||
650 | if (exists($mailmap{$name})) { | ||
651 | my $obj = $mailmap{$name}; | ||
652 | foreach my $map_address (@$obj) { | ||
653 | if (($map_address eq $address) && | ||
654 | ($map_address ne $hash{$name})) { | ||
655 | $line = format_email($name, $hash{$name}); | ||
656 | } | ||
657 | } | ||
658 | } | ||
659 | } | ||
660 | |||
661 | return @lines; | ||
662 | } | ||
663 | |||
495 | sub recent_git_signoffs { | 664 | sub recent_git_signoffs { |
496 | my ($file) = @_; | 665 | my ($file) = @_; |
497 | 666 | ||
@@ -500,6 +669,7 @@ sub recent_git_signoffs { | |||
500 | my $output = ""; | 669 | my $output = ""; |
501 | my $count = 0; | 670 | my $count = 0; |
502 | my @lines = (); | 671 | my @lines = (); |
672 | my %hash; | ||
503 | my $total_sign_offs; | 673 | my $total_sign_offs; |
504 | 674 | ||
505 | if (which("git") eq "") { | 675 | if (which("git") eq "") { |
@@ -513,52 +683,119 @@ sub recent_git_signoffs { | |||
513 | } | 683 | } |
514 | 684 | ||
515 | $cmd = "git log --since=${email_git_since} -- ${file}"; | 685 | $cmd = "git log --since=${email_git_since} -- ${file}"; |
516 | $cmd .= " | grep -Ei \"^[-_ a-z]+by:.*\\\@.*\$\""; | ||
517 | if (!$email_git_penguin_chiefs) { | ||
518 | $cmd .= " | grep -Ev \"${penguin_chiefs}\""; | ||
519 | } | ||
520 | $cmd .= " | cut -f2- -d\":\""; | ||
521 | $cmd .= " | sort | uniq -c | sort -rn"; | ||
522 | 686 | ||
523 | $output = `${cmd}`; | 687 | $output = `${cmd}`; |
524 | $output =~ s/^\s*//gm; | 688 | $output =~ s/^\s*//gm; |
525 | 689 | ||
526 | @lines = split("\n", $output); | 690 | @lines = split("\n", $output); |
527 | 691 | ||
528 | $total_sign_offs = 0; | 692 | @lines = grep(/^[-_ a-z]+by:.*\@.*$/i, @lines); |
693 | if (!$email_git_penguin_chiefs) { | ||
694 | @lines = grep(!/${penguin_chiefs}/i, @lines); | ||
695 | } | ||
696 | # cut -f2- -d":" | ||
697 | s/.*:\s*(.+)\s*/$1/ for (@lines); | ||
698 | |||
699 | $total_sign_offs = @lines; | ||
700 | |||
701 | if ($email_remove_duplicates) { | ||
702 | @lines = mailmap(@lines); | ||
703 | } | ||
704 | |||
705 | @lines = sort(@lines); | ||
706 | |||
707 | # uniq -c | ||
708 | $hash{$_}++ for @lines; | ||
709 | |||
710 | # sort -rn | ||
711 | foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { | ||
712 | my $sign_offs = $hash{$line}; | ||
713 | $count++; | ||
714 | last if ($sign_offs < $email_git_min_signatures || | ||
715 | $count > $email_git_max_maintainers || | ||
716 | $sign_offs * 100 / $total_sign_offs < $email_git_min_percent); | ||
717 | push_email_address($line); | ||
718 | } | ||
719 | } | ||
720 | |||
721 | sub save_commits { | ||
722 | my ($cmd, @commits) = @_; | ||
723 | my $output; | ||
724 | my @lines = (); | ||
725 | |||
726 | $output = `${cmd}`; | ||
727 | |||
728 | @lines = split("\n", $output); | ||
529 | foreach my $line (@lines) { | 729 | foreach my $line (@lines) { |
530 | if ($line =~ m/([0-9]+)\s+(.*)/) { | 730 | if ($line =~ m/^(\w+) /) { |
531 | $total_sign_offs += $1; | 731 | push (@commits, $1); |
532 | } else { | ||
533 | die("$P: Unexpected git output: ${line}\n"); | ||
534 | } | 732 | } |
535 | } | 733 | } |
734 | return @commits; | ||
735 | } | ||
536 | 736 | ||
537 | foreach my $line (@lines) { | 737 | sub git_assign_blame { |
538 | if ($line =~ m/([0-9]+)\s+(.*)/) { | 738 | my ($file) = @_; |
539 | my $sign_offs = $1; | 739 | |
540 | $line = $2; | 740 | my @lines = (); |
541 | $count++; | 741 | my @commits = (); |
542 | if ($sign_offs < $email_git_min_signatures || | 742 | my $cmd; |
543 | $count > $email_git_max_maintainers || | 743 | my $output; |
544 | $sign_offs * 100 / $total_sign_offs < $email_git_min_percent) { | 744 | my %hash; |
545 | last; | 745 | my $total_sign_offs; |
546 | } | 746 | my $count; |
747 | |||
748 | if (@range) { | ||
749 | foreach my $file_range_diff (@range) { | ||
750 | next if (!($file_range_diff =~ m/(.+):(.+):(.+)/)); | ||
751 | my $diff_file = $1; | ||
752 | my $diff_start = $2; | ||
753 | my $diff_length = $3; | ||
754 | next if (!("$file" eq "$diff_file")); | ||
755 | $cmd = "git blame -l -L $diff_start,+$diff_length $file"; | ||
756 | @commits = save_commits($cmd, @commits); | ||
547 | } | 757 | } |
548 | if ($line =~ m/(.+)<(.+)>/) { | 758 | } else { |
549 | my $git_name = $1; | 759 | if (-f $file) { |
550 | my $git_addr = $2; | 760 | $cmd = "git blame -l $file"; |
551 | if ($email_usename) { | 761 | @commits = save_commits($cmd, @commits); |
552 | push(@email_to, format_email($git_name, $git_addr)); | 762 | } |
553 | } else { | 763 | } |
554 | push(@email_to, $git_addr); | 764 | |
555 | } | 765 | $total_sign_offs = 0; |
556 | } elsif ($line =~ m/<(.+)>/) { | 766 | @commits = uniq(@commits); |
557 | my $git_addr = $1; | 767 | foreach my $commit (@commits) { |
558 | push(@email_to, $git_addr); | 768 | $cmd = "git log -1 ${commit}"; |
559 | } else { | 769 | |
560 | push(@email_to, $line); | 770 | $output = `${cmd}`; |
771 | $output =~ s/^\s*//gm; | ||
772 | @lines = split("\n", $output); | ||
773 | |||
774 | @lines = grep(/^[-_ a-z]+by:.*\@.*$/i, @lines); | ||
775 | if (!$email_git_penguin_chiefs) { | ||
776 | @lines = grep(!/${penguin_chiefs}/i, @lines); | ||
777 | } | ||
778 | |||
779 | # cut -f2- -d":" | ||
780 | s/.*:\s*(.+)\s*/$1/ for (@lines); | ||
781 | |||
782 | $total_sign_offs += @lines; | ||
783 | |||
784 | if ($email_remove_duplicates) { | ||
785 | @lines = mailmap(@lines); | ||
561 | } | 786 | } |
787 | |||
788 | $hash{$_}++ for @lines; | ||
789 | } | ||
790 | |||
791 | $count = 0; | ||
792 | foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { | ||
793 | my $sign_offs = $hash{$line}; | ||
794 | $count++; | ||
795 | last if ($sign_offs < $email_git_min_signatures || | ||
796 | $count > $email_git_max_maintainers || | ||
797 | $sign_offs * 100 / $total_sign_offs < $email_git_min_percent); | ||
798 | push_email_address($line); | ||
562 | } | 799 | } |
563 | } | 800 | } |
564 | 801 | ||
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 64343cc084b4..86c3896a1e01 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c | |||
@@ -585,7 +585,7 @@ static int prefix_underscores_count(const char *str) | |||
585 | { | 585 | { |
586 | const char *tail = str; | 586 | const char *tail = str; |
587 | 587 | ||
588 | while (*tail != '_') | 588 | while (*tail == '_') |
589 | tail++; | 589 | tail++; |
590 | 590 | ||
591 | return tail - str; | 591 | return tail - str; |
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 5ddf8becd7a2..6d69c7ccdcc7 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
@@ -2,7 +2,8 @@ | |||
2 | # Kernel configuration targets | 2 | # Kernel configuration targets |
3 | # These targets are used from top-level makefile | 3 | # These targets are used from top-level makefile |
4 | 4 | ||
5 | PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config | 5 | PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config \ |
6 | localmodconfig localyesconfig | ||
6 | 7 | ||
7 | ifdef KBUILD_KCONFIG | 8 | ifdef KBUILD_KCONFIG |
8 | Kconfig := $(KBUILD_KCONFIG) | 9 | Kconfig := $(KBUILD_KCONFIG) |
@@ -28,6 +29,35 @@ oldconfig: $(obj)/conf | |||
28 | silentoldconfig: $(obj)/conf | 29 | silentoldconfig: $(obj)/conf |
29 | $< -s $(Kconfig) | 30 | $< -s $(Kconfig) |
30 | 31 | ||
32 | localmodconfig: $(obj)/streamline_config.pl $(obj)/conf | ||
33 | $(Q)perl $< $(Kconfig) > .tmp.config | ||
34 | $(Q)if [ -f .config ]; then \ | ||
35 | cmp -s .tmp.config .config || \ | ||
36 | (mv -f .config .config.old.1; \ | ||
37 | mv -f .tmp.config .config; \ | ||
38 | $(obj)/conf -s $(Kconfig); \ | ||
39 | mv -f .config.old.1 .config.old) \ | ||
40 | else \ | ||
41 | mv -f .tmp.config .config; \ | ||
42 | $(obj)/conf -s $(Kconfig); \ | ||
43 | fi | ||
44 | $(Q)rm -f .tmp.config | ||
45 | |||
46 | localyesconfig: $(obj)/streamline_config.pl $(obj)/conf | ||
47 | $(Q)perl $< $(Kconfig) > .tmp.config | ||
48 | $(Q)sed -i s/=m/=y/ .tmp.config | ||
49 | $(Q)if [ -f .config ]; then \ | ||
50 | cmp -s .tmp.config .config || \ | ||
51 | (mv -f .config .config.old.1; \ | ||
52 | mv -f .tmp.config .config; \ | ||
53 | $(obj)/conf -s $(Kconfig); \ | ||
54 | mv -f .config.old.1 .config.old) \ | ||
55 | else \ | ||
56 | mv -f .tmp.config .config; \ | ||
57 | $(obj)/conf -s $(Kconfig); \ | ||
58 | fi | ||
59 | $(Q)rm -f .tmp.config | ||
60 | |||
31 | # Create new linux.pot file | 61 | # Create new linux.pot file |
32 | # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files | 62 | # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files |
33 | # The symlink is used to repair a deficiency in arch/um | 63 | # The symlink is used to repair a deficiency in arch/um |
@@ -83,6 +113,8 @@ help: | |||
83 | @echo ' xconfig - Update current config utilising a QT based front-end' | 113 | @echo ' xconfig - Update current config utilising a QT based front-end' |
84 | @echo ' gconfig - Update current config utilising a GTK based front-end' | 114 | @echo ' gconfig - Update current config utilising a GTK based front-end' |
85 | @echo ' oldconfig - Update current config utilising a provided .config as base' | 115 | @echo ' oldconfig - Update current config utilising a provided .config as base' |
116 | @echo ' localmodconfig - Update current config disabling modules not loaded' | ||
117 | @echo ' localyesconfig - Update current config converting local mods to core' | ||
86 | @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps' | 118 | @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps' |
87 | @echo ' randconfig - New config with random answer to all options' | 119 | @echo ' randconfig - New config with random answer to all options' |
88 | @echo ' defconfig - New config with default answer to all options' | 120 | @echo ' defconfig - New config with default answer to all options' |
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 3baaaecd6b13..9960d1c303f8 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c | |||
@@ -38,14 +38,14 @@ static int conf_cnt; | |||
38 | static char line[128]; | 38 | static char line[128]; |
39 | static struct menu *rootEntry; | 39 | static struct menu *rootEntry; |
40 | 40 | ||
41 | static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n"); | 41 | static void print_help(struct menu *menu) |
42 | |||
43 | static const char *get_help(struct menu *menu) | ||
44 | { | 42 | { |
45 | if (menu_has_help(menu)) | 43 | struct gstr help = str_new(); |
46 | return _(menu_get_help(menu)); | 44 | |
47 | else | 45 | menu_get_ext_help(menu, &help); |
48 | return nohelp_text; | 46 | |
47 | printf("\n%s\n", str_get(&help)); | ||
48 | str_free(&help); | ||
49 | } | 49 | } |
50 | 50 | ||
51 | static void strip(char *str) | 51 | static void strip(char *str) |
@@ -121,7 +121,7 @@ static int conf_askvalue(struct symbol *sym, const char *def) | |||
121 | return 1; | 121 | return 1; |
122 | } | 122 | } |
123 | 123 | ||
124 | int conf_string(struct menu *menu) | 124 | static int conf_string(struct menu *menu) |
125 | { | 125 | { |
126 | struct symbol *sym = menu->sym; | 126 | struct symbol *sym = menu->sym; |
127 | const char *def; | 127 | const char *def; |
@@ -140,7 +140,7 @@ int conf_string(struct menu *menu) | |||
140 | case '?': | 140 | case '?': |
141 | /* print help */ | 141 | /* print help */ |
142 | if (line[1] == '\n') { | 142 | if (line[1] == '\n') { |
143 | printf("\n%s\n", get_help(menu)); | 143 | print_help(menu); |
144 | def = NULL; | 144 | def = NULL; |
145 | break; | 145 | break; |
146 | } | 146 | } |
@@ -220,7 +220,7 @@ static int conf_sym(struct menu *menu) | |||
220 | if (sym_set_tristate_value(sym, newval)) | 220 | if (sym_set_tristate_value(sym, newval)) |
221 | return 0; | 221 | return 0; |
222 | help: | 222 | help: |
223 | printf("\n%s\n", get_help(menu)); | 223 | print_help(menu); |
224 | } | 224 | } |
225 | } | 225 | } |
226 | 226 | ||
@@ -307,7 +307,7 @@ static int conf_choice(struct menu *menu) | |||
307 | fgets(line, 128, stdin); | 307 | fgets(line, 128, stdin); |
308 | strip(line); | 308 | strip(line); |
309 | if (line[0] == '?') { | 309 | if (line[0] == '?') { |
310 | printf("\n%s\n", get_help(menu)); | 310 | print_help(menu); |
311 | continue; | 311 | continue; |
312 | } | 312 | } |
313 | if (!line[0]) | 313 | if (!line[0]) |
@@ -331,7 +331,7 @@ static int conf_choice(struct menu *menu) | |||
331 | if (!child) | 331 | if (!child) |
332 | continue; | 332 | continue; |
333 | if (line[strlen(line) - 1] == '?') { | 333 | if (line[strlen(line) - 1] == '?') { |
334 | printf("\n%s\n", get_help(child)); | 334 | print_help(child); |
335 | continue; | 335 | continue; |
336 | } | 336 | } |
337 | sym_set_choice_value(sym, child->sym); | 337 | sym_set_choice_value(sym, child->sym); |
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index a04da3459f0f..b55e72ff2fc6 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
@@ -560,7 +560,7 @@ int conf_write(const char *name) | |||
560 | return 0; | 560 | return 0; |
561 | } | 561 | } |
562 | 562 | ||
563 | int conf_split_config(void) | 563 | static int conf_split_config(void) |
564 | { | 564 | { |
565 | const char *name; | 565 | const char *name; |
566 | char path[128]; | 566 | char path[128]; |
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index 579ece4fa584..edd3f39a080a 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c | |||
@@ -348,7 +348,7 @@ struct expr *expr_trans_bool(struct expr *e) | |||
348 | /* | 348 | /* |
349 | * e1 || e2 -> ? | 349 | * e1 || e2 -> ? |
350 | */ | 350 | */ |
351 | struct expr *expr_join_or(struct expr *e1, struct expr *e2) | 351 | static struct expr *expr_join_or(struct expr *e1, struct expr *e2) |
352 | { | 352 | { |
353 | struct expr *tmp; | 353 | struct expr *tmp; |
354 | struct symbol *sym1, *sym2; | 354 | struct symbol *sym1, *sym2; |
@@ -412,7 +412,7 @@ struct expr *expr_join_or(struct expr *e1, struct expr *e2) | |||
412 | return NULL; | 412 | return NULL; |
413 | } | 413 | } |
414 | 414 | ||
415 | struct expr *expr_join_and(struct expr *e1, struct expr *e2) | 415 | static struct expr *expr_join_and(struct expr *e1, struct expr *e2) |
416 | { | 416 | { |
417 | struct expr *tmp; | 417 | struct expr *tmp; |
418 | struct symbol *sym1, *sym2; | 418 | struct symbol *sym1, *sym2; |
@@ -1098,6 +1098,8 @@ void expr_fprint(struct expr *e, FILE *out) | |||
1098 | static void expr_print_gstr_helper(void *data, struct symbol *sym, const char *str) | 1098 | static void expr_print_gstr_helper(void *data, struct symbol *sym, const char *str) |
1099 | { | 1099 | { |
1100 | str_append((struct gstr*)data, str); | 1100 | str_append((struct gstr*)data, str); |
1101 | if (sym) | ||
1102 | str_printf((struct gstr*)data, " [=%s]", sym_get_string_value(sym)); | ||
1101 | } | 1103 | } |
1102 | 1104 | ||
1103 | void expr_gstr_print(struct expr *e, struct gstr *gs) | 1105 | void expr_gstr_print(struct expr *e, struct gstr *gs) |
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c index 199b22bb49e2..65464366fe38 100644 --- a/scripts/kconfig/gconf.c +++ b/scripts/kconfig/gconf.c | |||
@@ -456,19 +456,9 @@ static void text_insert_help(struct menu *menu) | |||
456 | GtkTextBuffer *buffer; | 456 | GtkTextBuffer *buffer; |
457 | GtkTextIter start, end; | 457 | GtkTextIter start, end; |
458 | const char *prompt = _(menu_get_prompt(menu)); | 458 | const char *prompt = _(menu_get_prompt(menu)); |
459 | gchar *name; | 459 | struct gstr help = str_new(); |
460 | const char *help; | ||
461 | 460 | ||
462 | help = menu_get_help(menu); | 461 | menu_get_ext_help(menu, &help); |
463 | |||
464 | /* Gettextize if the help text not empty */ | ||
465 | if ((help != 0) && (help[0] != 0)) | ||
466 | help = _(help); | ||
467 | |||
468 | if (menu->sym && menu->sym->name) | ||
469 | name = g_strdup_printf(menu->sym->name); | ||
470 | else | ||
471 | name = g_strdup(""); | ||
472 | 462 | ||
473 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); | 463 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); |
474 | gtk_text_buffer_get_bounds(buffer, &start, &end); | 464 | gtk_text_buffer_get_bounds(buffer, &start, &end); |
@@ -478,14 +468,11 @@ static void text_insert_help(struct menu *menu) | |||
478 | gtk_text_buffer_get_end_iter(buffer, &end); | 468 | gtk_text_buffer_get_end_iter(buffer, &end); |
479 | gtk_text_buffer_insert_with_tags(buffer, &end, prompt, -1, tag1, | 469 | gtk_text_buffer_insert_with_tags(buffer, &end, prompt, -1, tag1, |
480 | NULL); | 470 | NULL); |
481 | gtk_text_buffer_insert_at_cursor(buffer, " ", 1); | ||
482 | gtk_text_buffer_get_end_iter(buffer, &end); | ||
483 | gtk_text_buffer_insert_with_tags(buffer, &end, name, -1, tag1, | ||
484 | NULL); | ||
485 | gtk_text_buffer_insert_at_cursor(buffer, "\n\n", 2); | 471 | gtk_text_buffer_insert_at_cursor(buffer, "\n\n", 2); |
486 | gtk_text_buffer_get_end_iter(buffer, &end); | 472 | gtk_text_buffer_get_end_iter(buffer, &end); |
487 | gtk_text_buffer_insert_with_tags(buffer, &end, help, -1, tag2, | 473 | gtk_text_buffer_insert_with_tags(buffer, &end, str_get(&help), -1, tag2, |
488 | NULL); | 474 | NULL); |
475 | str_free(&help); | ||
489 | } | 476 | } |
490 | 477 | ||
491 | 478 | ||
diff --git a/scripts/kconfig/gconf.glade b/scripts/kconfig/gconf.glade index 803233fdd6dd..b1c86c19292c 100644 --- a/scripts/kconfig/gconf.glade +++ b/scripts/kconfig/gconf.glade | |||
@@ -547,7 +547,7 @@ | |||
547 | <property name="headers_visible">True</property> | 547 | <property name="headers_visible">True</property> |
548 | <property name="rules_hint">False</property> | 548 | <property name="rules_hint">False</property> |
549 | <property name="reorderable">False</property> | 549 | <property name="reorderable">False</property> |
550 | <property name="enable_search">True</property> | 550 | <property name="enable_search">False</property> |
551 | <signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:58:22 GMT"/> | 551 | <signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:58:22 GMT"/> |
552 | <signal name="button_press_event" handler="on_treeview1_button_press_event" last_modification_time="Sun, 12 Jan 2003 16:03:52 GMT"/> | 552 | <signal name="button_press_event" handler="on_treeview1_button_press_event" last_modification_time="Sun, 12 Jan 2003 16:03:52 GMT"/> |
553 | <signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 16:11:44 GMT"/> | 553 | <signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 16:11:44 GMT"/> |
@@ -582,7 +582,7 @@ | |||
582 | <property name="headers_visible">True</property> | 582 | <property name="headers_visible">True</property> |
583 | <property name="rules_hint">False</property> | 583 | <property name="rules_hint">False</property> |
584 | <property name="reorderable">False</property> | 584 | <property name="reorderable">False</property> |
585 | <property name="enable_search">True</property> | 585 | <property name="enable_search">False</property> |
586 | <signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:57:55 GMT"/> | 586 | <signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:57:55 GMT"/> |
587 | <signal name="button_press_event" handler="on_treeview2_button_press_event" last_modification_time="Sun, 12 Jan 2003 15:57:58 GMT"/> | 587 | <signal name="button_press_event" handler="on_treeview2_button_press_event" last_modification_time="Sun, 12 Jan 2003 15:57:58 GMT"/> |
588 | <signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 15:58:01 GMT"/> | 588 | <signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 15:58:01 GMT"/> |
diff --git a/scripts/kconfig/kxgettext.c b/scripts/kconfig/kxgettext.c index 8d9ce22b0fc5..dcc3fcc0cc9a 100644 --- a/scripts/kconfig/kxgettext.c +++ b/scripts/kconfig/kxgettext.c | |||
@@ -166,7 +166,7 @@ static int message__add(const char *msg, char *option, char *file, int lineno) | |||
166 | return rc; | 166 | return rc; |
167 | } | 167 | } |
168 | 168 | ||
169 | void menu_build_message_list(struct menu *menu) | 169 | static void menu_build_message_list(struct menu *menu) |
170 | { | 170 | { |
171 | struct menu *child; | 171 | struct menu *child; |
172 | 172 | ||
@@ -211,7 +211,7 @@ static void message__print_gettext_msgid_msgstr(struct message *self) | |||
211 | "msgstr \"\"\n", self->msg); | 211 | "msgstr \"\"\n", self->msg); |
212 | } | 212 | } |
213 | 213 | ||
214 | void menu__xgettext(void) | 214 | static void menu__xgettext(void) |
215 | { | 215 | { |
216 | struct message *m = message__list; | 216 | struct message *m = message__list; |
217 | 217 | ||
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index 8e69461313d1..ffeb532b2cff 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h | |||
@@ -17,6 +17,8 @@ P(menu_get_root_menu,struct menu *,(struct menu *menu)); | |||
17 | P(menu_get_parent_menu,struct menu *,(struct menu *menu)); | 17 | P(menu_get_parent_menu,struct menu *,(struct menu *menu)); |
18 | P(menu_has_help,bool,(struct menu *menu)); | 18 | P(menu_has_help,bool,(struct menu *menu)); |
19 | P(menu_get_help,const char *,(struct menu *menu)); | 19 | P(menu_get_help,const char *,(struct menu *menu)); |
20 | P(get_symbol_str,void,(struct gstr *r, struct symbol *sym)); | ||
21 | P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help)); | ||
20 | 22 | ||
21 | /* symbol.c */ | 23 | /* symbol.c */ |
22 | P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); | 24 | P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); |
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 25b60bc117f7..d82953573588 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
@@ -199,8 +199,6 @@ inputbox_instructions_string[] = N_( | |||
199 | setmod_text[] = N_( | 199 | setmod_text[] = N_( |
200 | "This feature depends on another which has been configured as a module.\n" | 200 | "This feature depends on another which has been configured as a module.\n" |
201 | "As a result, this feature will be built as a module."), | 201 | "As a result, this feature will be built as a module."), |
202 | nohelp_text[] = N_( | ||
203 | "There is no help available for this kernel option.\n"), | ||
204 | load_config_text[] = N_( | 202 | load_config_text[] = N_( |
205 | "Enter the name of the configuration file you wish to load. " | 203 | "Enter the name of the configuration file you wish to load. " |
206 | "Accept the name shown to restore the configuration you " | 204 | "Accept the name shown to restore the configuration you " |
@@ -284,66 +282,6 @@ static void show_textbox(const char *title, const char *text, int r, int c); | |||
284 | static void show_helptext(const char *title, const char *text); | 282 | static void show_helptext(const char *title, const char *text); |
285 | static void show_help(struct menu *menu); | 283 | static void show_help(struct menu *menu); |
286 | 284 | ||
287 | static void get_prompt_str(struct gstr *r, struct property *prop) | ||
288 | { | ||
289 | int i, j; | ||
290 | struct menu *submenu[8], *menu; | ||
291 | |||
292 | str_printf(r, _("Prompt: %s\n"), _(prop->text)); | ||
293 | str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name, | ||
294 | prop->menu->lineno); | ||
295 | if (!expr_is_yes(prop->visible.expr)) { | ||
296 | str_append(r, _(" Depends on: ")); | ||
297 | expr_gstr_print(prop->visible.expr, r); | ||
298 | str_append(r, "\n"); | ||
299 | } | ||
300 | menu = prop->menu->parent; | ||
301 | for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) | ||
302 | submenu[i++] = menu; | ||
303 | if (i > 0) { | ||
304 | str_printf(r, _(" Location:\n")); | ||
305 | for (j = 4; --i >= 0; j += 2) { | ||
306 | menu = submenu[i]; | ||
307 | str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu))); | ||
308 | if (menu->sym) { | ||
309 | str_printf(r, " (%s [=%s])", menu->sym->name ? | ||
310 | menu->sym->name : _("<choice>"), | ||
311 | sym_get_string_value(menu->sym)); | ||
312 | } | ||
313 | str_append(r, "\n"); | ||
314 | } | ||
315 | } | ||
316 | } | ||
317 | |||
318 | static void get_symbol_str(struct gstr *r, struct symbol *sym) | ||
319 | { | ||
320 | bool hit; | ||
321 | struct property *prop; | ||
322 | |||
323 | if (sym && sym->name) | ||
324 | str_printf(r, "Symbol: %s [=%s]\n", sym->name, | ||
325 | sym_get_string_value(sym)); | ||
326 | for_all_prompts(sym, prop) | ||
327 | get_prompt_str(r, prop); | ||
328 | hit = false; | ||
329 | for_all_properties(sym, prop, P_SELECT) { | ||
330 | if (!hit) { | ||
331 | str_append(r, " Selects: "); | ||
332 | hit = true; | ||
333 | } else | ||
334 | str_printf(r, " && "); | ||
335 | expr_gstr_print(prop->expr, r); | ||
336 | } | ||
337 | if (hit) | ||
338 | str_append(r, "\n"); | ||
339 | if (sym->rev_dep.expr) { | ||
340 | str_append(r, _(" Selected by: ")); | ||
341 | expr_gstr_print(sym->rev_dep.expr, r); | ||
342 | str_append(r, "\n"); | ||
343 | } | ||
344 | str_append(r, "\n\n"); | ||
345 | } | ||
346 | |||
347 | static struct gstr get_relations_str(struct symbol **sym_arr) | 285 | static struct gstr get_relations_str(struct symbol **sym_arr) |
348 | { | 286 | { |
349 | struct symbol *sym; | 287 | struct symbol *sym; |
@@ -699,19 +637,9 @@ static void show_helptext(const char *title, const char *text) | |||
699 | static void show_help(struct menu *menu) | 637 | static void show_help(struct menu *menu) |
700 | { | 638 | { |
701 | struct gstr help = str_new(); | 639 | struct gstr help = str_new(); |
702 | struct symbol *sym = menu->sym; | 640 | |
703 | 641 | menu_get_ext_help(menu, &help); | |
704 | if (menu_has_help(menu)) | 642 | |
705 | { | ||
706 | if (sym->name) { | ||
707 | str_printf(&help, "CONFIG_%s:\n\n", sym->name); | ||
708 | str_append(&help, _(menu_get_help(menu))); | ||
709 | str_append(&help, "\n"); | ||
710 | } | ||
711 | } else { | ||
712 | str_append(&help, nohelp_text); | ||
713 | } | ||
714 | get_symbol_str(&help, sym); | ||
715 | show_helptext(_(menu_get_prompt(menu)), str_get(&help)); | 643 | show_helptext(_(menu_get_prompt(menu)), str_get(&help)); |
716 | str_free(&help); | 644 | str_free(&help); |
717 | } | 645 | } |
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 07ff8d105c9d..059a2465c574 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c | |||
@@ -9,6 +9,9 @@ | |||
9 | #define LKC_DIRECT_LINK | 9 | #define LKC_DIRECT_LINK |
10 | #include "lkc.h" | 10 | #include "lkc.h" |
11 | 11 | ||
12 | static const char nohelp_text[] = N_( | ||
13 | "There is no help available for this kernel option.\n"); | ||
14 | |||
12 | struct menu rootmenu; | 15 | struct menu rootmenu; |
13 | static struct menu **last_entry_ptr; | 16 | static struct menu **last_entry_ptr; |
14 | 17 | ||
@@ -74,7 +77,7 @@ void menu_end_menu(void) | |||
74 | current_menu = current_menu->parent; | 77 | current_menu = current_menu->parent; |
75 | } | 78 | } |
76 | 79 | ||
77 | struct expr *menu_check_dep(struct expr *e) | 80 | static struct expr *menu_check_dep(struct expr *e) |
78 | { | 81 | { |
79 | if (!e) | 82 | if (!e) |
80 | return e; | 83 | return e; |
@@ -184,7 +187,7 @@ static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2) | |||
184 | (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name)); | 187 | (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name)); |
185 | } | 188 | } |
186 | 189 | ||
187 | void sym_check_prop(struct symbol *sym) | 190 | static void sym_check_prop(struct symbol *sym) |
188 | { | 191 | { |
189 | struct property *prop; | 192 | struct property *prop; |
190 | struct symbol *sym2; | 193 | struct symbol *sym2; |
@@ -451,3 +454,80 @@ const char *menu_get_help(struct menu *menu) | |||
451 | else | 454 | else |
452 | return ""; | 455 | return ""; |
453 | } | 456 | } |
457 | |||
458 | static void get_prompt_str(struct gstr *r, struct property *prop) | ||
459 | { | ||
460 | int i, j; | ||
461 | struct menu *submenu[8], *menu; | ||
462 | |||
463 | str_printf(r, _("Prompt: %s\n"), _(prop->text)); | ||
464 | str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name, | ||
465 | prop->menu->lineno); | ||
466 | if (!expr_is_yes(prop->visible.expr)) { | ||
467 | str_append(r, _(" Depends on: ")); | ||
468 | expr_gstr_print(prop->visible.expr, r); | ||
469 | str_append(r, "\n"); | ||
470 | } | ||
471 | menu = prop->menu->parent; | ||
472 | for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) | ||
473 | submenu[i++] = menu; | ||
474 | if (i > 0) { | ||
475 | str_printf(r, _(" Location:\n")); | ||
476 | for (j = 4; --i >= 0; j += 2) { | ||
477 | menu = submenu[i]; | ||
478 | str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu))); | ||
479 | if (menu->sym) { | ||
480 | str_printf(r, " (%s [=%s])", menu->sym->name ? | ||
481 | menu->sym->name : _("<choice>"), | ||
482 | sym_get_string_value(menu->sym)); | ||
483 | } | ||
484 | str_append(r, "\n"); | ||
485 | } | ||
486 | } | ||
487 | } | ||
488 | |||
489 | void get_symbol_str(struct gstr *r, struct symbol *sym) | ||
490 | { | ||
491 | bool hit; | ||
492 | struct property *prop; | ||
493 | |||
494 | if (sym && sym->name) | ||
495 | str_printf(r, "Symbol: %s [=%s]\n", sym->name, | ||
496 | sym_get_string_value(sym)); | ||
497 | for_all_prompts(sym, prop) | ||
498 | get_prompt_str(r, prop); | ||
499 | hit = false; | ||
500 | for_all_properties(sym, prop, P_SELECT) { | ||
501 | if (!hit) { | ||
502 | str_append(r, " Selects: "); | ||
503 | hit = true; | ||
504 | } else | ||
505 | str_printf(r, " && "); | ||
506 | expr_gstr_print(prop->expr, r); | ||
507 | } | ||
508 | if (hit) | ||
509 | str_append(r, "\n"); | ||
510 | if (sym->rev_dep.expr) { | ||
511 | str_append(r, _(" Selected by: ")); | ||
512 | expr_gstr_print(sym->rev_dep.expr, r); | ||
513 | str_append(r, "\n"); | ||
514 | } | ||
515 | str_append(r, "\n\n"); | ||
516 | } | ||
517 | |||
518 | void menu_get_ext_help(struct menu *menu, struct gstr *help) | ||
519 | { | ||
520 | struct symbol *sym = menu->sym; | ||
521 | |||
522 | if (menu_has_help(menu)) { | ||
523 | if (sym->name) { | ||
524 | str_printf(help, "CONFIG_%s:\n\n", sym->name); | ||
525 | str_append(help, _(menu_get_help(menu))); | ||
526 | str_append(help, "\n"); | ||
527 | } | ||
528 | } else { | ||
529 | str_append(help, nohelp_text); | ||
530 | } | ||
531 | if (sym) | ||
532 | get_symbol_str(help, sym); | ||
533 | } | ||
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index ce7d508c7520..00c51507cfcc 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc | |||
@@ -1042,12 +1042,10 @@ void ConfigInfoView::menuInfo(void) | |||
1042 | if (showDebug()) | 1042 | if (showDebug()) |
1043 | debug = debug_info(sym); | 1043 | debug = debug_info(sym); |
1044 | 1044 | ||
1045 | help = menu_get_help(menu); | 1045 | struct gstr help_gstr = str_new(); |
1046 | /* Gettextize if the help text not empty */ | 1046 | menu_get_ext_help(menu, &help_gstr); |
1047 | if (help.isEmpty()) | 1047 | help = print_filter(str_get(&help_gstr)); |
1048 | help = print_filter(menu_get_help(menu)); | 1048 | str_free(&help_gstr); |
1049 | else | ||
1050 | help = print_filter(_(menu_get_help(menu))); | ||
1051 | } else if (menu->prompt) { | 1049 | } else if (menu->prompt) { |
1052 | head += "<big><b>"; | 1050 | head += "<big><b>"; |
1053 | head += print_filter(_(menu->prompt->text)); | 1051 | head += print_filter(_(menu->prompt->text)); |
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl new file mode 100644 index 000000000000..95984db8e1e0 --- /dev/null +++ b/scripts/kconfig/streamline_config.pl | |||
@@ -0,0 +1,366 @@ | |||
1 | #!/usr/bin/perl -w | ||
2 | # | ||
3 | # Copywrite 2005-2009 - Steven Rostedt | ||
4 | # Licensed under the terms of the GNU GPL License version 2 | ||
5 | # | ||
6 | # It's simple enough to figure out how this works. | ||
7 | # If not, then you can ask me at stripconfig@goodmis.org | ||
8 | # | ||
9 | # What it does? | ||
10 | # | ||
11 | # If you have installed a Linux kernel from a distribution | ||
12 | # that turns on way too many modules than you need, and | ||
13 | # you only want the modules you use, then this program | ||
14 | # is perfect for you. | ||
15 | # | ||
16 | # It gives you the ability to turn off all the modules that are | ||
17 | # not loaded on your system. | ||
18 | # | ||
19 | # Howto: | ||
20 | # | ||
21 | # 1. Boot up the kernel that you want to stream line the config on. | ||
22 | # 2. Change directory to the directory holding the source of the | ||
23 | # kernel that you just booted. | ||
24 | # 3. Copy the configuraton file to this directory as .config | ||
25 | # 4. Have all your devices that you need modules for connected and | ||
26 | # operational (make sure that their corresponding modules are loaded) | ||
27 | # 5. Run this script redirecting the output to some other file | ||
28 | # like config_strip. | ||
29 | # 6. Back up your old config (if you want too). | ||
30 | # 7. copy the config_strip file to .config | ||
31 | # 8. Run "make oldconfig" | ||
32 | # | ||
33 | # Now your kernel is ready to be built with only the modules that | ||
34 | # are loaded. | ||
35 | # | ||
36 | # Here's what I did with my Debian distribution. | ||
37 | # | ||
38 | # cd /usr/src/linux-2.6.10 | ||
39 | # cp /boot/config-2.6.10-1-686-smp .config | ||
40 | # ~/bin/streamline_config > config_strip | ||
41 | # mv .config config_sav | ||
42 | # mv config_strip .config | ||
43 | # make oldconfig | ||
44 | # | ||
45 | my $config = ".config"; | ||
46 | my $linuxpath = "."; | ||
47 | |||
48 | my $uname = `uname -r`; | ||
49 | chomp $uname; | ||
50 | |||
51 | my @searchconfigs = ( | ||
52 | { | ||
53 | "file" => ".config", | ||
54 | "exec" => "cat", | ||
55 | }, | ||
56 | { | ||
57 | "file" => "/proc/config.gz", | ||
58 | "exec" => "zcat", | ||
59 | }, | ||
60 | { | ||
61 | "file" => "/boot/config-$uname", | ||
62 | "exec" => "cat", | ||
63 | }, | ||
64 | { | ||
65 | "file" => "/boot/vmlinuz-$uname", | ||
66 | "exec" => "scripts/extract-ikconfig", | ||
67 | "test" => "scripts/extract-ikconfig", | ||
68 | }, | ||
69 | { | ||
70 | "file" => "vmlinux", | ||
71 | "exec" => "scripts/extract-ikconfig", | ||
72 | "test" => "scripts/extract-ikconfig", | ||
73 | }, | ||
74 | { | ||
75 | "file" => "/lib/modules/$uname/kernel/kernel/configs.ko", | ||
76 | "exec" => "scripts/extract-ikconfig", | ||
77 | "test" => "scripts/extract-ikconfig", | ||
78 | }, | ||
79 | { | ||
80 | "file" => "kernel/configs.ko", | ||
81 | "exec" => "scripts/extract-ikconfig", | ||
82 | "test" => "scripts/extract-ikconfig", | ||
83 | }, | ||
84 | { | ||
85 | "file" => "kernel/configs.o", | ||
86 | "exec" => "scripts/extract-ikconfig", | ||
87 | "test" => "scripts/extract-ikconfig", | ||
88 | }, | ||
89 | ); | ||
90 | |||
91 | sub find_config { | ||
92 | foreach my $conf (@searchconfigs) { | ||
93 | my $file = $conf->{"file"}; | ||
94 | |||
95 | next if ( ! -f "$file"); | ||
96 | |||
97 | if (defined($conf->{"test"})) { | ||
98 | `$conf->{"test"} $conf->{"file"} 2>/dev/null`; | ||
99 | next if ($?); | ||
100 | } | ||
101 | |||
102 | my $exec = $conf->{"exec"}; | ||
103 | |||
104 | print STDERR "using config: '$file'\n"; | ||
105 | |||
106 | open(CIN, "$exec $file |") || die "Failed to run $exec $file"; | ||
107 | return; | ||
108 | } | ||
109 | die "No config file found"; | ||
110 | } | ||
111 | |||
112 | find_config; | ||
113 | |||
114 | my @makefiles = `find $linuxpath -name Makefile`; | ||
115 | my %depends; | ||
116 | my %selects; | ||
117 | my %prompts; | ||
118 | my %objects; | ||
119 | my $var; | ||
120 | my $cont = 0; | ||
121 | |||
122 | # Get the top level Kconfig file (passed in) | ||
123 | my $kconfig = $ARGV[0]; | ||
124 | |||
125 | # prevent recursion | ||
126 | my %read_kconfigs; | ||
127 | |||
128 | sub read_kconfig { | ||
129 | my ($kconfig) = @_; | ||
130 | |||
131 | my $state = "NONE"; | ||
132 | my $config; | ||
133 | my @kconfigs; | ||
134 | |||
135 | open(KIN, $kconfig) || die "Can't open $kconfig"; | ||
136 | while (<KIN>) { | ||
137 | chomp; | ||
138 | |||
139 | # collect any Kconfig sources | ||
140 | if (/^source\s*"(.*)"/) { | ||
141 | $kconfigs[$#kconfigs+1] = $1; | ||
142 | } | ||
143 | |||
144 | # configs found | ||
145 | if (/^\s*config\s+(\S+)\s*$/) { | ||
146 | $state = "NEW"; | ||
147 | $config = $1; | ||
148 | |||
149 | # collect the depends for the config | ||
150 | } elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) { | ||
151 | $state = "DEP"; | ||
152 | $depends{$config} = $1; | ||
153 | } elsif ($state eq "DEP" && /^\s*depends\s+on\s+(.*)$/) { | ||
154 | $depends{$config} .= " " . $1; | ||
155 | |||
156 | # Get the configs that select this config | ||
157 | } elsif ($state ne "NONE" && /^\s*select\s+(\S+)/) { | ||
158 | if (defined($selects{$1})) { | ||
159 | $selects{$1} .= " " . $config; | ||
160 | } else { | ||
161 | $selects{$1} = $config; | ||
162 | } | ||
163 | |||
164 | # configs without prompts must be selected | ||
165 | } elsif ($state ne "NONE" && /^\s*tristate\s\S/) { | ||
166 | # note if the config has a prompt | ||
167 | $prompt{$config} = 1; | ||
168 | |||
169 | # stop on "help" | ||
170 | } elsif (/^\s*help\s*$/) { | ||
171 | $state = "NONE"; | ||
172 | } | ||
173 | } | ||
174 | close(KIN); | ||
175 | |||
176 | # read in any configs that were found. | ||
177 | foreach $kconfig (@kconfigs) { | ||
178 | if (!defined($read_kconfigs{$kconfig})) { | ||
179 | $read_kconfigs{$kconfig} = 1; | ||
180 | read_kconfig($kconfig); | ||
181 | } | ||
182 | } | ||
183 | } | ||
184 | |||
185 | if ($kconfig) { | ||
186 | read_kconfig($kconfig); | ||
187 | } | ||
188 | |||
189 | # Read all Makefiles to map the configs to the objects | ||
190 | foreach my $makefile (@makefiles) { | ||
191 | chomp $makefile; | ||
192 | |||
193 | open(MIN,$makefile) || die "Can't open $makefile"; | ||
194 | while (<MIN>) { | ||
195 | my $objs; | ||
196 | |||
197 | # is this a line after a line with a backslash? | ||
198 | if ($cont && /(\S.*)$/) { | ||
199 | $objs = $1; | ||
200 | } | ||
201 | $cont = 0; | ||
202 | |||
203 | # collect objects after obj-$(CONFIG_FOO_BAR) | ||
204 | if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) { | ||
205 | $var = $1; | ||
206 | $objs = $2; | ||
207 | } | ||
208 | if (defined($objs)) { | ||
209 | # test if the line ends with a backslash | ||
210 | if ($objs =~ m,(.*)\\$,) { | ||
211 | $objs = $1; | ||
212 | $cont = 1; | ||
213 | } | ||
214 | |||
215 | foreach my $obj (split /\s+/,$objs) { | ||
216 | $obj =~ s/-/_/g; | ||
217 | if ($obj =~ /(.*)\.o$/) { | ||
218 | # Objects may bes enabled by more than one config. | ||
219 | # Store configs in an array. | ||
220 | my @arr; | ||
221 | |||
222 | if (defined($objects{$1})) { | ||
223 | @arr = @{$objects{$1}}; | ||
224 | } | ||
225 | |||
226 | $arr[$#arr+1] = $var; | ||
227 | |||
228 | # The objects have a hash mapping to a reference | ||
229 | # of an array of configs. | ||
230 | $objects{$1} = \@arr; | ||
231 | } | ||
232 | } | ||
233 | } | ||
234 | } | ||
235 | close(MIN); | ||
236 | } | ||
237 | |||
238 | my %modules; | ||
239 | |||
240 | # see what modules are loaded on this system | ||
241 | open(LIN,"/sbin/lsmod|") || die "Cant lsmod"; | ||
242 | while (<LIN>) { | ||
243 | next if (/^Module/); # Skip the first line. | ||
244 | if (/^(\S+)/) { | ||
245 | $modules{$1} = 1; | ||
246 | } | ||
247 | } | ||
248 | close (LIN); | ||
249 | |||
250 | # add to the configs hash all configs that are needed to enable | ||
251 | # a loaded module. | ||
252 | my %configs; | ||
253 | foreach my $module (keys(%modules)) { | ||
254 | if (defined($objects{$module})) { | ||
255 | @arr = @{$objects{$module}}; | ||
256 | foreach my $conf (@arr) { | ||
257 | $configs{$conf} = $module; | ||
258 | } | ||
259 | } else { | ||
260 | # Most likely, someone has a custom (binary?) module loaded. | ||
261 | print STDERR "$module config not found!!\n"; | ||
262 | } | ||
263 | } | ||
264 | |||
265 | my $valid = "A-Za-z_0-9"; | ||
266 | my $repeat = 1; | ||
267 | |||
268 | # | ||
269 | # Note, we do not care about operands (like: &&, ||, !) we want to add any | ||
270 | # config that is in the depend list of another config. This script does | ||
271 | # not enable configs that are not already enabled. If we come across a | ||
272 | # config A that depends on !B, we can still add B to the list of depends | ||
273 | # to keep on. If A was on in the original config, B would not have been | ||
274 | # and B would not be turned on by this script. | ||
275 | # | ||
276 | sub parse_config_dep_select | ||
277 | { | ||
278 | my ($p) = @_; | ||
279 | |||
280 | while ($p =~ /[$valid]/) { | ||
281 | |||
282 | if ($p =~ /^[^$valid]*([$valid]+)/) { | ||
283 | my $conf = "CONFIG_" . $1; | ||
284 | |||
285 | $p =~ s/^[^$valid]*[$valid]+//; | ||
286 | |||
287 | if (!defined($configs{$conf})) { | ||
288 | # We must make sure that this config has its | ||
289 | # dependencies met. | ||
290 | $repeat = 1; # do again | ||
291 | $configs{$conf} = 1; | ||
292 | } | ||
293 | } else { | ||
294 | die "this should never happen"; | ||
295 | } | ||
296 | } | ||
297 | } | ||
298 | |||
299 | while ($repeat) { | ||
300 | $repeat = 0; | ||
301 | |||
302 | foreach my $config (keys %configs) { | ||
303 | $config =~ s/^CONFIG_//; | ||
304 | |||
305 | if (defined($depends{$config})) { | ||
306 | # This config has dependencies. Make sure they are also included | ||
307 | parse_config_dep_select $depends{$config}; | ||
308 | } | ||
309 | |||
310 | if (defined($prompt{$config}) || !defined($selects{$config})) { | ||
311 | next; | ||
312 | } | ||
313 | |||
314 | # config has no prompt and must be selected. | ||
315 | parse_config_dep_select $selects{$config}; | ||
316 | } | ||
317 | } | ||
318 | |||
319 | my %setconfigs; | ||
320 | |||
321 | # Finally, read the .config file and turn off any module enabled that | ||
322 | # we could not find a reason to keep enabled. | ||
323 | while(<CIN>) { | ||
324 | |||
325 | if (/CONFIG_IKCONFIG/) { | ||
326 | if (/# CONFIG_IKCONFIG is not set/) { | ||
327 | # enable IKCONFIG at least as a module | ||
328 | print "CONFIG_IKCONFIG=m\n"; | ||
329 | # don't ask about PROC | ||
330 | print "# CONFIG_IKCONFIG_PROC is not set\n"; | ||
331 | } else { | ||
332 | print; | ||
333 | } | ||
334 | next; | ||
335 | } | ||
336 | |||
337 | if (/^(CONFIG.*)=(m|y)/) { | ||
338 | if (defined($configs{$1})) { | ||
339 | $setconfigs{$1} = $2; | ||
340 | } elsif ($2 eq "m") { | ||
341 | print "# $1 is not set\n"; | ||
342 | next; | ||
343 | } | ||
344 | } | ||
345 | print; | ||
346 | } | ||
347 | close(CIN); | ||
348 | |||
349 | # Integrity check, make sure all modules that we want enabled do | ||
350 | # indeed have their configs set. | ||
351 | loop: | ||
352 | foreach my $module (keys(%modules)) { | ||
353 | if (defined($objects{$module})) { | ||
354 | my @arr = @{$objects{$module}}; | ||
355 | foreach my $conf (@arr) { | ||
356 | if (defined($setconfigs{$conf})) { | ||
357 | next loop; | ||
358 | } | ||
359 | } | ||
360 | print STDERR "module $module did not have configs"; | ||
361 | foreach my $conf (@arr) { | ||
362 | print STDERR " " , $conf; | ||
363 | } | ||
364 | print STDERR "\n"; | ||
365 | } | ||
366 | } | ||
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 18f3e5c33634..6c8fbbb66ebc 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c | |||
@@ -36,7 +36,7 @@ tristate modules_val; | |||
36 | 36 | ||
37 | struct expr *sym_env_list; | 37 | struct expr *sym_env_list; |
38 | 38 | ||
39 | void sym_add_default(struct symbol *sym, const char *def) | 39 | static void sym_add_default(struct symbol *sym, const char *def) |
40 | { | 40 | { |
41 | struct property *prop = prop_alloc(P_DEFAULT, sym); | 41 | struct property *prop = prop_alloc(P_DEFAULT, sym); |
42 | 42 | ||
@@ -125,7 +125,7 @@ struct property *sym_get_default_prop(struct symbol *sym) | |||
125 | return NULL; | 125 | return NULL; |
126 | } | 126 | } |
127 | 127 | ||
128 | struct property *sym_get_range_prop(struct symbol *sym) | 128 | static struct property *sym_get_range_prop(struct symbol *sym) |
129 | { | 129 | { |
130 | struct property *prop; | 130 | struct property *prop; |
131 | 131 | ||
@@ -943,7 +943,7 @@ const char *prop_get_type_name(enum prop_type type) | |||
943 | return "unknown"; | 943 | return "unknown"; |
944 | } | 944 | } |
945 | 945 | ||
946 | void prop_add_env(const char *env) | 946 | static void prop_add_env(const char *env) |
947 | { | 947 | { |
948 | struct symbol *sym, *sym2; | 948 | struct symbol *sym, *sym2; |
949 | struct property *prop; | 949 | struct property *prop; |
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index b52d340d759d..ea9f8a58678f 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
@@ -1995,6 +1995,7 @@ sub process_file($) { | |||
1995 | my $identifier; | 1995 | my $identifier; |
1996 | my $func; | 1996 | my $func; |
1997 | my $descr; | 1997 | my $descr; |
1998 | my $in_purpose = 0; | ||
1998 | my $initial_section_counter = $section_counter; | 1999 | my $initial_section_counter = $section_counter; |
1999 | 2000 | ||
2000 | if (defined($ENV{'SRCTREE'})) { | 2001 | if (defined($ENV{'SRCTREE'})) { |
@@ -2044,6 +2045,7 @@ sub process_file($) { | |||
2044 | $descr =~ s/\s*$//; | 2045 | $descr =~ s/\s*$//; |
2045 | $descr =~ s/\s+/ /; | 2046 | $descr =~ s/\s+/ /; |
2046 | $declaration_purpose = xml_escape($descr); | 2047 | $declaration_purpose = xml_escape($descr); |
2048 | $in_purpose = 1; | ||
2047 | } else { | 2049 | } else { |
2048 | $declaration_purpose = ""; | 2050 | $declaration_purpose = ""; |
2049 | } | 2051 | } |
@@ -2090,6 +2092,7 @@ sub process_file($) { | |||
2090 | } | 2092 | } |
2091 | 2093 | ||
2092 | $in_doc_sect = 1; | 2094 | $in_doc_sect = 1; |
2095 | $in_purpose = 0; | ||
2093 | $contents = $newcontents; | 2096 | $contents = $newcontents; |
2094 | if ($contents ne "") { | 2097 | if ($contents ne "") { |
2095 | while ((substr($contents, 0, 1) eq " ") || | 2098 | while ((substr($contents, 0, 1) eq " ") || |
@@ -2119,11 +2122,19 @@ sub process_file($) { | |||
2119 | } elsif (/$doc_content/) { | 2122 | } elsif (/$doc_content/) { |
2120 | # miguel-style comment kludge, look for blank lines after | 2123 | # miguel-style comment kludge, look for blank lines after |
2121 | # @parameter line to signify start of description | 2124 | # @parameter line to signify start of description |
2122 | if ($1 eq "" && | 2125 | if ($1 eq "") { |
2123 | ($section =~ m/^@/ || $section eq $section_context)) { | 2126 | if ($section =~ m/^@/ || $section eq $section_context) { |
2124 | dump_section($file, $section, xml_escape($contents)); | 2127 | dump_section($file, $section, xml_escape($contents)); |
2125 | $section = $section_default; | 2128 | $section = $section_default; |
2126 | $contents = ""; | 2129 | $contents = ""; |
2130 | } else { | ||
2131 | $contents .= "\n"; | ||
2132 | } | ||
2133 | $in_purpose = 0; | ||
2134 | } elsif ($in_purpose == 1) { | ||
2135 | # Continued declaration purpose | ||
2136 | chomp($declaration_purpose); | ||
2137 | $declaration_purpose .= " " . xml_escape($1); | ||
2127 | } else { | 2138 | } else { |
2128 | $contents .= $1 . "\n"; | 2139 | $contents .= $1 . "\n"; |
2129 | } | 2140 | } |
diff --git a/scripts/markup_oops.pl b/scripts/markup_oops.pl index 89774011965d..5f0fcb712e29 100644 --- a/scripts/markup_oops.pl +++ b/scripts/markup_oops.pl | |||
@@ -184,10 +184,7 @@ if ($target eq "0") { | |||
184 | 184 | ||
185 | # if it's a module, we need to find the .ko file and calculate a load offset | 185 | # if it's a module, we need to find the .ko file and calculate a load offset |
186 | if ($module ne "") { | 186 | if ($module ne "") { |
187 | my $dir = dirname($filename); | 187 | my $modulefile = `modinfo $module | grep '^filename:' | awk '{ print \$2 }'`; |
188 | $dir = $dir . "/"; | ||
189 | my $mod = $module . ".ko"; | ||
190 | my $modulefile = `find $dir -name $mod | head -1`; | ||
191 | chomp($modulefile); | 188 | chomp($modulefile); |
192 | $filename = $modulefile; | 189 | $filename = $modulefile; |
193 | if ($filename eq "") { | 190 | if ($filename eq "") { |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 40e0045876ee..62a9025cdcc7 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -657,6 +657,15 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *id, | |||
657 | return 1; | 657 | return 1; |
658 | } | 658 | } |
659 | 659 | ||
660 | /* Looks like: spi:S */ | ||
661 | static int do_spi_entry(const char *filename, struct spi_device_id *id, | ||
662 | char *alias) | ||
663 | { | ||
664 | sprintf(alias, SPI_MODULE_PREFIX "%s", id->name); | ||
665 | |||
666 | return 1; | ||
667 | } | ||
668 | |||
660 | static const struct dmifield { | 669 | static const struct dmifield { |
661 | const char *prefix; | 670 | const char *prefix; |
662 | int field; | 671 | int field; |
@@ -853,6 +862,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
853 | do_table(symval, sym->st_size, | 862 | do_table(symval, sym->st_size, |
854 | sizeof(struct i2c_device_id), "i2c", | 863 | sizeof(struct i2c_device_id), "i2c", |
855 | do_i2c_entry, mod); | 864 | do_i2c_entry, mod); |
865 | else if (sym_is(symname, "__mod_spi_device_table")) | ||
866 | do_table(symval, sym->st_size, | ||
867 | sizeof(struct spi_device_id), "spi", | ||
868 | do_spi_entry, mod); | ||
856 | else if (sym_is(symname, "__mod_dmi_device_table")) | 869 | else if (sym_is(symname, "__mod_dmi_device_table")) |
857 | do_table(symval, sym->st_size, | 870 | do_table(symval, sym->st_size, |
858 | sizeof(struct dmi_system_id), "dmi", | 871 | sizeof(struct dmi_system_id), "dmi", |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 4522948a012e..801a16a17545 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -691,7 +691,7 @@ static int number_prefix(const char *sym) | |||
691 | * The $ syntax is for sections where ld append a dot number | 691 | * The $ syntax is for sections where ld append a dot number |
692 | * to make section name unique. | 692 | * to make section name unique. |
693 | */ | 693 | */ |
694 | int match(const char *sym, const char * const pat[]) | 694 | static int match(const char *sym, const char * const pat[]) |
695 | { | 695 | { |
696 | const char *p; | 696 | const char *p; |
697 | while (*pat) { | 697 | while (*pat) { |
@@ -1746,7 +1746,7 @@ static void add_header(struct buffer *b, struct module *mod) | |||
1746 | buf_printf(b, "};\n"); | 1746 | buf_printf(b, "};\n"); |
1747 | } | 1747 | } |
1748 | 1748 | ||
1749 | void add_staging_flag(struct buffer *b, const char *name) | 1749 | static void add_staging_flag(struct buffer *b, const char *name) |
1750 | { | 1750 | { |
1751 | static const char *staging_dir = "drivers/staging"; | 1751 | static const char *staging_dir = "drivers/staging"; |
1752 | 1752 | ||
diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c index aadc5223dcdb..ecf9c7dc1825 100644 --- a/scripts/mod/sumversion.c +++ b/scripts/mod/sumversion.c | |||
@@ -334,8 +334,6 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md) | |||
334 | deps_drivers/net/dummy.o := \ | 334 | deps_drivers/net/dummy.o := \ |
335 | drivers/net/dummy.c \ | 335 | drivers/net/dummy.c \ |
336 | $(wildcard include/config/net/fastroute.h) \ | 336 | $(wildcard include/config/net/fastroute.h) \ |
337 | include/linux/config.h \ | ||
338 | $(wildcard include/config/h.h) \ | ||
339 | include/linux/module.h \ | 337 | include/linux/module.h \ |
340 | 338 | ||
341 | Sum all files in the same dir or subdirs. | 339 | Sum all files in the same dir or subdirs. |
diff --git a/scripts/module-common.lds b/scripts/module-common.lds new file mode 100644 index 000000000000..47a1f9ae0ede --- /dev/null +++ b/scripts/module-common.lds | |||
@@ -0,0 +1,8 @@ | |||
1 | /* | ||
2 | * Common module linker script, always used when linking a module. | ||
3 | * Archs are free to supply their own linker scripts. ld will | ||
4 | * combine them automatically. | ||
5 | */ | ||
6 | SECTIONS { | ||
7 | /DISCARD/ : { *(.discard) } | ||
8 | } | ||
diff --git a/scripts/selinux/mdp/mdp.c b/scripts/selinux/mdp/mdp.c index ca757d486187..b4ced8562587 100644 --- a/scripts/selinux/mdp/mdp.c +++ b/scripts/selinux/mdp/mdp.c | |||
@@ -31,13 +31,13 @@ | |||
31 | 31 | ||
32 | #include "flask.h" | 32 | #include "flask.h" |
33 | 33 | ||
34 | void usage(char *name) | 34 | static void usage(char *name) |
35 | { | 35 | { |
36 | printf("usage: %s [-m] policy_file context_file\n", name); | 36 | printf("usage: %s [-m] policy_file context_file\n", name); |
37 | exit(1); | 37 | exit(1); |
38 | } | 38 | } |
39 | 39 | ||
40 | void find_common_name(char *cname, char *dest, int len) | 40 | static void find_common_name(char *cname, char *dest, int len) |
41 | { | 41 | { |
42 | char *start, *end; | 42 | char *start, *end; |
43 | 43 | ||
diff --git a/scripts/tags.sh b/scripts/tags.sh index 4a34ec591e8c..d52f7a01557c 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh | |||
@@ -101,7 +101,8 @@ exuberant() | |||
101 | -I ____cacheline_aligned_in_smp \ | 101 | -I ____cacheline_aligned_in_smp \ |
102 | -I ____cacheline_internodealigned_in_smp \ | 102 | -I ____cacheline_internodealigned_in_smp \ |
103 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ | 103 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ |
104 | --extra=+f --c-kinds=+px \ | 104 | -I DEFINE_TRACE,EXPORT_TRACEPOINT_SYMBOL,EXPORT_TRACEPOINT_SYMBOL_GPL \ |
105 | --extra=+f --c-kinds=-px \ | ||
105 | --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' \ | 106 | --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' \ |
106 | --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' | 107 | --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' |
107 | 108 | ||
diff --git a/scripts/tracing/power.pl b/scripts/tracing/power.pl deleted file mode 100644 index 4f729b3501e0..000000000000 --- a/scripts/tracing/power.pl +++ /dev/null | |||
@@ -1,108 +0,0 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | # Copyright 2008, Intel Corporation | ||
4 | # | ||
5 | # This file is part of the Linux kernel | ||
6 | # | ||
7 | # This program file is free software; you can redistribute it and/or modify it | ||
8 | # under the terms of the GNU General Public License as published by the | ||
9 | # Free Software Foundation; version 2 of the License. | ||
10 | # | ||
11 | # This program is distributed in the hope that it will be useful, but WITHOUT | ||
12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
14 | # for more details. | ||
15 | # | ||
16 | # You should have received a copy of the GNU General Public License | ||
17 | # along with this program in a file named COPYING; if not, write to the | ||
18 | # Free Software Foundation, Inc., | ||
19 | # 51 Franklin Street, Fifth Floor, | ||
20 | # Boston, MA 02110-1301 USA | ||
21 | # | ||
22 | # Authors: | ||
23 | # Arjan van de Ven <arjan@linux.intel.com> | ||
24 | |||
25 | |||
26 | # | ||
27 | # This script turns a cstate ftrace output into a SVG graphic that shows | ||
28 | # historic C-state information | ||
29 | # | ||
30 | # | ||
31 | # cat /sys/kernel/debug/tracing/trace | perl power.pl > out.svg | ||
32 | # | ||
33 | |||
34 | my @styles; | ||
35 | my $base = 0; | ||
36 | |||
37 | my @pstate_last; | ||
38 | my @pstate_level; | ||
39 | |||
40 | $styles[0] = "fill:rgb(0,0,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
41 | $styles[1] = "fill:rgb(0,255,0);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
42 | $styles[2] = "fill:rgb(255,0,20);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
43 | $styles[3] = "fill:rgb(255,255,20);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
44 | $styles[4] = "fill:rgb(255,0,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
45 | $styles[5] = "fill:rgb(0,255,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
46 | $styles[6] = "fill:rgb(0,128,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
47 | $styles[7] = "fill:rgb(0,255,128);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
48 | $styles[8] = "fill:rgb(0,25,20);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
49 | |||
50 | |||
51 | print "<?xml version=\"1.0\" standalone=\"no\"?> \n"; | ||
52 | print "<svg width=\"10000\" height=\"100%\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n"; | ||
53 | |||
54 | my $scale = 30000.0; | ||
55 | while (<>) { | ||
56 | my $line = $_; | ||
57 | if ($line =~ /([0-9\.]+)\] CSTATE: Going to C([0-9]) on cpu ([0-9]+) for ([0-9\.]+)/) { | ||
58 | if ($base == 0) { | ||
59 | $base = $1; | ||
60 | } | ||
61 | my $time = $1 - $base; | ||
62 | $time = $time * $scale; | ||
63 | my $C = $2; | ||
64 | my $cpu = $3; | ||
65 | my $y = 400 * $cpu; | ||
66 | my $duration = $4 * $scale; | ||
67 | my $msec = int($4 * 100000)/100.0; | ||
68 | my $height = $C * 20; | ||
69 | $style = $styles[$C]; | ||
70 | |||
71 | $y = $y + 140 - $height; | ||
72 | |||
73 | $x2 = $time + 4; | ||
74 | $y2 = $y + 4; | ||
75 | |||
76 | |||
77 | print "<rect x=\"$time\" width=\"$duration\" y=\"$y\" height=\"$height\" style=\"$style\"/>\n"; | ||
78 | print "<text transform=\"translate($x2,$y2) rotate(90)\">C$C $msec</text>\n"; | ||
79 | } | ||
80 | if ($line =~ /([0-9\.]+)\] PSTATE: Going to P([0-9]) on cpu ([0-9]+)/) { | ||
81 | my $time = $1 - $base; | ||
82 | my $state = $2; | ||
83 | my $cpu = $3; | ||
84 | |||
85 | if (defined($pstate_last[$cpu])) { | ||
86 | my $from = $pstate_last[$cpu]; | ||
87 | my $oldstate = $pstate_state[$cpu]; | ||
88 | my $duration = ($time-$from) * $scale; | ||
89 | |||
90 | $from = $from * $scale; | ||
91 | my $to = $from + $duration; | ||
92 | my $height = 140 - ($oldstate * (140/8)); | ||
93 | |||
94 | my $y = 400 * $cpu + 200 + $height; | ||
95 | my $y2 = $y+4; | ||
96 | my $style = $styles[8]; | ||
97 | |||
98 | print "<rect x=\"$from\" y=\"$y\" width=\"$duration\" height=\"5\" style=\"$style\"/>\n"; | ||
99 | print "<text transform=\"translate($from,$y2)\">P$oldstate (cpu $cpu)</text>\n"; | ||
100 | }; | ||
101 | |||
102 | $pstate_last[$cpu] = $time; | ||
103 | $pstate_state[$cpu] = $state; | ||
104 | } | ||
105 | } | ||
106 | |||
107 | |||
108 | print "</svg>\n"; | ||