Commit 9b5f0b1da9ba7019316ed8c9698fe25e8c7fc33e

Authored by Masahiro Yamada
Committed by Tom Rini
1 parent d6fc0cefd8

kconfig: sync with Linux 4.1

Update the files under scripts/kconfig/ to match Linux 4.1.
Some Kconfig sources have diverged from those in the kernel,
so commit-base syncing was done not to lose U-Boot specific updates.

The commits cherry-picked from Linux are:

[1] commit be8af2d54a66911693eddc556e4f7a866670082b
    Author: Bjørn Forsman <bjorn.forsman@gmail.com>
    kconfig/lxdialog: get ncurses CFLAGS with pkg-config

[2] commit 3943f42c11896ce82ad3da132c8a5630313bdd0e
    Author: Andrey Utkin <andrey.krieger.utkin@gmail.com>
    Replace mentions of "list_struct" to "list_head"

[3] commit e4e458b45c5861808674eebfea94cee2258bb2ea
    Author: Arjun Sreedharan <arjun024@gmail.com>
    calloc/xcalloc: Fix argument order

[4] commit 09950bc256e3628d275f90e016e6f5a039fbdcab
    Author: Olof Johansson <olof@lixom.net>
    merge_config.sh: Display usage if given too few arguments

[5] commit b6a2ab2cd4739a9573ed41677e53171987b8da34
    Author: Colin Ian King <colin.king@canonical.com>
    kconfig: use va_end to match corresponding va_start

[6] commit 70529b1a1784503169416df19ce3d68746401340
    Author: Michal Marek <mmarek@suse.cz>
    kconfig: Get rid of the P() macro in headers

[7] commit 463157444e377bf9b279101b1f16a94c4648c03a
    Author: Michal Marek <mmarek@suse.cz>
    kconfig: Remove dead code

[8] commit ad8d40cda3ad22ad9e8863d55a5c88f85c0173f0
    Author: Michal Marek <mmarek@suse.cz>
    kconfig: Remove unnecessary prototypes from headers

[9] commit de4619937229378e81f95e99c9866acc8e207d34
    Author: Masahiro Yamada <yamada.masahiro@socionext.com>
    kbuild: mergeconfig: fix "jobserver unavailable" warning

[10] commit b9fe99c5b994c6ddc57780993966b18899526c0b
    Author: Masahiro Yamada <yamada.masahiro@socionext.com>
    kbuild: mergeconfig: move an error check to merge_config.sh

[11] commit 371cfd4ff0611d8bc5d18bbb9cc6a2bc3d56cd3d
    Author: Masahiro Yamada <yamada.masahiro@socionext.com>
    kbuild: mergeconfig: remove redundant $(objtree)

[12] commit 3a975b8cfcbe026b535f83bde9a3c009bae214f9
    Author: Masahiro Yamada <yamada.masahiro@socionext.com>
    merge_config.sh: improve indentation

[13] commit bc8f8f5fc47cd02c2c5f3580dac2fe6695af1edd
    Author: Masahiro Yamada <yamada.masahiro@socionext.com>
    merge_config.sh: rename MAKE to RUNMAKE

[14] commit 63a91033d52e64a22e571fe84924c0b7f21c280d
    Author: Masahiro Yamada <yamada.masahiro@socionext.com>
    kbuild: add generic mergeconfig target, %.config

[15] commit 1cba0c305758c3c1786ecaceb03e142c95a4edc9
    Author: Michal Marek <mmarek@suse.cz>
    kconfig: Simplify Makefile

[16] commit 0a1f00a1c86421cc07cec87011c7cf4df68ee54b
    Author: Michal Marek <mmarek@suse.cz>
    kconfig: Do not print status messages in make -s mode

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com>
Signed-off-by: Andrey Utkin <andrey.krieger.utkin@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>

Showing 17 changed files with 189 additions and 203 deletions Side-by-side Diff

scripts/kconfig/Makefile
... ... @@ -2,7 +2,7 @@
2 2 # Kernel configuration targets
3 3 # These targets are used from top-level makefile
4 4  
5   -PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config \
  5 +PHONY += xconfig gconfig menuconfig config silentoldconfig update-po-config \
6 6 localmodconfig localyesconfig
7 7  
8 8 # Added for U-Boot
9 9  
10 10  
11 11  
12 12  
13 13  
14 14  
15 15  
... ... @@ -17,30 +17,31 @@
17 17 Kconfig := Kconfig
18 18 endif
19 19  
  20 +ifeq ($(quiet),silent_)
  21 +silent := -s
  22 +endif
  23 +
20 24 # We need this, in case the user has it in its environment
21 25 unexport CONFIG_
22 26  
23 27 xconfig: $(obj)/qconf
24   - $< $(Kconfig)
  28 + $< $(silent) $(Kconfig)
25 29  
26 30 gconfig: $(obj)/gconf
27   - $< $(Kconfig)
  31 + $< $(silent) $(Kconfig)
28 32  
29 33 menuconfig: $(obj)/mconf
30   - $< $(Kconfig)
  34 + $< $(silent) $(Kconfig)
