Skip to content

Commit

Permalink
Merge tag 'kconfig-v5.6' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/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()
  • Loading branch information
torvalds committed Feb 1, 2020
2 parents 368d060 + 2b5072b commit 14cd0bd
Show file tree
Hide file tree
Showing 14 changed files with 174 additions and 133 deletions.
7 changes: 4 additions & 3 deletions Documentation/kbuild/kconfig-language.rst
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,8 @@ The two different resolutions for b) can be tested in the sample Kconfig file
Documentation/kbuild/Kconfig.recursion-issue-02.

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

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

Having well defined semantics can be useful for tools for practical
evaluation of depenencies, for instance one such use known case was work to
evaluation of dependencies, for instance one such case was work to
express in boolean abstraction of the inferred semantics of Kconfig to
translate Kconfig logic into boolean formulas and run a SAT solver on this to
find dead code / features (always inactive), 114 dead features were found in
Expand All @@ -680,7 +681,7 @@ abstraction the inferred semantics of Kconfig to translate Kconfig logic into
boolean formulas and run a SAT solver on it [5]_. Another known related project
is CADOS [6]_ (former VAMOS [7]_) and the tools, mainly undertaker [8]_, which
has been introduced first with [9]_. The basic concept of undertaker is to
exract variability models from Kconfig, and put them together with a
extract variability models from Kconfig and put them together with a
propositional formula extracted from CPP #ifdefs and build-rules into a SAT
solver in order to find dead code, dead files, and dead symbols. If using a SAT
solver is desirable on Kconfig one approach would be to evaluate repurposing
Expand Down
24 changes: 13 additions & 11 deletions scripts/kconfig/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ build_gconfig: $(obj)/gconf
build_xconfig: $(obj)/qconf

localyesconfig localmodconfig: $(obj)/conf
$(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config
$(Q)if [ -f .config ]; then \
cmp -s .tmp.config .config || \
(mv -f .config .config.old.1; \
mv -f .tmp.config .config; \
$< $(silent) --oldconfig $(Kconfig); \
mv -f .config.old.1 .config.old) \
else \
mv -f .tmp.config .config; \
$< $(silent) --oldconfig $(Kconfig); \
$(Q)$(PERL) $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config
$(Q)if [ -f .config ]; then \
cmp -s .tmp.config .config || \
(mv -f .config .config.old.1; \
mv -f .tmp.config .config; \
$< $(silent) --oldconfig $(Kconfig); \
mv -f .config.old.1 .config.old) \
else \
mv -f .tmp.config .config; \
$< $(silent) --oldconfig $(Kconfig); \
fi
$(Q)rm -f .tmp.config

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

PHONY += $(simple-targets)

Expand Down Expand Up @@ -135,6 +135,8 @@ help:
@echo ' allmodconfig - New config selecting modules when possible'
@echo ' alldefconfig - New config with all symbols set to default'
@echo ' randconfig - New config with random answer to all options'
@echo ' yes2modconfig - Change answers from yes to mod if possible'
@echo ' mod2yesconfig - Change answers from mod to yes if possible'
@echo ' listnewconfig - List new options'
@echo ' helpnewconfig - List new options and help text'
@echo ' olddefconfig - Same as oldconfig but sets new symbols to their'
Expand Down
16 changes: 16 additions & 0 deletions scripts/kconfig/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ enum input_mode {
listnewconfig,
helpnewconfig,
olddefconfig,
yes2modconfig,
mod2yesconfig,
};
static enum input_mode input_mode = oldaskconfig;

Expand Down Expand Up @@ -467,6 +469,8 @@ static struct option long_opts[] = {
{"listnewconfig", no_argument, NULL, listnewconfig},
{"helpnewconfig", no_argument, NULL, helpnewconfig},
{"olddefconfig", no_argument, NULL, olddefconfig},
{"yes2modconfig", no_argument, NULL, yes2modconfig},
{"mod2yesconfig", no_argument, NULL, mod2yesconfig},
{NULL, 0, NULL, 0}
};

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

int main(int ac, char **av)
Expand Down Expand Up @@ -553,6 +559,8 @@ int main(int ac, char **av)
case listnewconfig:
case helpnewconfig:
case olddefconfig:
case yes2modconfig:
case mod2yesconfig:
break;
case '?':
conf_usage(progname);
Expand Down Expand Up @@ -587,6 +595,8 @@ int main(int ac, char **av)
case listnewconfig:
case helpnewconfig:
case olddefconfig:
case yes2modconfig:
case mod2yesconfig:
conf_read(NULL);
break;
case allnoconfig:
Expand Down Expand Up @@ -660,6 +670,12 @@ int main(int ac, char **av)
break;
case savedefconfig:
break;
case yes2modconfig:
conf_rewrite_mod_or_yes(def_y2m);
break;
case mod2yesconfig:
conf_rewrite_mod_or_yes(def_m2y);
break;
case oldaskconfig:
rootEntry = &rootmenu;
conf(&rootmenu);
Expand Down
16 changes: 16 additions & 0 deletions scripts/kconfig/confdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -1321,3 +1321,19 @@ bool conf_set_all_new_symbols(enum conf_def_mode mode)

return has_changed;
}

