Skip to content

Commit 14cd0bd

Browse files
committed
Merge tag 'kconfig-v5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kconfig updates from Masahiro Yamada: - add 'yes2modconfig' and 'mod2yesconfig' targets (useful mainly for turning syzbot configs into more modular ones as a step to minimizing the result) - sanitize help text - various code cleanups * tag 'kconfig-v5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: kconfig: fix documentation typos kconfig: fix an "implicit declaration of function" warning kconfig: fix nesting of symbol help text kconfig: distinguish between dependencies and visibility in help text kconfig: list all definitions of a symbol in help text kconfig: Add yes2modconfig and mod2yesconfig targets. kconfig: use $(PERL) in Makefile kconfig: fix too deep indentation in Makefile kconfig: localmodconfig: fix indentation for closing brace kconfig: localmodconfig: remove unused $config kconfig: squash prop_alloc() into menu_add_prop() kconfig: remove sym from struct property kconfig: remove 'prompt' argument from menu_add_prop() kconfig: move prompt handling to menu_add_prompt() from menu_add_prop() kconfig: remove 'prompt' symbol kconfig: drop T_WORD from the RHS of 'prompt' symbol kconfig: use parent->dep as the parentdep of 'menu' kconfig: remove the rootmenu check in menu_add_prop()
2 parents 368d060 + 2b5072b commit 14cd0bd

File tree

14 files changed

+174
-133
lines changed

14 files changed

+174
-133
lines changed

Documentation/kbuild/kconfig-language.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,8 @@ The two different resolutions for b) can be tested in the sample Kconfig file
591591
Documentation/kbuild/Kconfig.recursion-issue-02.
592592

593593
Below is a list of examples of prior fixes for these types of recursive issues;
594-
all errors appear to involve one or more select's and one or more "depends on".
594+
all errors appear to involve one or more "select" statements and one or more
595+
"depends on".
595596

596597
============ ===================================
597598
commit fix
@@ -653,7 +654,7 @@ the use of the xconfig configurator [1]_. Work should be done to confirm if
653654
the deduced semantics matches our intended Kconfig design goals.
654655

655656
Having well defined semantics can be useful for tools for practical
656-
evaluation of depenencies, for instance one such use known case was work to
657+
evaluation of dependencies, for instance one such case was work to
657658
express in boolean abstraction of the inferred semantics of Kconfig to
658659
translate Kconfig logic into boolean formulas and run a SAT solver on this to
659660
find dead code / features (always inactive), 114 dead features were found in
@@ -680,7 +681,7 @@ abstraction the inferred semantics of Kconfig to translate Kconfig logic into
680681
boolean formulas and run a SAT solver on it [5]_. Another known related project
681682
is CADOS [6]_ (former VAMOS [7]_) and the tools, mainly undertaker [8]_, which
682683
has been introduced first with [9]_. The basic concept of undertaker is to
683-
exract variability models from Kconfig, and put them together with a
684+
extract variability models from Kconfig and put them together with a
684685
propositional formula extracted from CPP #ifdefs and build-rules into a SAT
685686
solver in order to find dead code, dead files, and dead symbols. If using a SAT
686687
solver is desirable on Kconfig one approach would be to evaluate repurposing

scripts/kconfig/Makefile

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ build_gconfig: $(obj)/gconf
4747
build_xconfig: $(obj)/qconf
4848