31 35  
32 36 config: $(obj)/conf
33   - $< --oldaskconfig $(Kconfig)
  37 + $< $(silent) --oldaskconfig $(Kconfig)
34 38  
35 39 nconfig: $(obj)/nconf
36   - $< $(Kconfig)
  40 + $< $(silent) $(Kconfig)
37 41  
38   -oldconfig: $(obj)/conf
39   - $< --$@ $(Kconfig)
40   -
41 42 silentoldconfig: $(obj)/conf
42 43 $(Q)mkdir -p include/config include/generated
43   - $< --$@ $(Kconfig)
  44 + $< $(silent) --$@ $(Kconfig)
44 45  
45 46 localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
46 47 $(Q)mkdir -p include/config include/generated
47 48  
48 49  
... ... @@ -49,18 +50,18 @@
49 50 cmp -s .tmp.config .config || \
50 51 (mv -f .config .config.old.1; \
51 52 mv -f .tmp.config .config; \
52   - $(obj)/conf --silentoldconfig $(Kconfig); \
  53 + $(obj)/conf $(silent) --silentoldconfig $(Kconfig); \
53 54 mv -f .config.old.1 .config.old) \
54 55 else \
55 56 mv -f .tmp.config .config; \
56   - $(obj)/conf --silentoldconfig $(Kconfig); \
  57 + $(obj)/conf $(silent) --silentoldconfig $(Kconfig); \
57 58 fi
58 59 $(Q)rm -f .tmp.config
59 60  
60 61 # Create new linux.pot file
61 62 # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
62 63 update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
63   - $(Q)echo " GEN config.pot"
  64 + $(Q)$(kecho) " GEN config.pot"
64 65 $(Q)xgettext --default-domain=linux \
65 66 --add-comments --keyword=_ --keyword=N_ \
66 67 --from-code=UTF-8 \
67 68  
68 69  
69 70  
70 71  
71 72  
72 73  
73 74  
74 75  
75 76  
76 77  
77 78  
78 79  
79 80  
80 81  
... ... @@ -71,65 +72,62 @@
71 72 $(Q)(for i in `ls $(srctree)/arch/*/Kconfig \
72 73 $(srctree)/arch/*/um/Kconfig`; \
73 74 do \
74   - echo " GEN $$i"; \
  75 + $(kecho) " GEN $$i"; \
75 76 $(obj)/kxgettext $$i \
76 77 >> $(obj)/config.pot; \
77 78 done )
78   - $(Q)echo " GEN linux.pot"
  79 + $(Q)$(kecho) " GEN linux.pot"
79 80 $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \
80 81 --output $(obj)/linux.pot
81 82 $(Q)rm -f $(obj)/config.pot
82 83  
83   -PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig
  84 +# These targets map 1:1 to the commandline options of 'conf'
  85 +simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
  86 + alldefconfig randconfig listnewconfig olddefconfig
  87 +PHONY += $(simple-targets)
84 88  
85   -allnoconfig allyesconfig allmodconfig alldefconfig randconfig: $(obj)/conf
86   - $< --$@ $(Kconfig)
  89 +$(simple-targets): $(obj)/conf
  90 + $< $(silent) --$@ $(Kconfig)
87 91  
88   -PHONY += listnewconfig olddefconfig oldnoconfig savedefconfig defconfig
  92 +PHONY += oldnoconfig savedefconfig defconfig
89 93  
90   -listnewconfig olddefconfig: $(obj)/conf
91   - $< --$@ $(Kconfig)
92   -
93 94 # oldnoconfig is an alias of olddefconfig, because people already are dependent
94 95 # on its behavior(sets new symbols to their default value but not 'n') with the
95 96 # counter-intuitive name.
96   -oldnoconfig: $(obj)/conf
97   - $< --olddefconfig $(Kconfig)
  97 +oldnoconfig: olddefconfig
98 98  
99 99 savedefconfig: $(obj)/conf
100   - $< --$@=defconfig $(Kconfig)
  100 + $< $(silent) --$@=defconfig $(Kconfig)
101 101  
102 102 defconfig: $(obj)/conf
103 103 ifeq ($(KBUILD_DEFCONFIG),)
104   - $< --defconfig $(Kconfig)
  104 + $< $(silent) --defconfig $(Kconfig)
105 105 else
106   - @echo "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
107   - $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
  106 + @$(kecho) "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
  107 + $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
108 108 endif
109 109  
110 110 %_defconfig: $(obj)/conf
111   - $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
  111 + $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
112 112  
113 113 # Added for U-Boot (backward compatibility)
114 114 %_config: %_defconfig
115 115 @:
116 116  
117   -configfiles=$(wildcard $(srctree)/kernel/configs/$(1).config $(srctree)/arch/$(SRCARCH)/configs/$(1).config)
  117 +configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/configs/$@)