void conf_rewrite_mod_or_yes(enum conf_def_mode mode)
{
struct symbol *sym;
int i;
tristate old_val = (mode == def_y2m) ? yes : mod;
tristate new_val = (mode == def_y2m) ? mod : yes;

for_all_symbols(i, sym) {
if (sym_get_type(sym) == S_TRISTATE &&
sym->def[S_DEF_USER].tri == old_val) {
sym->def[S_DEF_USER].tri = new_val;
sym_add_change_count(1);
}
}
}
3 changes: 1 addition & 2 deletions scripts/kconfig/expr.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

#define DEBUG_EXPR 0

static int expr_eq(struct expr *e1, struct expr *e2);
static struct expr *expr_eliminate_yn(struct expr *e);

struct expr *expr_alloc_symbol(struct symbol *sym)
Expand Down Expand Up @@ -250,7 +249,7 @@ void expr_eliminate_eq(struct expr **ep1, struct expr **ep2)
* equals some operand in the other (operands do not need to appear in the same
* order), recursively.
*/
static int expr_eq(struct expr *e1, struct expr *e2)
int expr_eq(struct expr *e1, struct expr *e2)
{
int res, old_count;

Expand Down
2 changes: 1 addition & 1 deletion scripts/kconfig/expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ enum prop_type {

struct property {
struct property *next; /* next property - null if last */
struct symbol *sym; /* the symbol for which the property is associated */
enum prop_type type; /* type of property */
const char *text; /* the prompt value - P_PROMPT, P_MENU, P_COMMENT */
struct expr_value visible;
Expand Down Expand Up @@ -301,6 +300,7 @@ struct expr *expr_alloc_or(struct expr *e1, struct expr *e2);
struct expr *expr_copy(const struct expr *org);
void expr_free(struct expr *e);
void expr_eliminate_eq(struct expr **ep1, struct expr **ep2);
int expr_eq(struct expr *e1, struct expr *e2);
tristate expr_calc_value(struct expr *e);
struct expr *expr_trans_bool(struct expr *e);
struct expr *expr_eliminate_dups(struct expr *e);
Expand Down
1 change: 1 addition & 0 deletions scripts/kconfig/gconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <time.h>

Expand Down
4 changes: 3 additions & 1 deletion scripts/kconfig/lkc.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ enum conf_def_mode {
def_default,
def_yes,
def_mod,
def_y2m,
def_m2y,
def_no,
def_random
};
Expand All @@ -52,6 +54,7 @@ const char *conf_get_configname(void);
void sym_set_change_count(int count);
void sym_add_change_count(int count);
bool conf_set_all_new_symbols(enum conf_def_mode mode);
void conf_rewrite_mod_or_yes(enum conf_def_mode mode);
void set_all_choice_values(struct symbol *csym);

/* confdata.c and expr.c */
Expand Down Expand Up @@ -112,7 +115,6 @@ struct symbol *sym_choice_default(struct symbol *sym);
struct property *sym_get_range_prop(struct symbol *sym);
const char *sym_get_string_default(struct symbol *sym);
struct symbol *sym_check_deps(struct symbol *sym);
struct property *prop_alloc(enum prop_type type, struct symbol *sym);
struct symbol *prop_get_symbol(struct property *prop);

static inline tristate sym_get_tristate_value(struct symbol *sym)
Expand Down
1 change: 1 addition & 0 deletions scripts/kconfig/mconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <signal.h>
#include <unistd.h>

Expand Down
Loading

0 comments on commit 14cd0bd

Please sign in to comment.