summaryrefslogtreecommitdiffstats
path: root/package/config/patches/09-implement-kconfig-probability.patch
diff options
context:
space:
mode:
Diffstat (limited to 'package/config/patches/09-implement-kconfig-probability.patch')
-rw-r--r--package/config/patches/09-implement-kconfig-probability.patch25
1 files changed, 13 insertions, 12 deletions
diff --git a/package/config/patches/09-implement-kconfig-probability.patch b/package/config/patches/09-implement-kconfig-probability.patch
index 7adfc0b17..7561fbc3c 100644
--- a/package/config/patches/09-implement-kconfig-probability.patch
+++ b/package/config/patches/09-implement-kconfig-probability.patch
@@ -1,17 +1,17 @@
---
- confdata.c | 21 +++++++++++++++++++--
- 1 file changed, 19 insertions(+), 2 deletions(-)
+ confdata.c | 22 +++++++++++++++++++---
+ 1 file changed, 19 insertions(+), 3 deletions(-)
-Index: config.clean/confdata.c
+Index: config/confdata.c
===================================================================
---- config.clean.orig/confdata.c
-+++ config.clean/confdata.c
-@@ -812,7 +812,16 @@
+--- config.orig/confdata.c
++++ config/confdata.c
+@@ -977,7 +977,16 @@
+ void conf_set_all_new_symbols(enum conf_def_mode mode)
+ {
struct symbol *sym, *csym;
- struct property *prop;
- struct expr *e;
-- int i, cnt, def;
-+ int i, cnt, def, prob = 50;
+- int i, cnt;
++ int i, cnt, prob = 50;
+
+ if (mode == def_random) {
+ char *endp, *env = getenv("KCONFIG_PROBABILITY");
@@ -24,11 +24,12 @@ Index: config.clean/confdata.c
for_all_symbols(i, sym) {
if (sym_has_value(sym))
-@@ -831,7 +840,15 @@
+@@ -996,8 +1005,15 @@
sym->def[S_DEF_USER].tri = no;
break;
case def_random:
-- sym->def[S_DEF_USER].tri = (tristate)(rand() % 3);
+- cnt = sym_get_type(sym) == S_TRISTATE ? 3 : 2;
+- sym->def[S_DEF_USER].tri = (tristate)(rand() % cnt);
+ cnt = (rand() % 100) - (100 - prob);
+ if (cnt < 0)
+ sym->def[S_DEF_USER].tri = no;