118 118  
119   -define mergeconfig
120   -$(if $(wildcard $(objtree)/.config),, $(error You need an existing .config for this target))
121   -$(if $(call configfiles,$(1)),, $(error No configuration exists for this target on this architecture))
122   -$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m -O $(objtree) $(objtree)/.config $(call configfiles,$(1))
123   -$(Q)yes "" | $(MAKE) -f $(srctree)/Makefile oldconfig
124   -endef
  119 +%.config: $(obj)/conf
  120 + $(if $(call configfiles),, $(error No configuration exists for this target on this architecture))
  121 + $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m .config $(configfiles)
  122 + +$(Q)yes "" | $(MAKE) -f $(srctree)/Makefile oldconfig
125 123  
126 124 PHONY += kvmconfig
127   -kvmconfig:
128   - $(call mergeconfig,kvm_guest)
  125 +kvmconfig: kvm_guest.config
  126 + @:
129 127  
130 128 PHONY += tinyconfig
131   -tinyconfig: allnoconfig
132   - $(call mergeconfig,tiny)
  129 +tinyconfig:
  130 + $(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config
133 131  
134 132 # Help text used by make help
135 133 help:
... ... @@ -231,7 +229,7 @@
231 229  
232 230 # QT needs some extra effort...
233 231 $(obj)/.tmp_qtcheck:
234   - @set -e; echo " CHECK qt"; dir=""; pkg=""; \
  232 + @set -e; $(kecho) " CHECK qt"; dir=""; pkg=""; \
235 233 if ! pkg-config --exists QtCore 2> /dev/null; then \
236 234 echo "* Unable to find the QT4 tool qmake. Trying to use QT3"; \
237 235 pkg-config --exists qt 2> /dev/null && pkg=qt; \
scripts/kconfig/conf.c
... ... @@ -471,7 +471,7 @@
471 471 static void conf_usage(const char *progname)
472 472 {
473 473  
474   - printf("Usage: %s [option] <kconfig-file>\n", progname);
  474 + printf("Usage: %s [-s] [option] <kconfig-file>\n", progname);
475 475 printf("[option] is _one_ of the following:\n");
476 476 printf(" --listnewconfig List new options\n");
477 477 printf(" --oldaskconfig Start a new configuration using a line-oriented program\n");
... ... @@ -501,7 +501,11 @@
501 501  
502 502 tty_stdio = isatty(0) && isatty(1) && isatty(2);
503 503  
504   - while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) {
  504 + while ((opt = getopt_long(ac, av, "s", long_opts, NULL)) != -1) {
  505 + if (opt == 's') {
  506 + conf_set_message_callback(NULL);
  507 + continue;
  508 + }
505 509 input_mode = (enum input_mode)opt;
506 510 switch (opt) {
507 511 case silentoldconfig:
scripts/kconfig/confdata.c
... ... @@ -16,6 +16,11 @@
16 16  
17 17 #include "lkc.h"
18 18  
  19 +struct conf_printer {
  20 + void (*print_symbol)(FILE *, struct symbol *, const char *, void *);
  21 + void (*print_comment)(FILE *, const char *, void *);
  22 +};
  23 +
19 24 static void conf_warning(const char *fmt, ...)
20 25 __attribute__ ((format (printf, 1, 2)));
21 26  
... ... @@ -59,6 +64,7 @@
59 64 va_start(ap, fmt);
60 65 if (conf_message_callback)
61 66 conf_message_callback(fmt, ap);
  67 + va_end(ap);
62 68 }
63 69  
64 70 const char *conf_get_configname(void)
scripts/kconfig/expr.c
... ... @@ -11,6 +11,12 @@
11 11  
12 12 #define DEBUG_EXPR 0
13 13  
  14 +static int expr_eq(struct expr *e1, struct expr *e2);
  15 +static struct expr *expr_eliminate_yn(struct expr *e);
  16 +static struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2);
  17 +static struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2);
  18 +static void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2);
  19 +
14 20 struct expr *expr_alloc_symbol(struct symbol *sym)
15 21 {
16 22 struct expr *e = xcalloc(1, sizeof(*e));
... ... @@ -186,7 +192,7 @@
186 192 #undef e1
187 193 #undef e2
188 194  
189   -int expr_eq(struct expr *e1, struct expr *e2)
  195 +static int expr_eq(struct expr *e1, struct expr *e2)
190 196 {
191 197 int res, old_count;
192 198  
... ... @@ -228,7 +234,7 @@
228 234 return 0;
229 235 }
230 236  
231   -struct expr *expr_eliminate_yn(struct expr *e)
  237 +static struct expr *expr_eliminate_yn(struct expr *e)
232 238 {
233 239 struct expr *tmp;
234 240  
... ... @@ -823,7 +829,7 @@
823 829 return false;
824 830 }
825 831  
826   -struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2)
  832 +static struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2)
827 833 {
828 834 struct expr *tmp = NULL;
829 835 expr_extract_eq(E_AND, &tmp, ep1, ep2);
... ... @@ -834,7 +840,7 @@
834 840 return tmp;
835 841 }
836 842  
837   -struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2)
  843 +static struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2)
