Skip to content

Commit

Permalink
Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/g…
Browse files Browse the repository at this point in the history
…it/mmarek/kbuild

Pull kconfig updates from Michal Marek:
 "This is the kconfig part of kbuild for v3.12-rc1:
   - post-3.11 search code fixes and micro-optimizations
   - CONFIG_MODULES is no longer a special case; this is needed to
     eventually fix the bug that using KCONFIG_ALLCONFIG breaks
     allmodconfig
   - long long is used to store hex and int values
   - make silentoldconfig no longer warns when a symbol changes from
     tristate to bool (it's a job for make oldconfig)
   - scripts/diffconfig updated to work with newer Pythons
   - scripts/config does not rely on GNU sed extensions"

* 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
  kconfig: do not allow more than one symbol to have 'option modules'
  kconfig: regenerate bison parser
  kconfig: do not special-case 'MODULES' symbol
  diffconfig: Update script to support python versions 2.5 through 3.3
  diffconfig: Gracefully exit if the default config files are not present
  modules: do not depend on kconfig to set 'modules' option to symbol MODULES
  kconfig: silence warning when parsing auto.conf when a symbol has changed type
  scripts/config: use sed's POSIX interface
  kconfig: switch to "long long" for sanity
  kconfig: simplify symbol-search code
  kconfig: don't allocate n+1 elements in temporary array
  kconfig: minor style fixes in symbol-search code
  kconfig/[mn]conf: shorten title in search-box
  kconfig: avoid multiple calls to strlen
  Documentation/kconfig: more concise and straightforward search explanation
  • Loading branch information
torvalds committed Sep 11, 2013
2 parents a22a0fd + e062781 commit 5b41978
Show file tree
Hide file tree
Showing 12 changed files with 413 additions and 345 deletions.
1 change: 1 addition & 0 deletions Documentation/kbuild/kconfig-language.txt
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ applicable everywhere (see syntax).
- "modules"
This declares the symbol to be used as the MODULES symbol, which
enables the third modular state for all config symbols.
At most one symbol may have the "modules" option set.

- "env"=<value>
This imports the environment variable into Kconfig. It behaves like
Expand Down
8 changes: 3 additions & 5 deletions Documentation/kbuild/kconfig.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,9 @@ Searching in menuconfig:
/^hotplug

When searching, symbols are sorted thus:
- exact match first: an exact match is when the search matches
the complete symbol name;
- alphabetical order: when two symbols do not match exactly,
they are sorted in alphabetical order (in the user's current
locale).
- first, exact matches, sorted alphabetically (an exact match
is when the search matches the complete symbol name);
- then, other matches, sorted alphabetically.
For example: ^ATH.K matches:
ATH5K ATH9K ATH5K_AHB ATH5K_DEBUG [...] ATH6KL ATH6KL_DEBUG
[...] ATH9K_AHB ATH9K_BTCOEX_SUPPORT ATH9K_COMMON [...]
Expand Down
1 change: 1 addition & 0 deletions init/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1670,6 +1670,7 @@ config BASE_SMALL

menuconfig MODULES
bool "Enable loadable module support"
option modules
help
Kernel modules are small pieces of compiled code which can
be inserted in the running kernel, rather than being
Expand Down
44 changes: 41 additions & 3 deletions scripts/config
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,52 @@ checkarg() {
fi
}

txt_append() {
local anchor="$1"
local insert="$2"
local infile="$3"
local tmpfile="$infile.swp"

# sed append cmd: 'a\' + newline + text + newline
cmd="$(printf "a\\%b$insert" "\n")"

sed -e "/$anchor/$cmd" "$infile" >"$tmpfile"
# replace original file with the edited one
mv "$tmpfile" "$infile"
}

txt_subst() {
local before="$1"
local after="$2"
local infile="$3"
local tmpfile="$infile.swp"

sed -e "s/$before/$after/" "$infile" >"$tmpfile"
# replace original file with the edited one
mv "$tmpfile" "$infile"
}

txt_delete() {
local text="$1"
local infile="$2"
local tmpfile="$infile.swp"

sed -e "/$text/d" "$infile" >"$tmpfile"
# replace original file with the edited one
mv "$tmpfile" "$infile"
}

set_var() {
local name=$1 new=$2 before=$3

name_re="^($name=|# $name is not set)"
before_re="^($before=|# $before is not set)"
if test -n "$before" && grep -Eq "$before_re" "$FN"; then
sed -ri "/$before_re/a $new" "$FN"
txt_append "^$before=" "$new" "$FN"
txt_append "^# $before is not set" "$new" "$FN"
elif grep -Eq "$name_re" "$FN"; then
sed -ri "s:$name_re.*:$new:" "$FN"
txt_subst "^$name=.*" "$new" "$FN"
txt_subst "^# $name is not set" "$new" "$FN"
else
echo "$new" >>"$FN"
fi
Expand All @@ -79,7 +116,8 @@ set_var() {
undef_var() {
local name=$1

sed -ri "/^($name=|# $name is not set)/d" "$FN"
txt_delete "^$name=" "$FN"
txt_delete "^# $name is not set" "$FN"
}

if [ "$1" = "--file" ]; then
Expand Down
33 changes: 18 additions & 15 deletions scripts/diffconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import sys, os

def usage():
print """Usage: diffconfig [-h] [-m] [<config1> <config2>]
print("""Usage: diffconfig [-h] [-m] [<config1> <config2>]
Diffconfig is a simple utility for comparing two .config files.
Using standard diff to compare .config files often includes extraneous and
Expand All @@ -33,7 +33,7 @@ Example usage:
EXT2_FS y -> n
LOG_BUF_SHIFT 14 -> 16
PRINTK_TIME n -> y
"""
""")
sys.exit(0)

# returns a dictionary of name/value pairs for config items in the file
Expand All @@ -54,23 +54,23 @@ def print_config(op, config, value, new_value):
if merge_style:
if new_value:
if new_value=="n":
print "# CONFIG_%s is not set" % config
print("# CONFIG_%s is not set" % config)
else:
print "CONFIG_%s=%s" % (config, new_value)
print("CONFIG_%s=%s" % (config, new_value))
else:
if op=="-":
print "-%s %s" % (config, value)
print("-%s %s" % (config, value))
elif op=="+":
print "+%s %s" % (config, new_value)
print("+%s %s" % (config, new_value))
else:
print " %s %s -> %s" % (config, value, new_value)
print(" %s %s -> %s" % (config, value, new_value))

def main():
global merge_style

# parse command line args
if ("-h" in sys.argv or "--help" in sys.argv):
usage()
usage()

merge_style = 0
if "-m" in sys.argv:
Expand All @@ -79,23 +79,27 @@ def main():

argc = len(sys.argv)
if not (argc==1 or argc == 3):
print "Error: incorrect number of arguments or unrecognized option"
print("Error: incorrect number of arguments or unrecognized option")
usage()

if argc == 1:
# if no filenames given, assume .config and .config.old
build_dir=""
if os.environ.has_key("KBUILD_OUTPUT"):
if "KBUILD_OUTPUT" in os.environ:
build_dir = os.environ["KBUILD_OUTPUT"]+"/"

configa_filename = build_dir + ".config.old"
configb_filename = build_dir + ".config"
else:
configa_filename = sys.argv[1]
configb_filename = sys.argv[2]

a = readconfig(file(configa_filename))
b = readconfig(file(configb_filename))
try:
a = readconfig(open(configa_filename))
b = readconfig(open(configb_filename))
except (IOError):
e = sys.exc_info()[1]
print("I/O error[%s]: %s\n" % (e.args[0],e.args[1]))
usage()

# print items in a but not b (accumulate, sort and print)
old = []
Expand All @@ -121,8 +125,7 @@ def main():

# now print items in b but not in a
# (items from b that were in a were removed above)
new = b.keys()
new.sort()
new = sorted(b.keys())
for config in new:
print_config("+", config, None, b[config])

Expand Down
11 changes: 8 additions & 3 deletions scripts/kconfig/confdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
sym->flags |= def_flags;
break;
}
conf_warning("symbol value '%s' invalid for %s", p, sym->name);
if (def != S_DEF_AUTO)
conf_warning("symbol value '%s' invalid for %s",
p, sym->name);
return 1;
case S_OTHER:
if (*p != '"') {
Expand All @@ -161,7 +163,8 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
memmove(p2, p2 + 1, strlen(p2));
}
if (!p2) {
conf_warning("invalid string found");
if (def != S_DEF_AUTO)
conf_warning("invalid string found");
return 1;
}
/* fall through */
Expand All @@ -172,7 +175,9 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
sym->def[def].val = strdup(p);
sym->flags |= def_flags;
} else {
conf_warning("symbol value '%s' invalid for %s", p, sym->name);
if (def != S_DEF_AUTO)
conf_warning("symbol value '%s' invalid for %s",
p, sym->name);
return 1;
}
break;
Expand Down
4 changes: 2 additions & 2 deletions scripts/kconfig/mconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,8 @@ static void search_conf(void)
struct subtitle_part stpart;