4949
localyesconfig localmodconfig: $(obj)/conf
50-
$(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config
51-
$(Q)if [ -f .config ]; then \
52-
cmp -s .tmp.config .config || \
53-
(mv -f .config .config.old.1; \
54-
mv -f .tmp.config .config; \
55-
$< $(silent) --oldconfig $(Kconfig); \
56-
mv -f .config.old.1 .config.old) \
57-
else \
58-
mv -f .tmp.config .config; \
59-
$< $(silent) --oldconfig $(Kconfig); \
50+
$(Q)$(PERL) $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config
51+
$(Q)if [ -f .config ]; then \
52+
cmp -s .tmp.config .config || \
53+
(mv -f .config .config.old.1; \
54+
mv -f .tmp.config .config; \
55+
$< $(silent) --oldconfig $(Kconfig); \
56+
mv -f .config.old.1 .config.old) \
57+
else \
58+
mv -f .tmp.config .config; \
59+
$< $(silent) --oldconfig $(Kconfig); \
6060
fi
6161
$(Q)rm -f .tmp.config
6262

@@ -67,7 +67,7 @@ localyesconfig localmodconfig: $(obj)/conf
6767
# deprecated for external use
6868
simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
6969
alldefconfig randconfig listnewconfig olddefconfig syncconfig \
70-
helpnewconfig
70+
helpnewconfig yes2modconfig mod2yesconfig
7171

7272
PHONY += $(simple-targets)
7373

@@ -135,6 +135,8 @@ help:
135135
@echo ' allmodconfig - New config selecting modules when possible'
136136
@echo ' alldefconfig - New config with all symbols set to default'
137137
@echo ' randconfig - New config with random answer to all options'
138+
@echo ' yes2modconfig - Change answers from yes to mod if possible'
139+
@echo ' mod2yesconfig - Change answers from mod to yes if possible'
138140
@echo ' listnewconfig - List new options'
139141
@echo ' helpnewconfig - List new options and help text'
140142
@echo ' olddefconfig - Same as oldconfig but sets new symbols to their'

scripts/kconfig/conf.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ enum input_mode {
3434
listnewconfig,
3535
helpnewconfig,
3636
olddefconfig,
37+
yes2modconfig,
38+
mod2yesconfig,
3739
};
3840
static enum input_mode input_mode = oldaskconfig;
3941

@@ -467,6 +469,8 @@ static struct option long_opts[] = {
467469
{"listnewconfig", no_argument, NULL, listnewconfig},
468470
{"helpnewconfig", no_argument, NULL, helpnewconfig},
469471
{"olddefconfig", no_argument, NULL, olddefconfig},
472+
{"yes2modconfig", no_argument, NULL, yes2modconfig},
473+
{"mod2yesconfig", no_argument, NULL, mod2yesconfig},
470474
{NULL, 0, NULL, 0}
471475
};
472476

@@ -489,6 +493,8 @@ static void conf_usage(const char *progname)
489493
printf(" --allmodconfig New config where all options are answered with mod\n");
490494
printf(" --alldefconfig New config with all symbols set to default\n");
491495
printf(" --randconfig New config with random answer to all options\n");
496+
printf(" --yes2modconfig Change answers from yes to mod if possible\n");
497+
printf(" --mod2yesconfig Change answers from mod to yes if possible\n");
492498
}
493499

494500
int main(int ac, char **av)
@@ -553,6 +559,8 @@ int main(int ac, char **av)
553559
case listnewconfig:
554560
case helpnewconfig:
555561
case olddefconfig:
562+
case yes2modconfig:
563+
case mod2yesconfig:
556564
break;
557565
case '?':
558566
conf_usage(progname);
@@ -587,6 +595,8 @@ int main(int ac, char **av)
587595
case listnewconfig:
588596
case helpnewconfig:
589597
case olddefconfig:
598+
case yes2modconfig:
599+
case mod2yesconfig:
590600
conf_read(NULL);
591601
break;
592602
case allnoconfig:
@@ -660,6 +670,12 @@ int main(int ac, char **av)
660670
break;
661671
case savedefconfig:
662672
break;
673+
case yes2modconfig:
674+
conf_rewrite_mod_or_yes(def_y2m);
675+
break;
676+
case mod2yesconfig:
677+
conf_rewrite_mod_or_yes(def_m2y);
678+
break;
663679
case oldaskconfig:
664680
rootEntry = &rootmenu;
665681
conf(&rootmenu);

scripts/kconfig/confdata.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,3 +1321,19 @@ bool conf_set_all_new_symbols(enum conf_def_mode mode)
13211321

