hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/scripts/kconfig/symbol.c
....@@ -1,6 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3
- * Released under the terms of the GNU GPL v2.0.
44 */
55
66 #include <ctype.h>
....@@ -15,15 +15,21 @@
1515 .name = "y",
1616 .curr = { "y", yes },
1717 .flags = SYMBOL_CONST|SYMBOL_VALID,
18
-}, symbol_mod = {
18
+};
19
+
20
+struct symbol symbol_mod = {
1921 .name = "m",
2022 .curr = { "m", mod },
2123 .flags = SYMBOL_CONST|SYMBOL_VALID,
22
-}, symbol_no = {
24
+};
25
+
26
+struct symbol symbol_no = {
2327 .name = "n",
2428 .curr = { "n", no },
2529 .flags = SYMBOL_CONST|SYMBOL_VALID,
26
-}, symbol_empty = {
30
+};
31
+
32
+static struct symbol symbol_empty = {
2733 .name = "",
2834 .curr = { "", no },
2935 .flags = SYMBOL_VALID,
....@@ -31,7 +37,7 @@
3137
3238 struct symbol *sym_defconfig_list;
3339 struct symbol *modules_sym;
34
-tristate modules_val;
40
+static tristate modules_val;
3541
3642 enum symbol_type sym_get_type(struct symbol *sym)
3743 {
....@@ -61,8 +67,6 @@
6167 return "string";
6268 case S_UNKNOWN:
6369 return "unknown";
64
- case S_OTHER:
65
- break;
6670 }
6771 return "???";
6872 }
....@@ -88,7 +92,7 @@
8892 return NULL;
8993 }
9094
91
-static struct property *sym_get_range_prop(struct symbol *sym)
95
+struct property *sym_get_range_prop(struct symbol *sym)
9296 {
9397 struct property *prop;
9498
....@@ -223,7 +227,7 @@
223227 sym_set_changed(sym);
224228 }
225229 tri = no;
226
- if (sym->implied.expr && sym->dir_dep.tri != no)
230
+ if (sym->implied.expr)
227231 tri = expr_calc_value(sym->implied.expr);
228232 if (tri == mod && sym_get_type(sym) == S_BOOLEAN)
229233 tri = yes;
....@@ -396,6 +400,8 @@
396400 if (sym->implied.tri != no) {
397401 sym->flags |= SYMBOL_WRITE;
398402 newval.tri = EXPR_OR(newval.tri, sym->implied.tri);
403
+ newval.tri = EXPR_AND(newval.tri,
404
+ sym->dir_dep.tri);
399405 }
400406 }
401407 calc_newval:
....@@ -403,8 +409,7 @@
403409 sym_warn_unmet_dep(sym);
404410 newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri);
405411 }
406
- if (newval.tri == mod &&
407
- (sym_get_type(sym) == S_BOOLEAN || sym->implied.tri == yes))
412
+ if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN)
408413 newval.tri = yes;
409414 break;
410415 case S_STRING:
....@@ -485,8 +490,6 @@
485490 if (type == S_BOOLEAN && val == mod)
486491 return false;
487492 if (sym->visible <= sym->rev_dep.tri)
488
- return false;
489
- if (sym->implied.tri == yes && val == mod)
490493 return false;
491494 if (sym_is_choice_value(sym) && sym->visible == yes)
492495 return val == yes;
....@@ -757,7 +760,6 @@
757760 return str;
758761 case S_STRING:
759762 return str;
760
- case S_OTHER:
761763 case S_UNKNOWN:
762764 break;
763765 }
....@@ -788,7 +790,7 @@
788790 return (const char *)sym->curr.val;
789791 }
790792
791
-bool sym_is_changable(struct symbol *sym)
793
+bool sym_is_changeable(struct symbol *sym)
792794 {
793795 return sym->visible > sym->rev_dep.tri;
794796 }
....@@ -835,7 +837,7 @@
835837 memset(symbol, 0, sizeof(*symbol));
836838 symbol->name = new_name;
837839 symbol->type = S_UNKNOWN;
838
- symbol->flags |= flags;
840
+ symbol->flags = flags;
839841
840842 symbol->next = symbol_hash[hash];
841843 symbol_hash[hash] = symbol;
....@@ -1117,7 +1119,7 @@
11171119 }
11181120
11191121 fprintf(stderr,
1120
- "For a resolution refer to Documentation/kbuild/kconfig-language.txt\n"
1122
+ "For a resolution refer to Documentation/kbuild/kconfig-language.rst\n"
11211123 "subsection \"Kconfig recursive dependency limitations\"\n"
11221124 "\n");
11231125
....@@ -1274,28 +1276,6 @@
12741276 }
12751277
12761278 return sym2;
1277
-}
1278
-
1279
-struct property *prop_alloc(enum prop_type type, struct symbol *sym)
1280
-{
1281
- struct property *prop;
1282
- struct property **propp;
1283
-
1284
- prop = xmalloc(sizeof(*prop));
1285
- memset(prop, 0, sizeof(*prop));
1286
- prop->type = type;
1287
- prop->sym = sym;
1288
- prop->file = current_file;
1289
- prop->lineno = zconf_lineno();
1290
-
1291
- /* append property to the prop list of symbol */
1292
- if (sym) {
1293
- for (propp = &sym->prop; *propp; propp = &(*propp)->next)
1294
- ;
1295
- *propp = prop;
1296
- }
1297
-
1298
- return prop;
12991279 }
13001280
13011281 struct symbol *prop_get_symbol(struct property *prop)