838 844 {
839 845 struct expr *tmp = NULL;
840 846 expr_extract_eq(E_OR, &tmp, ep1, ep2);
... ... @@ -845,7 +851,7 @@
845 851 return tmp;
846 852 }
847 853  
848   -void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2)
  854 +static void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2)
849 855 {
850 856 #define e1 (*ep1)
851 857 #define e2 (*ep2)
852 858  
... ... @@ -976,11 +982,8 @@
976 982 }
977 983 }
978 984  
979   -int expr_compare_type(enum expr_type t1, enum expr_type t2)
  985 +static int expr_compare_type(enum expr_type t1, enum expr_type t2)
980 986 {
981   -#if 0
982   - return 1;
983   -#else
984 987 if (t1 == t2)
985 988 return 0;
986 989 switch (t1) {
... ... @@ -1005,7 +1008,6 @@
1005 1008 }
1006 1009 printf("[%dgt%d?]", t1, t2);
1007 1010 return 0;
1008   -#endif
1009 1011 }
1010 1012  
1011 1013 static inline struct expr *
scripts/kconfig/expr.h
... ... @@ -205,18 +205,13 @@
205 205 struct expr *expr_alloc_or(struct expr *e1, struct expr *e2);
206 206 struct expr *expr_copy(const struct expr *org);
207 207 void expr_free(struct expr *e);
208   -int expr_eq(struct expr *e1, struct expr *e2);
209 208 void expr_eliminate_eq(struct expr **ep1, struct expr **ep2);
210 209 tristate expr_calc_value(struct expr *e);
211   -struct expr *expr_eliminate_yn(struct expr *e);
212 210 struct expr *expr_trans_bool(struct expr *e);
213 211 struct expr *expr_eliminate_dups(struct expr *e);
214 212 struct expr *expr_transform(struct expr *e);
215 213 int expr_contains_symbol(struct expr *dep, struct symbol *sym);
216 214 bool expr_depends_symbol(struct expr *dep, struct symbol *sym);
217   -struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2);
218   -struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2);
219   -void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2);
220 215 struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym);
221 216 struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2);
222 217  
scripts/kconfig/gconf.c
... ... @@ -169,37 +169,13 @@
169 169 style = gtk_widget_get_style(main_wnd);
170 170 widget = glade_xml_get_widget(xml, "toolbar1");
171 171  
172   -#if 0 /* Use stock Gtk icons instead */
173 172 replace_button_icon(xml, main_wnd->window, style,
174   - "button1", (gchar **) xpm_back);
175   - replace_button_icon(xml, main_wnd->window, style,
176   - "button2", (gchar **) xpm_load);
177   - replace_button_icon(xml, main_wnd->window, style,
178   - "button3", (gchar **) xpm_save);
179   -#endif
180   - replace_button_icon(xml, main_wnd->window, style,
181 173 "button4", (gchar **) xpm_single_view);
182 174 replace_button_icon(xml, main_wnd->window, style,
183 175 "button5", (gchar **) xpm_split_view);
184 176 replace_button_icon(xml, main_wnd->window, style,
185 177 "button6", (gchar **) xpm_tree_view);
186 178  
187   -#if 0
188   - switch (view_mode) {
189   - case SINGLE_VIEW:
190   - widget = glade_xml_get_widget(xml, "button4");
191   - g_signal_emit_by_name(widget, "clicked");
192   - break;
193   - case SPLIT_VIEW:
194   - widget = glade_xml_get_widget(xml, "button5");
195   - g_signal_emit_by_name(widget, "clicked");
196   - break;
197   - case FULL_VIEW:
198   - widget = glade_xml_get_widget(xml, "button6");
199   - g_signal_emit_by_name(widget, "clicked");
200   - break;
201   - }
202   -#endif
203 179 txtbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w));
204 180 tag1 = gtk_text_buffer_create_tag(txtbuf, "mytag1",
205 181 "foreground", "red",
206 182  
... ... @@ -1498,9 +1474,12 @@
1498 1474 case 'a':
1499 1475 //showAll = 1;
1500 1476 break;
  1477 + case 's':
  1478 + conf_set_message_callback(NULL);
  1479 + break;
1501 1480 case 'h':
1502 1481 case '?':
1503   - printf("%s <config>\n", av[0]);
  1482 + printf("%s [-s] <config>\n", av[0]);
1504 1483 exit(0);
1505 1484 }
1506 1485 name = av[2];
scripts/kconfig/list.h
... ... @@ -34,7 +34,7 @@
34 34 * list_entry - get the struct for this entry
35 35 * @ptr: the &struct list_head pointer.
36 36 * @type: the type of the struct this is embedded in.
37   - * @member: the name of the list_struct within the struct.
  37 + * @member: the name of the list_head within the struct.
38 38 */
39 39 #define list_entry(ptr, type, member) \
40 40 container_of(ptr, type, member)
... ... @@ -43,7 +43,7 @@
43 43 * list_for_each_entry - iterate over list of given type
44 44 * @pos: the type * to use as a loop cursor.
45 45 * @head: the head for your list.
46   - * @member: the name of the list_struct within the struct.
  46 + * @member: the name of the list_head within the struct.