13221322
return has_changed;
13231323
}
1324+
1325+
void conf_rewrite_mod_or_yes(enum conf_def_mode mode)
1326+
{
1327+
struct symbol *sym;
1328+
int i;
1329+
tristate old_val = (mode == def_y2m) ? yes : mod;
1330+
tristate new_val = (mode == def_y2m) ? mod : yes;
1331+
1332+
for_all_symbols(i, sym) {
1333+
if (sym_get_type(sym) == S_TRISTATE &&
1334+
sym->def[S_DEF_USER].tri == old_val) {
1335+
sym->def[S_DEF_USER].tri = new_val;
1336+
sym_add_change_count(1);
1337+
}
1338+
}
1339+
}

scripts/kconfig/expr.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
#define DEBUG_EXPR 0
1515

16-
static int expr_eq(struct expr *e1, struct expr *e2);
1716
static struct expr *expr_eliminate_yn(struct expr *e);
1817

1918
struct expr *expr_alloc_symbol(struct symbol *sym)
@@ -250,7 +249,7 @@ void expr_eliminate_eq(struct expr **ep1, struct expr **ep2)
250249
* equals some operand in the other (operands do not need to appear in the same
251250
* order), recursively.
252251
*/
253-
static int expr_eq(struct expr *e1, struct expr *e2)
252+
int expr_eq(struct expr *e1, struct expr *e2)
254253
{
255254
int res, old_count;
256255

scripts/kconfig/expr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ enum prop_type {
191191

192192
struct property {
193193
struct property *next; /* next property - null if last */
194-
struct symbol *sym; /* the symbol for which the property is associated */
195194
enum prop_type type; /* type of property */
196195
const char *text; /* the prompt value - P_PROMPT, P_MENU, P_COMMENT */
197196
struct expr_value visible;
@@ -301,6 +300,7 @@ struct expr *expr_alloc_or(struct expr *e1, struct expr *e2);
301300
struct expr *expr_copy(const struct expr *org);
302301
void expr_free(struct expr *e);
303302
void expr_eliminate_eq(struct expr **ep1, struct expr **ep2);
303+
int expr_eq(struct expr *e1, struct expr *e2);
304304
tristate expr_calc_value(struct expr *e);
305305
struct expr *expr_trans_bool(struct expr *e);
306306
struct expr *expr_eliminate_dups(struct expr *e);

scripts/kconfig/gconf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <stdio.h>
2020
#include <string.h>
21+
#include <strings.h>
2122
#include <unistd.h>
2223
#include <time.h>
2324

scripts/kconfig/lkc.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ enum conf_def_mode {
3434
def_default,
3535
def_yes,
3636
def_mod,
37+
def_y2m,
38+
def_m2y,
3739
def_no,
3840
def_random
3941
};
@@ -52,6 +54,7 @@ const char *conf_get_configname(void);
5254
void sym_set_change_count(int count);
5355
void sym_add_change_count(int count);
5456
bool conf_set_all_new_symbols(enum conf_def_mode mode);
57+
void conf_rewrite_mod_or_yes(enum conf_def_mode mode);
5558
void set_all_choice_values(struct symbol *csym);
5659

5760
/* confdata.c and expr.c */
@@ -112,7 +115,6 @@ struct symbol *sym_choice_default(struct symbol *sym);
112115
struct property *sym_get_range_prop(struct symbol *sym);
113116
const char *sym_get_string_default(struct symbol *sym);
114117
struct symbol *sym_check_deps(struct symbol *sym);
115-
struct property *prop_alloc(enum prop_type type, struct symbol *sym);
116118
struct symbol *prop_get_symbol(struct property *prop);
117119

118120
static inline tristate sym_get_tristate_value(struct symbol *sym)

scripts/kconfig/mconf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <stdarg.h>
1616
#include <stdlib.h>
1717
#include <string.h>
18+
#include <strings.h>
1819
#include <signal.h>
1920
#include <unistd.h>
2021

0 commit comments

Comments
 (0)