title = str_new();
str_printf( &title, _("Enter %s (sub)string or regexp to search for "
"(with or without \"%s\")"), CONFIG_, CONFIG_);
str_printf( &title, _("Enter (sub)string or regexp to search for "
"(with or without \"%s\")"), CONFIG_);

again:
dialog_clear();
Expand Down
11 changes: 7 additions & 4 deletions scripts/kconfig/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,15 @@ void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep)

void menu_add_option(int token, char *arg)
{
struct property *prop;

switch (token) {
case T_OPT_MODULES:
prop = prop_alloc(P_DEFAULT, modules_sym);
prop->expr = expr_alloc_symbol(current_entry->sym);
if (modules_sym)
zconf_error("symbol '%s' redefines option 'modules'"
" already defined by symbol '%s'",
current_entry->sym->name,
modules_sym->name
);
modules_sym = current_entry->sym;
break;
case T_OPT_DEFCONFIG_LIST:
if (!sym_defconfig_list)
Expand Down
4 changes: 2 additions & 2 deletions scripts/kconfig/nconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,8 +695,8 @@ static void search_conf(void)
int dres;

title = str_new();
str_printf( &title, _("Enter %s (sub)string or regexp to search for "
"(with or without \"%s\")"), CONFIG_, CONFIG_);
str_printf( &title, _("Enter (sub)string or regexp to search for "
"(with or without \"%s\")"), CONFIG_);

again:
dres = dialog_inputbox(main_window,
Expand Down
Loading

0 comments on commit 5b41978

Please sign in to comment.