47 47 */
48 48 #define list_for_each_entry(pos, head, member) \
49 49 for (pos = list_entry((head)->next, typeof(*pos), member); \
... ... @@ -55,7 +55,7 @@
55 55 * @pos: the type * to use as a loop cursor.
56 56 * @n: another type * to use as temporary storage
57 57 * @head: the head for your list.
58   - * @member: the name of the list_struct within the struct.
  58 + * @member: the name of the list_head within the struct.
59 59 */
60 60 #define list_for_each_entry_safe(pos, n, head, member) \
61 61 for (pos = list_entry((head)->next, typeof(*pos), member), \
scripts/kconfig/lkc.h
... ... @@ -21,9 +21,7 @@
21 21 extern "C" {
22 22 #endif
23 23  
24   -#define P(name,type,arg) extern type name arg
25 24 #include "lkc_proto.h"
26   -#undef P
27 25  
28 26 #define SRCTREE "srctree"
29 27  
... ... @@ -70,9 +68,6 @@
70 68 enum symbol_type stype;
71 69 };
72 70  
73   -extern int zconfdebug;
74   -
75   -int zconfparse(void);
76 71 void zconfdump(FILE *out);
77 72 void zconf_starthelp(void);
78 73 FILE *zconf_fopen(const char *name);
... ... @@ -90,11 +85,6 @@
90 85 bool conf_set_all_new_symbols(enum conf_def_mode mode);
91 86 void set_all_choice_values(struct symbol *csym);
92 87  
93   -struct conf_printer {
94   - void (*print_symbol)(FILE *, struct symbol *, const char *, void *);
95   - void (*print_comment)(FILE *, const char *, void *);
96   -};
97   -
98 88 /* confdata.c and expr.c */
99 89 static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out)
100 90 {
... ... @@ -113,7 +103,6 @@
113 103 void menu_end_entry(void);
114 104 void menu_add_dep(struct expr *dep);
115 105 void menu_add_visibility(struct expr *dep);
116   -struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep);
117 106 struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
118 107 void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
119 108 void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep);
... ... @@ -137,7 +126,6 @@
137 126 int max_width;
138 127 };
139 128 struct gstr str_new(void);
140   -struct gstr str_assign(const char *s);
141 129 void str_free(struct gstr *gs);
142 130 void str_append(struct gstr *gs, const char *s);
143 131 void str_printf(struct gstr *gs, const char *fmt, ...);
... ... @@ -148,8 +136,6 @@
148 136  
149 137 void sym_init(void);
150 138 void sym_clear_all_valid(void);
151   -void sym_set_all_changed(void);
152   -void sym_set_changed(struct symbol *sym);
153 139 struct symbol *sym_choice_default(struct symbol *sym);
154 140 const char *sym_get_string_default(struct symbol *sym);
155 141 struct symbol *sym_check_deps(struct symbol *sym);
scripts/kconfig/lkc_proto.h
1 1 #include <stdarg.h>
2 2  
3 3 /* confdata.c */
4   -P(conf_parse,void,(const char *name));
5   -P(conf_read,int,(const char *name));
6   -P(conf_read_simple,int,(const char *name, int));
7   -P(conf_write_defconfig,int,(const char *name));
8   -P(conf_write,int,(const char *name));
9   -P(conf_write_autoconf,int,(void));
10   -P(conf_get_changed,bool,(void));
11   -P(conf_set_changed_callback, void,(void (*fn)(void)));
12   -P(conf_set_message_callback, void,(void (*fn)(const char *fmt, va_list ap)));
  4 +void conf_parse(const char *name);
  5 +int conf_read(const char *name);
  6 +int conf_read_simple(const char *name, int);
  7 +int conf_write_defconfig(const char *name);
  8 +int conf_write(const char *name);
  9 +int conf_write_autoconf(void);
  10 +bool conf_get_changed(void);
  11 +void conf_set_changed_callback(void (*fn)(void));
  12 +void conf_set_message_callback(void (*fn)(const char *fmt, va_list ap));
13 13  
14 14 /* menu.c */
15   -P(rootmenu,struct menu,);
  15 +extern struct menu rootmenu;
16 16  
17   -P(menu_is_empty, bool, (struct menu *menu));
18   -P(menu_is_visible, bool, (struct menu *menu));
19   -P(menu_has_prompt, bool, (struct menu *menu));
20   -P(menu_get_prompt,const char *,(struct menu *menu));
21   -P(menu_get_root_menu,struct menu *,(struct menu *menu));
22   -P(menu_get_parent_menu,struct menu *,(struct menu *menu));
23   -P(menu_has_help,bool,(struct menu *menu));
24   -P(menu_get_help,const char *,(struct menu *menu));
25   -P(get_symbol_str, void, (struct gstr *r, struct symbol *sym, struct list_head
26   - *head));
27   -P(get_relations_str, struct gstr, (struct symbol **sym_arr, struct list_head
28   - *head));
29   -P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help));
  17 +bool menu_is_empty(struct menu *menu);
  18 +bool menu_is_visible(struct menu *menu);
  19 +bool menu_has_prompt(struct menu *menu);
  20 +const char * menu_get_prompt(struct menu *menu);
  21 +struct menu * menu_get_root_menu(struct menu *menu);
  22 +struct menu * menu_get_parent_menu(struct menu *menu);
  23 +bool menu_has_help(struct menu *menu);
  24 +const char * menu_get_help(struct menu *menu);
  25 +struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head);
  26 +void menu_get_ext_help(struct menu *menu, struct gstr *help);
30 27  
31 28 /* symbol.c */
32   -P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]);
  29 +extern struct symbol * symbol_hash[SYMBOL_HASHSIZE];
33 30  
34   -P(sym_lookup,struct symbol *,(const char *name, int flags));
35   -P(sym_find,struct symbol *,(const char *name));
36   -P(sym_expand_string_value,const char *,(const char *in));
37   -P(sym_escape_string_value, const char *,(const char *in));
38   -P(sym_re_search,struct symbol **,(const char *pattern));
39   -P(sym_type_name,const char *,(enum symbol_type type));
40   -P(sym_calc_value,void,(struct symbol *sym));
41   -P(sym_get_type,enum symbol_type,(struct symbol *sym));
42   -P(sym_tristate_within_range,bool,(struct symbol *sym,tristate tri));
43   -P(sym_set_tristate_value,bool,(struct symbol *sym,tristate tri));
44   -P(sym_toggle_tristate_value,tristate,(struct symbol *sym));
45   -P(sym_string_valid,bool,(struct symbol *sym, const char *newval));
46   -P(sym_string_within_range,bool,(struct symbol *sym, const char *str));
47   -P(sym_set_string_value,bool,(struct symbol *sym, const char *newval));
48   -P(sym_is_changable,bool,(struct symbol *sym));
49   -P(sym_get_choice_prop,struct property *,(struct symbol *sym));
50   -P(sym_get_default_prop,struct property *,(struct symbol *sym));
51   -P(sym_get_string_value,const char *,(struct symbol *sym));
  31 +struct symbol * sym_lookup(const char *name, int flags);
  32 +struct symbol * sym_find(const char *name);
  33 +const char * sym_expand_string_value(const char *in);
  34 +const char * sym_escape_string_value(const char *in);
  35 +struct symbol ** sym_re_search(const char *pattern);
  36 +const char * sym_type_name(enum symbol_type type);
  37 +void sym_calc_value(struct symbol *sym);
  38 +enum symbol_type sym_get_type(struct symbol *sym);
  39 +bool sym_tristate_within_range(struct symbol *sym,tristate tri);
  40 +bool sym_set_tristate_value(struct symbol *sym,tristate tri);
  41 +tristate sym_toggle_tristate_value(struct symbol *sym);
  42 +bool sym_string_valid(struct symbol *sym, const char *newval);
  43 +bool sym_string_within_range(struct symbol *sym, const char *str);
  44 +bool sym_set_string_value(struct symbol *sym, const char *newval);
  45 +bool sym_is_changable(struct symbol *sym);
  46 +struct property * sym_get_choice_prop(struct symbol *sym);
  47 +const char * sym_get_string_value(struct symbol *sym);
52 48  
53   -P(prop_get_type_name,const char *,(enum prop_type type));
  49 +const char * prop_get_type_name(enum prop_type type);
54 50  
55 51 /* expr.c */
56   -P(expr_compare_type,int,(enum expr_type t1, enum expr_type t2));
57   -P(expr_print,void,(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken));
  52 +void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken);
scripts/kconfig/lxdialog/check-lxdialog.sh
... ... @@ -21,7 +21,11 @@
21 21 # Where is ncurses.h?
22 22 ccflags()
23 23 {
24   - if [ -f /usr/include/ncursesw/curses.h ]; then
  24 + if pkg-config --cflags ncursesw 2>/dev/null; then
  25 + echo '-DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1'
  26 + elif pkg-config --cflags ncurses 2>/dev/null; then
  27 + echo '-DCURSES_LOC="<ncurses.h>"'
  28 + elif [ -f /usr/include/ncursesw/curses.h ]; then
25 29 echo '-I/usr/include/ncursesw -DCURSES_LOC="<curses.h>"'
26 30 echo ' -DNCURSES_WIDECHAR=1'
27 31 elif [ -f /usr/include/ncurses/ncurses.h ]; then
scripts/kconfig/mconf.c
... ... @@ -279,6 +279,7 @@
279 279 static int single_menu_mode;
280 280 static int show_all_options;
281 281 static int save_and_exit;
  282 +static int silent;
282 283  
283 284 static void conf(struct menu *menu, struct menu *active_menu);
284 285 static void conf_choice(struct menu *menu);
285 286  
... ... @@ -330,10 +331,10 @@
330 331 list_for_each_entry(sp, &trail, entries) {
331 332 if (sp->text) {
332 333 if (pos) {
333   - pos->next = xcalloc(sizeof(*pos), 1);
  334 + pos->next = xcalloc(1, sizeof(*pos));
334 335 pos = pos->next;
335 336 } else {
336   - subtitles = pos = xcalloc(sizeof(*pos), 1);
  337 + subtitles = pos = xcalloc(1, sizeof(*pos));
337 338 }
338 339 pos->text = sp->text;
339 340 }
340 341  
... ... @@ -777,10 +778,12 @@
777 778 char buf[PATH_MAX+1];
778 779  
779 780 vsnprintf(buf, sizeof(buf), fmt, ap);
780   - if (save_and_exit)
781   - printf("%s", buf);
782   - else
  781 + if (save_and_exit) {
  782 + if (!silent)
  783 + printf("%s", buf);
  784 + } else {
783 785 show_textbox(NULL, buf, 6, 60);
  786 + }
784 787 }
785 788  
786 789 static void show_help(struct menu *menu)
787 790  
... ... @@ -977,16 +980,18 @@
977 980 }
978 981 /* fall through */
979 982 case -1:
980   - printf(_("\n\n"
981   - "*** End of the configuration.\n"
982   - "*** Execute 'make' to start the build or try 'make help'."
983   - "\n\n"));
  983 + if (!silent)
  984 + printf(_("\n\n"
  985 + "*** End of the configuration.\n"
  986 + "*** Execute 'make' to start the build or try 'make help'."
  987 + "\n\n"));
984 988 res = 0;
985 989 break;
986 990 default:
987   - fprintf(stderr, _("\n\n"
988   - "Your configuration changes were NOT saved."
989   - "\n\n"));
  991 + if (!silent)
  992 + fprintf(stderr, _("\n\n"
  993 + "Your configuration changes were NOT saved."
  994 + "\n\n"));
990 995 if (res != KEY_ESC)
991 996 res = 0;
992 997 }
... ... @@ -1010,6 +1015,12 @@
1010 1015  
1011 1016 signal(SIGINT, sig_handler);
1012 1017  
  1018 + if (ac > 1 && strcmp(av[1], "-s") == 0) {
  1019 + silent = 1;
  1020 + /* Silence conf_read() until the real callback is set up */
  1021 + conf_set_message_callback(NULL);
  1022 + av++;
  1023 + }
1013 1024 conf_parse(av[1]);
1014 1025 conf_read(NULL);
1015 1026  
scripts/kconfig/menu.c
... ... @@ -125,7 +125,7 @@
125 125 sym_type_name(sym->type), sym_type_name(type));
126 126 }
127 127  
128   -struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep)
  128 +static struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep)
129 129 {
130 130 struct property *prop = prop_alloc(type, current_entry->sym);
131 131  
... ... @@ -615,7 +615,7 @@
615 615 /*
616 616 * head is optional and may be NULL
617 617 */
618   -void get_symbol_str(struct gstr *r, struct symbol *sym,
  618 +static void get_symbol_str(struct gstr *r, struct symbol *sym,
619 619 struct list_head *head)
620 620 {
621 621 bool hit;
scripts/kconfig/merge_config.sh
... ... @@ -35,7 +35,7 @@
35 35 echo " -O dir to put generated output files"
36 36 }
37 37  
38   -MAKE=true
  38 +RUNMAKE=true
39 39 ALLTARGET=alldefconfig
40 40 WARNREDUN=false
41 41 OUTPUT=.
... ... @@ -48,7 +48,7 @@
48 48 continue
49 49 ;;
50 50 "-m")
51   - MAKE=false
  51 + RUNMAKE=false
52 52 shift
53 53 continue
54 54 ;;
55 55  
... ... @@ -77,9 +77,19 @@
77 77 esac
78 78 done
79 79  
  80 +if [ "$#" -lt 2 ] ; then
  81 + usage
  82 + exit
  83 +fi
  84 +
80 85 INITFILE=$1
81 86 shift;
82 87  
  88 +if [ ! -r "$INITFILE" ]; then
  89 + echo "The base file '$INITFILE' does not exist. Exit." >&2
  90 + exit 1
  91 +fi
  92 +
83 93 MERGE_LIST=$*
84 94 SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p"
85 95 TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX)
86 96  
87 97  
88 98  
89 99  
... ... @@ -93,25 +103,23 @@
93 103 CFG_LIST=$(sed -n "$SED_CONFIG_EXP" $MERGE_FILE)
94 104  
95 105 for CFG in $CFG_LIST ; do
96   - grep -q -w $CFG $TMP_FILE
97   - if [ $? -eq 0 ] ; then
98   - PREV_VAL=$(grep -w $CFG $TMP_FILE)
99   - NEW_VAL=$(grep -w $CFG $MERGE_FILE)
100   - if [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then
  106 + grep -q -w $CFG $TMP_FILE || continue
  107 + PREV_VAL=$(grep -w $CFG $TMP_FILE)
  108 + NEW_VAL=$(grep -w $CFG $MERGE_FILE)
  109 + if [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then
101 110 echo Value of $CFG is redefined by fragment $MERGE_FILE:
102 111 echo Previous value: $PREV_VAL
103 112 echo New value: $NEW_VAL
104 113 echo
105   - elif [ "$WARNREDUN" = "true" ]; then
  114 + elif [ "$WARNREDUN" = "true" ]; then
106 115 echo Value of $CFG is redundant by fragment $MERGE_FILE:
107   - fi
108   - sed -i "/$CFG[ =]/d" $TMP_FILE
109 116 fi
  117 + sed -i "/$CFG[ =]/d" $TMP_FILE
110 118 done
111 119 cat $MERGE_FILE >> $TMP_FILE
112 120 done
113 121  
114   -if [ "$MAKE" = "false" ]; then
  122 +if [ "$RUNMAKE" = "false" ]; then
115 123 cp $TMP_FILE $OUTPUT/.config
116 124 echo "#"
117 125 echo "# merged configuration written to $OUTPUT/.config (needs make)"
scripts/kconfig/nconf.c
... ... @@ -1482,6 +1482,11 @@
1482 1482 bindtextdomain(PACKAGE, LOCALEDIR);
1483 1483 textdomain(PACKAGE);
1484 1484  
  1485 + if (ac > 1 && strcmp(av[1], "-s") == 0) {
  1486 + /* Silence conf_read() until the real callback is set up */
  1487 + conf_set_message_callback(NULL);
  1488 + av++;
  1489 + }
1485 1490 conf_parse(av[1]);
1486 1491 conf_read(NULL);
1487 1492  
scripts/kconfig/qconf.cc
... ... @@ -1746,7 +1746,7 @@
1746 1746  
1747 1747 static void usage(void)
1748 1748 {
1749   - printf(_("%s <config>\n"), progname);
  1749 + printf(_("%s [-s] <config>\n"), progname);
1750 1750 exit(0);
1751 1751 }
1752 1752  
... ... @@ -1762,6 +1762,9 @@
1762 1762 configApp = new QApplication(ac, av);
1763 1763 if (ac > 1 && av[1][0] == '-') {
1764 1764 switch (av[1][1]) {
  1765 + case 's':
  1766 + conf_set_message_callback(NULL);
  1767 + break;
1765 1768 case 'h':
1766 1769 case '?':
1767 1770 usage();
scripts/kconfig/symbol.c
... ... @@ -112,7 +112,7 @@
112 112 return NULL;
113 113 }
114 114  
115   -struct property *sym_get_default_prop(struct symbol *sym)
  115 +static struct property *sym_get_default_prop(struct symbol *sym)
116 116 {
117 117 struct property *prop;
118 118  
... ... @@ -186,6 +186,26 @@
186 186 sym->curr.val = strdup(str);
187 187 }
188 188  
  189 +static void sym_set_changed(struct symbol *sym)
  190 +{
  191 + struct property *prop;
  192 +
  193 + sym->flags |= SYMBOL_CHANGED;
  194 + for (prop = sym->prop; prop; prop = prop->next) {
  195 + if (prop->menu)
  196 + prop->menu->flags |= MENU_CHANGED;
  197 + }
  198 +}
  199 +
  200 +static void sym_set_all_changed(void)
  201 +{
  202 + struct symbol *sym;
  203 + int i;
  204 +
  205 + for_all_symbols(i, sym)
  206 + sym_set_changed(sym);
  207 +}
  208 +
189 209 static void sym_calc_visibility(struct symbol *sym)
190 210 {
191 211 struct property *prop;
... ... @@ -449,26 +469,6 @@
449 469 sym_add_change_count(1);
450 470 if (modules_sym)
451 471 sym_calc_value(modules_sym);
452   -}
453   -
454   -void sym_set_changed(struct symbol *sym)
455   -{
456   - struct property *prop;
457   -
458   - sym->flags |= SYMBOL_CHANGED;
459   - for (prop = sym->prop; prop; prop = prop->next) {
460   - if (prop->menu)
461   - prop->menu->flags |= MENU_CHANGED;
462   - }
463   -}
464   -
465   -void sym_set_all_changed(void)
466   -{
467   - struct symbol *sym;
468   - int i;
469   -
470   - for_all_symbols(i, sym)
471   - sym_set_changed(sym);
472 472 }
473 473  
474 474 bool sym_tristate_within_range(struct symbol *sym, tristate val)
scripts/kconfig/util.c
... ... @@ -88,16 +88,6 @@
88 88 return gs;
89 89 }
90 90  
91   -/* Allocate and assign growable string */
92   -struct gstr str_assign(const char *s)
93   -{
94   - struct gstr gs;
95   - gs.s = strdup(s);
96   - gs.len = strlen(s) + 1;
97   - gs.max_width = 0;
98   - return gs;
99   -}
100   -
101 91 /* Free storage for growable string */
102 92 void str_free(struct gstr *gs)
103 93 {