summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-12-29 16:03:29 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-12-29 16:03:29 -0500
commit769e47094dcc0ddc8fe8e04c13565a71134ec1a2 (patch)
treeaaf8201e1bef3ca7cb317624661b63e9f8355cc7
parent668c35f69cc750aaf07bd5fe7710a47e2aed6e43 (diff)
parentf222b7f43661c3dddd44ee493c16e04e8f231542 (diff)
Merge tag 'kconfig-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kconfig updates from Masahiro Yamada: - support -y option for merge_config.sh to avoid downgrading =y to =m - remove S_OTHER symbol type, and touch include/config/*.h files correctly - fix file name and line number in lexer warnings - fix memory leak when EOF is encountered in quotation - resolve all shift/reduce conflicts of the parser - warn no new line at end of file - make 'source' statement more strict to take only string literal - rewrite the lexer and remove the keyword lookup table - convert to SPDX License Identifier - compile C files independently instead of including them from zconf.y - fix various warnings of gconfig - misc cleanups * tag 'kconfig-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (39 commits) kconfig: surround dbg_sym_flags with #ifdef DEBUG to fix gconf warning kconfig: split images.c out of qconf.cc/gconf.c to fix gconf warnings kconfig: add static qualifiers to fix gconf warnings kconfig: split the lexer out of zconf.y kconfig: split some C files out of zconf.y kconfig: convert to SPDX License Identifier kconfig: remove keyword lookup table entirely kconfig: update current_pos in the second lexer kconfig: switch to ASSIGN_VAL state in the second lexer kconfig: stop associating kconf_id with yylval kconfig: refactor end token rules kconfig: stop supporting '.' and '/' in unquoted words treewide: surround Kconfig file paths with double quotes microblaze: surround string default in Kconfig with double quotes kconfig: use T_WORD instead of T_VARIABLE for variables kconfig: use specific tokens instead of T_ASSIGN for assignments kconfig: refactor scanning and parsing "option" properties kconfig: use distinct tokens for type and default properties kconfig: remove redundant token defines kconfig: rename depends_list to comment_option_list ...
-rw-r--r--arch/arm/Kconfig2
-rw-r--r--arch/arm/kvm/Kconfig2
-rw-r--r--arch/arm64/Kconfig2
-rw-r--r--arch/arm64/kvm/Kconfig2
-rw-r--r--arch/ia64/Kconfig2
-rw-r--r--arch/m68k/Kconfig6
-rw-r--r--arch/microblaze/Kconfig.platform2
-rw-r--r--arch/mips/kvm/Kconfig2
-rw-r--r--arch/openrisc/Kconfig2
-rw-r--r--arch/powerpc/Kconfig4
-rw-r--r--arch/powerpc/kvm/Kconfig2
-rw-r--r--arch/riscv/Kconfig2
-rw-r--r--arch/s390/Kconfig2
-rw-r--r--arch/s390/kvm/Kconfig2
-rw-r--r--arch/sh/Kconfig2
-rw-r--r--arch/sparc/Kconfig2
-rw-r--r--arch/x86/Kconfig2
-rw-r--r--arch/x86/kvm/Kconfig2
-rw-r--r--block/Kconfig2
-rw-r--r--crypto/Kconfig4
-rw-r--r--drivers/crypto/Kconfig2
-rw-r--r--drivers/gpu/drm/i915/Kconfig2
-rw-r--r--drivers/hwmon/Kconfig2
-rw-r--r--drivers/i2c/Kconfig6
-rw-r--r--drivers/pps/Kconfig4
-rw-r--r--drivers/ras/Kconfig2
-rw-r--r--drivers/thermal/Kconfig2
-rw-r--r--drivers/w1/Kconfig4
-rw-r--r--kernel/Kconfig.preempt2
-rw-r--r--lib/Kconfig.debug4
-rw-r--r--scripts/kconfig/Makefile25
-rw-r--r--scripts/kconfig/conf.c2
-rw-r--r--scripts/kconfig/confdata.c136
-rw-r--r--scripts/kconfig/expr.c18
-rw-r--r--scripts/kconfig/expr.h6
-rw-r--r--scripts/kconfig/gconf.c30
-rw-r--r--scripts/kconfig/images.c34
-rw-r--r--scripts/kconfig/images.h33
-rw-r--r--scripts/kconfig/kconf_id.c52
-rw-r--r--scripts/kconfig/lkc.h25
-rw-r--r--scripts/kconfig/lxdialog/checklist.c15
-rw-r--r--scripts/kconfig/lxdialog/dialog.h15
-rw-r--r--scripts/kconfig/lxdialog/inputbox.c15
-rw-r--r--scripts/kconfig/lxdialog/menubox.c15
-rw-r--r--scripts/kconfig/lxdialog/textbox.c15
-rw-r--r--scripts/kconfig/lxdialog/util.c15
-rw-r--r--scripts/kconfig/lxdialog/yesno.c15
-rw-r--r--scripts/kconfig/mconf.c2
-rw-r--r--scripts/kconfig/menu.c43
-rwxr-xr-xscripts/kconfig/merge_config.sh48
-rw-r--r--scripts/kconfig/nconf.c5
-rw-r--r--scripts/kconfig/nconf.gui.c5
-rw-r--r--scripts/kconfig/nconf.h5
-rw-r--r--scripts/kconfig/preprocess.c5
-rw-r--r--scripts/kconfig/qconf.cc4
-rw-r--r--scripts/kconfig/qconf.h2
-rwxr-xr-xscripts/kconfig/streamline_config.pl2
-rw-r--r--scripts/kconfig/symbol.c7
-rw-r--r--scripts/kconfig/tests/auto_submenu/Kconfig2
-rw-r--r--scripts/kconfig/tests/auto_submenu/__init__.py1
-rw-r--r--scripts/kconfig/tests/choice/Kconfig2
-rw-r--r--scripts/kconfig/tests/choice/__init__.py1
-rw-r--r--scripts/kconfig/tests/choice_value_with_m_dep/Kconfig2
-rw-r--r--scripts/kconfig/tests/choice_value_with_m_dep/__init__.py1
-rw-r--r--scripts/kconfig/tests/err_recursive_inc/__init__.py1
-rw-r--r--scripts/kconfig/tests/inter_choice/Kconfig2
-rw-r--r--scripts/kconfig/tests/inter_choice/__init__.py1
-rw-r--r--scripts/kconfig/tests/new_choice_with_dep/Kconfig2
-rw-r--r--scripts/kconfig/tests/new_choice_with_dep/__init__.py1
-rw-r--r--scripts/kconfig/tests/no_write_if_dep_unmet/Kconfig2
-rw-r--r--scripts/kconfig/tests/no_write_if_dep_unmet/__init__.py1
-rw-r--r--scripts/kconfig/tests/rand_nested_choice/Kconfig2
-rw-r--r--scripts/kconfig/tests/rand_nested_choice/__init__.py1
-rw-r--r--scripts/kconfig/util.c3
-rw-r--r--scripts/kconfig/zconf.l235
-rw-r--r--scripts/kconfig/zconf.y290
-rw-r--r--security/Kconfig16
-rw-r--r--security/integrity/Kconfig4
78 files changed, 548 insertions, 694 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 2196aac0e45c..3a7cce7f80df 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -910,7 +910,7 @@ config PLAT_VERSATILE
910 910
911source "arch/arm/firmware/Kconfig" 911source "arch/arm/firmware/Kconfig"
912 912
913source arch/arm/mm/Kconfig 913source "arch/arm/mm/Kconfig"
914 914
915config IWMMXT 915config IWMMXT
916 bool "Enable iWMMXt support" 916 bool "Enable iWMMXt support"
diff --git a/arch/arm/kvm/Kconfig b/arch/arm/kvm/Kconfig
index e2bd35b6780c..3f5320f46de2 100644
--- a/arch/arm/kvm/Kconfig
+++ b/arch/arm/kvm/Kconfig
@@ -55,6 +55,6 @@ config KVM_ARM_HOST
55 ---help--- 55 ---help---
56 Provides host support for ARM processors. 56 Provides host support for ARM processors.
57 57
58source drivers/vhost/Kconfig 58source "drivers/vhost/Kconfig"
59 59
60endif # VIRTUALIZATION 60endif # VIRTUALIZATION
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 86b18c1bd33c..5c02802f0493 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -857,7 +857,7 @@ config NEED_PER_CPU_EMBED_FIRST_CHUNK
857config HOLES_IN_ZONE 857config HOLES_IN_ZONE
858 def_bool y 858 def_bool y
859 859
860source kernel/Kconfig.hz 860source "kernel/Kconfig.hz"
861 861
862config ARCH_SUPPORTS_DEBUG_PAGEALLOC 862config ARCH_SUPPORTS_DEBUG_PAGEALLOC
863 def_bool y 863 def_bool y
diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig
index 47b23bf617c7..a3f85624313e 100644
--- a/arch/arm64/kvm/Kconfig
+++ b/arch/arm64/kvm/Kconfig
@@ -61,6 +61,6 @@ config KVM_ARM_PMU
61config KVM_INDIRECT_VECTORS 61config KVM_INDIRECT_VECTORS
62 def_bool KVM && (HARDEN_BRANCH_PREDICTOR || HARDEN_EL2_VECTORS) 62 def_bool KVM && (HARDEN_BRANCH_PREDICTOR || HARDEN_EL2_VECTORS)
63 63
64source drivers/vhost/Kconfig 64source "drivers/vhost/Kconfig"
65 65
66endif # VIRTUALIZATION 66endif # VIRTUALIZATION
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index cbf6c67c7166..74638de8091d 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -261,7 +261,7 @@ config HZ
261endif 261endif
262 262
263if !IA64_HP_SIM 263if !IA64_HP_SIM
264source kernel/Kconfig.hz 264source "kernel/Kconfig.hz"
265endif 265endif
266 266
267config IA64_BRL_EMU 267config IA64_BRL_EMU
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 8a5868e9a3a0..e173ea2ff395 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -122,11 +122,11 @@ config BOOTINFO_PROC
122 122
123menu "Platform setup" 123menu "Platform setup"
124 124
125source arch/m68k/Kconfig.cpu 125source "arch/m68k/Kconfig.cpu"
126 126
127source arch/m68k/Kconfig.machine 127source "arch/m68k/Kconfig.machine"
128 128
129source arch/m68k/Kconfig.bus 129source "arch/m68k/Kconfig.bus"
130 130
131endmenu 131endmenu
132 132
diff --git a/arch/microblaze/Kconfig.platform b/arch/microblaze/Kconfig.platform
index f7f1739c11b9..7361974417dc 100644
--- a/arch/microblaze/Kconfig.platform
+++ b/arch/microblaze/Kconfig.platform
@@ -65,6 +65,6 @@ config XILINX_MICROBLAZE0_USE_FPU
65 65
66config XILINX_MICROBLAZE0_HW_VER 66config XILINX_MICROBLAZE0_HW_VER
67 string "Core version number" 67 string "Core version number"
68 default 7.10.d 68 default "7.10.d"
69 69
70endmenu 70endmenu
diff --git a/arch/mips/kvm/Kconfig b/arch/mips/kvm/Kconfig
index 760aec70dce5..4528bc9c3cb1 100644
--- a/arch/mips/kvm/Kconfig
+++ b/arch/mips/kvm/Kconfig
@@ -73,6 +73,6 @@ config KVM_MIPS_DEBUG_COP0_COUNTERS
73 73
74 If unsure, say N. 74 If unsure, say N.
75 75
76source drivers/vhost/Kconfig 76source "drivers/vhost/Kconfig"
77 77
78endif # VIRTUALIZATION 78endif # VIRTUALIZATION
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index d0feebad5a8f..09ab59e942ae 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -138,7 +138,7 @@ config SMP
138 138
139 If you don't know what to do here, say N. 139 If you don't know what to do here, say N.
140 140
141source kernel/Kconfig.hz 141source "kernel/Kconfig.hz"
142 142
143config OPENRISC_NO_SPR_SR_DSX 143config OPENRISC_NO_SPR_SR_DSX
144 bool "use SPR_SR_DSX software emulation" if OR1K_1200 144 bool "use SPR_SR_DSX software emulation" if OR1K_1200
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 50f27a656051..285fefcf512a 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -393,7 +393,7 @@ config HIGHMEM
393 bool "High memory support" 393 bool "High memory support"
394 depends on PPC32 394 depends on PPC32
395 395
396source kernel/Kconfig.hz 396source "kernel/Kconfig.hz"
397 397
398config HUGETLB_PAGE_SIZE_VARIABLE 398config HUGETLB_PAGE_SIZE_VARIABLE
399 bool 399 bool
@@ -816,7 +816,7 @@ config ARCH_WANTS_FREEZER_CONTROL
816 def_bool y 816 def_bool y
817 depends on ADB_PMU 817 depends on ADB_PMU
818 818
819source kernel/power/Kconfig 819source "kernel/power/Kconfig"
820 820
821config SECCOMP 821config SECCOMP
822 bool "Enable seccomp to safely compute untrusted bytecode" 822 bool "Enable seccomp to safely compute untrusted bytecode"
diff --git a/arch/powerpc/kvm/Kconfig b/arch/powerpc/kvm/Kconfig
index 68a0e9d5b440..bfdde04e4905 100644
--- a/arch/powerpc/kvm/Kconfig
+++ b/arch/powerpc/kvm/Kconfig
@@ -204,6 +204,6 @@ config KVM_XIVE
204 default y 204 default y
205 depends on KVM_XICS && PPC_XIVE_NATIVE && KVM_BOOK3S_HV_POSSIBLE 205 depends on KVM_XICS && PPC_XIVE_NATIVE && KVM_BOOK3S_HV_POSSIBLE
206 206
207source drivers/vhost/Kconfig 207source "drivers/vhost/Kconfig"
208 208
209endif # VIRTUALIZATION 209endif # VIRTUALIZATION
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 106539bb914e..a1aade822927 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -296,6 +296,6 @@ endmenu
296 296
297menu "Power management options" 297menu "Power management options"
298 298
299source kernel/power/Kconfig 299source "kernel/power/Kconfig"
300 300
301endmenu 301endmenu
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 21d271d04ca6..6e9c66b3f054 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -518,7 +518,7 @@ config SCHED_TOPOLOGY
518 making when dealing with machines that have multi-threading, 518 making when dealing with machines that have multi-threading,
519 multiple cores or multiple books. 519 multiple cores or multiple books.
520 520
521source kernel/Kconfig.hz 521source "kernel/Kconfig.hz"
522 522
523config KEXEC 523config KEXEC
524 def_bool y 524 def_bool y
diff --git a/arch/s390/kvm/Kconfig b/arch/s390/kvm/Kconfig
index a3dbd459cce9..767453faacfc 100644
--- a/arch/s390/kvm/Kconfig
+++ b/arch/s390/kvm/Kconfig
@@ -57,6 +57,6 @@ config KVM_S390_UCONTROL
57 57
58# OK, it's a little counter-intuitive to do this, but it puts it neatly under 58# OK, it's a little counter-intuitive to do this, but it puts it neatly under
59# the virtualization menu. 59# the virtualization menu.
60source drivers/vhost/Kconfig 60source "drivers/vhost/Kconfig"
61 61
62endif # VIRTUALIZATION 62endif # VIRTUALIZATION
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 10fd4e9c454b..34c97f051c1e 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -596,7 +596,7 @@ endmenu
596 596
597menu "Kernel features" 597menu "Kernel features"
598 598
599source kernel/Kconfig.hz 599source "kernel/Kconfig.hz"
600 600
601config KEXEC 601config KEXEC
602 bool "kexec system call (EXPERIMENTAL)" 602 bool "kexec system call (EXPERIMENTAL)"
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index f5bb9ded1d18..ff96e248e585 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -185,7 +185,7 @@ config NR_CPUS
185 default 32 if SPARC32 185 default 32 if SPARC32
186 default 4096 if SPARC64 186 default 4096 if SPARC64
187 187
188source kernel/Kconfig.hz 188source "kernel/Kconfig.hz"
189 189
190config RWSEM_GENERIC_SPINLOCK 190config RWSEM_GENERIC_SPINLOCK
191 bool 191 bool
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 57552f2b37eb..4385fc9174e1 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1977,7 +1977,7 @@ config SECCOMP
1977 1977
1978 If unsure, say Y. Only embedded should say N here. 1978 If unsure, say Y. Only embedded should say N here.
1979 1979
1980source kernel/Kconfig.hz 1980source "kernel/Kconfig.hz"
1981 1981
1982config KEXEC 1982config KEXEC
1983 bool "kexec system call" 1983 bool "kexec system call"
diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
index 1bbec387d289..72fa955f4a15 100644
--- a/arch/x86/kvm/Kconfig
+++ b/arch/x86/kvm/Kconfig
@@ -98,6 +98,6 @@ config KVM_MMU_AUDIT
98 98
99# OK, it's a little counter-intuitive to do this, but it puts it neatly under 99# OK, it's a little counter-intuitive to do this, but it puts it neatly under
100# the virtualization menu. 100# the virtualization menu.
101source drivers/vhost/Kconfig 101source "drivers/vhost/Kconfig"
102 102
103endif # VIRTUALIZATION 103endif # VIRTUALIZATION
diff --git a/block/Kconfig b/block/Kconfig
index 8044452a4fd3..028bc085dac8 100644
--- a/block/Kconfig
+++ b/block/Kconfig
@@ -218,4 +218,4 @@ config BLK_MQ_RDMA
218config BLK_PM 218config BLK_PM
219 def_bool BLOCK && PM 219 def_bool BLOCK && PM
220 220
221source block/Kconfig.iosched 221source "block/Kconfig.iosched"
diff --git a/crypto/Kconfig b/crypto/Kconfig
index 045af6eeb7e2..9511144ac7b5 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -1889,7 +1889,7 @@ config CRYPTO_HASH_INFO
1889 bool 1889 bool
1890 1890
1891source "drivers/crypto/Kconfig" 1891source "drivers/crypto/Kconfig"
1892source crypto/asymmetric_keys/Kconfig 1892source "crypto/asymmetric_keys/Kconfig"
1893source certs/Kconfig 1893source "certs/Kconfig"
1894 1894
1895endif # if CRYPTO 1895endif # if CRYPTO
diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index d80751d48cf1..5a90075f719d 100644
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
@@ -258,7 +258,7 @@ config CRYPTO_DEV_HIFN_795X_RNG
258 Select this option if you want to enable the random number generator 258 Select this option if you want to enable the random number generator
259 on the HIFN 795x crypto adapters. 259 on the HIFN 795x crypto adapters.
260 260
261source drivers/crypto/caam/Kconfig 261source "drivers/crypto/caam/Kconfig"
262 262
263config CRYPTO_DEV_TALITOS 263config CRYPTO_DEV_TALITOS
264 tristate "Talitos Freescale Security Engine (SEC)" 264 tristate "Talitos Freescale Security Engine (SEC)"
diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig
index 33a458b7f1fc..148be8e1a090 100644
--- a/drivers/gpu/drm/i915/Kconfig
+++ b/drivers/gpu/drm/i915/Kconfig
@@ -131,5 +131,5 @@ config DRM_I915_GVT_KVMGT
131menu "drm/i915 Debugging" 131menu "drm/i915 Debugging"
132depends on DRM_I915 132depends on DRM_I915
133depends on EXPERT 133depends on EXPERT
134source drivers/gpu/drm/i915/Kconfig.debug 134source "drivers/gpu/drm/i915/Kconfig.debug"
135endmenu 135endmenu
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 7bec39266402..6f929bfa9fcd 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -1310,7 +1310,7 @@ config SENSORS_PCF8591
1310 These devices are hard to detect and rarely found on mainstream 1310 These devices are hard to detect and rarely found on mainstream
1311 hardware. If unsure, say N. 1311 hardware. If unsure, say N.
1312 1312
1313source drivers/hwmon/pmbus/Kconfig 1313source "drivers/hwmon/pmbus/Kconfig"
1314 1314
1315config SENSORS_PWM_FAN 1315config SENSORS_PWM_FAN
1316 tristate "PWM fan" 1316 tristate "PWM fan"
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
index efc3354d60ae..c6b7fc7b67d6 100644
--- a/drivers/i2c/Kconfig
+++ b/drivers/i2c/Kconfig
@@ -68,7 +68,7 @@ config I2C_MUX
68 This support is also available as a module. If so, the module 68 This support is also available as a module. If so, the module
69 will be called i2c-mux. 69 will be called i2c-mux.
70 70
71source drivers/i2c/muxes/Kconfig 71source "drivers/i2c/muxes/Kconfig"
72 72
73config I2C_HELPER_AUTO 73config I2C_HELPER_AUTO
74 bool "Autoselect pertinent helper modules" 74 bool "Autoselect pertinent helper modules"
@@ -94,8 +94,8 @@ config I2C_SMBUS
94 This support is also available as a module. If so, the module 94 This support is also available as a module. If so, the module
95 will be called i2c-smbus. 95 will be called i2c-smbus.
96 96
97source drivers/i2c/algos/Kconfig 97source "drivers/i2c/algos/Kconfig"
98source drivers/i2c/busses/Kconfig 98source "drivers/i2c/busses/Kconfig"
99 99
100config I2C_STUB 100config I2C_STUB
101 tristate "I2C/SMBus Test Stub" 101 tristate "I2C/SMBus Test Stub"
diff --git a/drivers/pps/Kconfig b/drivers/pps/Kconfig
index c6008f296605..965aa086a1e0 100644
--- a/drivers/pps/Kconfig
+++ b/drivers/pps/Kconfig
@@ -37,8 +37,8 @@ config NTP_PPS
37 37
38 It doesn't work on tickless systems at the moment. 38 It doesn't work on tickless systems at the moment.
39 39
40source drivers/pps/clients/Kconfig 40source "drivers/pps/clients/Kconfig"
41 41
42source drivers/pps/generators/Kconfig 42source "drivers/pps/generators/Kconfig"
43 43
44endif # PPS 44endif # PPS
diff --git a/drivers/ras/Kconfig b/drivers/ras/Kconfig
index 4c3c67d13254..b834ff555188 100644
--- a/drivers/ras/Kconfig
+++ b/drivers/ras/Kconfig
@@ -30,6 +30,6 @@ menuconfig RAS
30 30
31if RAS 31if RAS
32 32
33source arch/x86/ras/Kconfig 33source "arch/x86/ras/Kconfig"
34 34
35endif 35endif
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 5422523c03f8..5fbfabbf627b 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -383,7 +383,7 @@ config INTEL_QUARK_DTS_THERMAL
383 underlying BIOS/Firmware. 383 underlying BIOS/Firmware.
384 384
385menu "ACPI INT340X thermal drivers" 385menu "ACPI INT340X thermal drivers"
386source drivers/thermal/int340x_thermal/Kconfig 386source "drivers/thermal/int340x_thermal/Kconfig"
387endmenu 387endmenu
388 388
389config INTEL_BXT_PMIC_THERMAL 389config INTEL_BXT_PMIC_THERMAL
diff --git a/drivers/w1/Kconfig b/drivers/w1/Kconfig
index 6743bde038cc..dbb41f45af8a 100644
--- a/drivers/w1/Kconfig
+++ b/drivers/w1/Kconfig
@@ -25,7 +25,7 @@ config W1_CON
25 2. Userspace commands. Includes read/write and search/alarm search commands. 25 2. Userspace commands. Includes read/write and search/alarm search commands.
26 3. Replies to userspace commands. 26 3. Replies to userspace commands.
27 27
28source drivers/w1/masters/Kconfig 28source "drivers/w1/masters/Kconfig"
29source drivers/w1/slaves/Kconfig 29source "drivers/w1/slaves/Kconfig"
30 30
31endif # W1 31endif # W1
diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt
index cd1655122ec0..0fee5fe6c899 100644
--- a/kernel/Kconfig.preempt
+++ b/kernel/Kconfig.preempt
@@ -57,4 +57,4 @@ config PREEMPT
57endchoice 57endchoice
58 58
59config PREEMPT_COUNT 59config PREEMPT_COUNT
60 bool \ No newline at end of file 60 bool
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 2b5a4256e88b..d4df5b24d75e 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -439,7 +439,7 @@ config DEBUG_KERNEL
439 439
440menu "Memory Debugging" 440menu "Memory Debugging"
441 441
442source mm/Kconfig.debug 442source "mm/Kconfig.debug"
443 443
444config DEBUG_OBJECTS 444config DEBUG_OBJECTS
445 bool "Debug object operations" 445 bool "Debug object operations"
@@ -1624,7 +1624,7 @@ config LATENCYTOP
1624 Enable this option if you want to use the LatencyTOP tool 1624 Enable this option if you want to use the LatencyTOP tool
1625 to find out which userspace is blocking on what kernel operations. 1625 to find out which userspace is blocking on what kernel operations.
1626 1626
1627source kernel/trace/Kconfig 1627source "kernel/trace/Kconfig"
1628 1628
1629config PROVIDE_OHCI1394_DMA_INIT 1629config PROVIDE_OHCI1394_DMA_INIT
1630 bool "Remote debugging over FireWire early on boot" 1630 bool "Remote debugging over FireWire early on boot"
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 63b609243d03..ec204fa54c9a 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -142,23 +142,20 @@ help:
142 @echo ' testconfig - Run Kconfig unit tests (requires python3 and pytest)' 142 @echo ' testconfig - Run Kconfig unit tests (requires python3 and pytest)'
143 143
144# =========================================================================== 144# ===========================================================================
145# Shared Makefile for the various kconfig executables:
146# conf: Used for defconfig, oldconfig and related targets
147# object files used by all kconfig flavours 145# object files used by all kconfig flavours
146common-objs := confdata.o expr.o symbol.o preprocess.o zconf.lex.o zconf.tab.o
148 147
149conf-objs := conf.o zconf.tab.o 148$(obj)/zconf.lex.o: $(obj)/zconf.tab.h
150
151hostprogs-y := conf
152
153targets += zconf.lex.c
154
155# generated files seem to need this to find local include files
156HOSTCFLAGS_zconf.lex.o := -I$(src) 149HOSTCFLAGS_zconf.lex.o := -I$(src)
157HOSTCFLAGS_zconf.tab.o := -I$(src) 150HOSTCFLAGS_zconf.tab.o := -I$(src)
158 151
152# conf: Used for defconfig, oldconfig and related targets
153hostprogs-y += conf
154conf-objs := conf.o $(common-objs)
155
159# nconf: Used for the nconfig target based on ncurses 156# nconf: Used for the nconfig target based on ncurses
160hostprogs-y += nconf 157hostprogs-y += nconf
161nconf-objs := nconf.o zconf.tab.o nconf.gui.o 158nconf-objs := nconf.o nconf.gui.o $(common-objs)
162 159
163HOSTLDLIBS_nconf = $(shell . $(obj)/.nconf-cfg && echo $$libs) 160HOSTLDLIBS_nconf = $(shell . $(obj)/.nconf-cfg && echo $$libs)
164HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) 161HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags)
@@ -169,7 +166,7 @@ $(obj)/nconf.o $(obj)/nconf.gui.o: $(obj)/.nconf-cfg
169# mconf: Used for the menuconfig target based on lxdialog 166# mconf: Used for the menuconfig target based on lxdialog
170hostprogs-y += mconf 167hostprogs-y += mconf
171lxdialog := checklist.o inputbox.o menubox.o textbox.o util.o yesno.o 168lxdialog := checklist.o inputbox.o menubox.o textbox.o util.o yesno.o
172mconf-objs := mconf.o zconf.tab.o $(addprefix lxdialog/, $(lxdialog)) 169mconf-objs := mconf.o $(addprefix lxdialog/, $(lxdialog)) $(common-objs)
173 170
174HOSTLDLIBS_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs) 171HOSTLDLIBS_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs)
175$(foreach f, mconf.o $(lxdialog), \ 172$(foreach f, mconf.o $(lxdialog), \
@@ -181,7 +178,7 @@ $(addprefix $(obj)/lxdialog/, $(lxdialog)): $(obj)/.mconf-cfg
181# qconf: Used for the xconfig target based on Qt 178# qconf: Used for the xconfig target based on Qt
182hostprogs-y += qconf 179hostprogs-y += qconf
183qconf-cxxobjs := qconf.o 180qconf-cxxobjs := qconf.o
184qconf-objs := zconf.tab.o 181qconf-objs := images.o $(common-objs)
185 182
186HOSTLDLIBS_qconf = $(shell . $(obj)/.qconf-cfg && echo $$libs) 183HOSTLDLIBS_qconf = $(shell . $(obj)/.qconf-cfg && echo $$libs)
187HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/.qconf-cfg && echo $$cflags) 184HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/.qconf-cfg && echo $$cflags)
@@ -196,15 +193,13 @@ $(obj)/%.moc: $(src)/%.h $(obj)/.qconf-cfg
196 193
197# gconf: Used for the gconfig target based on GTK+ 194# gconf: Used for the gconfig target based on GTK+
198hostprogs-y += gconf 195hostprogs-y += gconf
199gconf-objs := gconf.o zconf.tab.o 196gconf-objs := gconf.o images.o $(common-objs)
200 197
201HOSTLDLIBS_gconf = $(shell . $(obj)/.gconf-cfg && echo $$libs) 198HOSTLDLIBS_gconf = $(shell . $(obj)/.gconf-cfg && echo $$libs)
202HOSTCFLAGS_gconf.o = $(shell . $(obj)/.gconf-cfg && echo $$cflags) 199HOSTCFLAGS_gconf.o = $(shell . $(obj)/.gconf-cfg && echo $$cflags)
203 200
204$(obj)/gconf.o: $(obj)/.gconf-cfg 201$(obj)/gconf.o: $(obj)/.gconf-cfg
205 202
206$(obj)/zconf.tab.o: $(obj)/zconf.lex.c
207
208# check if necessary packages are available, and configure build flags 203# check if necessary packages are available, and configure build flags
209define filechk_conf_cfg 204define filechk_conf_cfg
210 $(CONFIG_SHELL) $< 205 $(CONFIG_SHELL) $<
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 98e0c7a34699..da89ef788a8d 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -1,6 +1,6 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0.
4 */ 4 */
5 5
6#include <ctype.h> 6#include <ctype.h>
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 91d0a5c014ac..08ba146a83c5 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -1,12 +1,13 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0.
4 */ 4 */
5 5
6#include <sys/stat.h> 6#include <sys/stat.h>
7#include <ctype.h> 7#include <ctype.h>
8#include <errno.h> 8#include <errno.h>
9#include <fcntl.h> 9#include <fcntl.h>
10#include <limits.h>
10#include <stdarg.h> 11#include <stdarg.h>
11#include <stdio.h> 12#include <stdio.h>
12#include <stdlib.h> 13#include <stdlib.h>
@@ -74,6 +75,47 @@ static int make_parent_dir(const char *path)
74 return 0; 75 return 0;
75} 76}
76 77
78static char depfile_path[PATH_MAX];
79static size_t depfile_prefix_len;
80
81/* touch depfile for symbol 'name' */
82static int conf_touch_dep(const char *name)
83{
84 int fd, ret;
85 const char *s;
86 char *d, c;
87
88 /* check overflow: prefix + name + ".h" + '\0' must fit in buffer. */
89 if (depfile_prefix_len + strlen(name) + 3 > sizeof(depfile_path))
90 return -1;
91
92 d = depfile_path + depfile_prefix_len;
93 s = name;
94
95 while ((c = *s++))
96 *d++ = (c == '_') ? '/' : tolower(c);
97 strcpy(d, ".h");
98
99 /* Assume directory path already exists. */
100 fd = open(depfile_path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
101 if (fd == -1) {
102 if (errno != ENOENT)
103 return -1;
104
105 ret = make_parent_dir(depfile_path);
106 if (ret)
107 return ret;
108
109 /* Try it again. */
110 fd = open(depfile_path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
111 if (fd == -1)
112 return -1;
113 }
114 close(fd);
115
116 return 0;
117}
118
77struct conf_printer { 119struct conf_printer {
78 void (*print_symbol)(FILE *, struct symbol *, const char *, void *); 120 void (*print_symbol)(FILE *, struct symbol *, const char *, void *);
79 void (*print_comment)(FILE *, const char *, void *); 121 void (*print_comment)(FILE *, const char *, void *);
@@ -186,14 +228,6 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
186 conf_warning("symbol value '%s' invalid for %s", 228 conf_warning("symbol value '%s' invalid for %s",
187 p, sym->name); 229 p, sym->name);
188 return 1; 230 return 1;
189 case S_OTHER:
190 if (*p != '"') {
191 for (p2 = p; *p2 && !isspace(*p2); p2++)
192 ;
193 sym->type = S_STRING;
194 goto done;
195 }
196 /* fall through */
197 case S_STRING: 231 case S_STRING:
198 if (*p++ != '"') 232 if (*p++ != '"')
199 break; 233 break;
@@ -212,7 +246,6 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
212 /* fall through */ 246 /* fall through */
213 case S_INT: 247 case S_INT:
214 case S_HEX: 248 case S_HEX:
215 done:
216 if (sym_string_valid(sym, p)) { 249 if (sym_string_valid(sym, p)) {
217 sym->def[def].val = xstrdup(p); 250 sym->def[def].val = xstrdup(p);
218 sym->flags |= def_flags; 251 sym->flags |= def_flags;
@@ -363,7 +396,7 @@ load:
363 sym = sym_find(line + 2 + strlen(CONFIG_)); 396 sym = sym_find(line + 2 + strlen(CONFIG_));
364 if (!sym) { 397 if (!sym) {
365 sym_add_change_count(1); 398 sym_add_change_count(1);
366 goto setsym; 399 continue;
367 } 400 }
368 } else { 401 } else {
369 sym = sym_lookup(line + 2 + strlen(CONFIG_), 0); 402 sym = sym_lookup(line + 2 + strlen(CONFIG_), 0);
@@ -393,17 +426,22 @@ load:
393 if (*p2 == '\r') 426 if (*p2 == '\r')
394 *p2 = 0; 427 *p2 = 0;
395 } 428 }
396 if (def == S_DEF_USER) { 429
397 sym = sym_find(line + strlen(CONFIG_)); 430 sym = sym_find(line + strlen(CONFIG_));
398 if (!sym) { 431 if (!sym) {
432 if (def == S_DEF_AUTO)
433 /*
434 * Reading from include/config/auto.conf
435 * If CONFIG_FOO previously existed in
436 * auto.conf but it is missing now,
437 * include/config/foo.h must be touched.
438 */
439 conf_touch_dep(line + strlen(CONFIG_));
440 else
399 sym_add_change_count(1); 441 sym_add_change_count(1);
400 goto setsym; 442 continue;
401 }
402 } else {
403 sym = sym_lookup(line + strlen(CONFIG_), 0);
404 if (sym->type == S_UNKNOWN)
405 sym->type = S_OTHER;
406 } 443 }
444
407 if (sym->flags & def_flags) { 445 if (sym->flags & def_flags) {
408 conf_warning("override: reassigning to symbol %s", sym->name); 446 conf_warning("override: reassigning to symbol %s", sym->name);
409 } 447 }
@@ -416,7 +454,7 @@ load:
416 454
417 continue; 455 continue;
418 } 456 }
419setsym: 457
420 if (sym && sym_is_choice_value(sym)) { 458 if (sym && sym_is_choice_value(sym)) {
421 struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); 459 struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
422 switch (sym->def[def].tri) { 460 switch (sym->def[def].tri) {
@@ -669,7 +707,6 @@ static void conf_write_symbol(FILE *fp, struct symbol *sym,
669 const char *str; 707 const char *str;
670 708
671 switch (sym->type) { 709 switch (sym->type) {
672 case S_OTHER:
673 case S_UNKNOWN: 710 case S_UNKNOWN:
674 break; 711 break;
675 case S_STRING: 712 case S_STRING:
@@ -906,24 +943,19 @@ static int conf_write_dep(const char *name)
906 return 0; 943 return 0;
907} 944}
908 945
909static int conf_split_config(void) 946static int conf_touch_deps(void)
910{ 947{
911 const char *name; 948 const char *name;
912 char path[PATH_MAX+1];
913 char *s, *d, c;
914 struct symbol *sym; 949 struct symbol *sym;
915 int res, i, fd; 950 int res, i;
951
952 strcpy(depfile_path, "include/config/");
953 depfile_prefix_len = strlen(depfile_path);
916 954
917 name = conf_get_autoconfig_name(); 955 name = conf_get_autoconfig_name();
918 conf_read_simple(name, S_DEF_AUTO); 956 conf_read_simple(name, S_DEF_AUTO);
919 sym_calc_value(modules_sym); 957 sym_calc_value(modules_sym);
920 958
921 if (make_parent_dir("include/config/foo.h"))
922 return 1;
923 if (chdir("include/config"))
924 return 1;
925
926 res = 0;
927 for_all_symbols(i, sym) { 959 for_all_symbols(i, sym) {
928 sym_calc_value(sym); 960 sym_calc_value(sym);
929 if ((sym->flags & SYMBOL_NO_WRITE) || !sym->name) 961 if ((sym->flags & SYMBOL_NO_WRITE) || !sym->name)
@@ -975,42 +1007,12 @@ static int conf_split_config(void)
975 * different from 'no'). 1007 * different from 'no').
976 */ 1008 */
977 1009
978 /* Replace all '_' and append ".h" */ 1010 res = conf_touch_dep(sym->name);
979 s = sym->name; 1011 if (res)
980 d = path; 1012 return res;
981 while ((c = *s++)) {
982 c = tolower(c);
983 *d++ = (c == '_') ? '/' : c;
984 }
985 strcpy(d, ".h");
986
987 /* Assume directory path already exists. */
988 fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
989 if (fd == -1) {
990 if (errno != ENOENT) {
991 res = 1;
992 break;
993 }
994
995 if (make_parent_dir(path)) {
996 res = 1;
997 goto out;
998 }
999
1000 /* Try it again. */
1001 fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
1002 if (fd == -1) {
1003 res = 1;
1004 break;
1005 }
1006 }
1007 close(fd);
1008 } 1013 }
1009out:
1010 if (chdir("../.."))
1011 return 1;
1012 1014
1013 return res; 1015 return 0;
1014} 1016}
1015 1017
1016int conf_write_autoconf(int overwrite) 1018int conf_write_autoconf(int overwrite)
@@ -1028,7 +1030,7 @@ int conf_write_autoconf(int overwrite)
1028 1030
1029 conf_write_dep("include/config/auto.conf.cmd"); 1031 conf_write_dep("include/config/auto.conf.cmd");
1030 1032
1031 if (conf_split_config()) 1033 if (conf_touch_deps())
1032 return 1; 1034 return 1;
1033 1035
1034 out = fopen(".tmpconfig", "w"); 1036 out = fopen(".tmpconfig", "w");
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index e1a39e90841d..77ffff3a053c 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -1,8 +1,10 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0.
4 */ 4 */
5 5
6#include <ctype.h>
7#include <errno.h>
6#include <stdio.h> 8#include <stdio.h>
7#include <stdlib.h> 9#include <stdlib.h>
8#include <string.h> 10#include <string.h>
@@ -980,7 +982,6 @@ enum string_value_kind {
980 k_string, 982 k_string,
981 k_signed, 983 k_signed,
982 k_unsigned, 984 k_unsigned,
983 k_invalid
984}; 985};
985 986
986union string_value { 987union string_value {
@@ -1011,13 +1012,10 @@ static enum string_value_kind expr_parse_string(const char *str,
1011 val->u = strtoull(str, &tail, 16); 1012 val->u = strtoull(str, &tail, 16);
1012 kind = k_unsigned; 1013 kind = k_unsigned;
1013 break; 1014 break;
1014 case S_STRING: 1015 default:
1015 case S_UNKNOWN:
1016 val->s = strtoll(str, &tail, 0); 1016 val->s = strtoll(str, &tail, 0);
1017 kind = k_signed; 1017 kind = k_signed;
1018 break; 1018 break;
1019 default:
1020 return k_invalid;
1021 } 1019 }
1022 return !errno && !*tail && tail > str && isxdigit(tail[-1]) 1020 return !errno && !*tail && tail > str && isxdigit(tail[-1])
1023 ? kind : k_string; 1021 ? kind : k_string;
@@ -1073,13 +1071,7 @@ tristate expr_calc_value(struct expr *e)
1073 1071
1074 if (k1 == k_string || k2 == k_string) 1072 if (k1 == k_string || k2 == k_string)
1075 res = strcmp(str1, str2); 1073 res = strcmp(str1, str2);
1076 else if (k1 == k_invalid || k2 == k_invalid) { 1074 else if (k1 == k_unsigned || k2 == k_unsigned)
1077 if (e->type != E_EQUAL && e->type != E_UNEQUAL) {
1078 printf("Cannot compare \"%s\" and \"%s\"\n", str1, str2);
1079 return no;
1080 }
1081 res = strcmp(str1, str2);
1082 } else if (k1 == k_unsigned || k2 == k_unsigned)
1083 res = (lval.u > rval.u) - (lval.u < rval.u); 1075 res = (lval.u > rval.u) - (lval.u < rval.u);
1084 else /* if (k1 == k_signed && k2 == k_signed) */ 1076 else /* if (k1 == k_signed && k2 == k_signed) */
1085 res = (lval.s > rval.s) - (lval.s < rval.s); 1077 res = (lval.s > rval.s) - (lval.s < rval.s);
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 7c329e179007..999edb60cd53 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -1,6 +1,6 @@
1/* SPDX-License-Identifier: GPL-2.0 */
1/* 2/*
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0.
4 */ 4 */
5 5
6#ifndef EXPR_H 6#ifndef EXPR_H
@@ -62,7 +62,7 @@ struct symbol_value {
62}; 62};
63 63
64enum symbol_type { 64enum symbol_type {
65 S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER 65 S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING
66}; 66};
67 67
68/* enum values are used as index to symbol.def[] */ 68/* enum values are used as index to symbol.def[] */
@@ -131,7 +131,7 @@ struct symbol {
131 struct expr_value implied; 131 struct expr_value implied;
132}; 132};
133 133
134#define for_all_symbols(i, sym) for (i = 0; i < SYMBOL_HASHSIZE; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER) 134#define for_all_symbols(i, sym) for (i = 0; i < SYMBOL_HASHSIZE; i++) for (sym = symbol_hash[i]; sym; sym = sym->next)
135 135
136#define SYMBOL_CONST 0x0001 /* symbol is const */ 136#define SYMBOL_CONST 0x0001 /* symbol is const */
137#define SYMBOL_CHECK 0x0008 /* used during dependency checking */ 137#define SYMBOL_CHECK 0x0008 /* used during dependency checking */
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index 36f578415c4a..5d4ecf309ee4 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -1,9 +1,6 @@
1/* Hey EMACS -*- linux-c -*- */ 1// SPDX-License-Identifier: GPL-2.0
2/* 2/*
3 *
4 * Copyright (C) 2002-2003 Romain Lievin <roms@tilp.info> 3 * Copyright (C) 2002-2003 Romain Lievin <roms@tilp.info>
5 * Released under the terms of the GNU GPL v2.0.
6 *
7 */ 4 */
8 5
9#ifdef HAVE_CONFIG_H 6#ifdef HAVE_CONFIG_H
@@ -12,7 +9,7 @@
12 9
13#include <stdlib.h> 10#include <stdlib.h>
14#include "lkc.h" 11#include "lkc.h"
15#include "images.c" 12#include "images.h"
16 13
17#include <glade/glade.h> 14#include <glade/glade.h>
18#include <gtk/gtk.h> 15#include <gtk/gtk.h>
@@ -78,8 +75,8 @@ static gchar **fill_row(struct menu *menu);
78static void conf_changed(void); 75static void conf_changed(void);
79 76
80/* Helping/Debugging Functions */ 77/* Helping/Debugging Functions */
81 78#ifdef DEBUG
82const char *dbg_sym_flags(int val) 79static const char *dbg_sym_flags(int val)
83{ 80{
84 static char buf[256]; 81 static char buf[256];
85 82
@@ -108,9 +105,10 @@ const char *dbg_sym_flags(int val)
108 105
109 return buf; 106 return buf;
110} 107}
108#endif
111 109
112void replace_button_icon(GladeXML * xml, GdkDrawable * window, 110static void replace_button_icon(GladeXML *xml, GdkDrawable *window,
113 GtkStyle * style, gchar * btn_name, gchar ** xpm) 111 GtkStyle *style, gchar *btn_name, gchar **xpm)
114{ 112{
115 GdkPixmap *pixmap; 113 GdkPixmap *pixmap;
116 GdkBitmap *mask; 114 GdkBitmap *mask;
@@ -128,7 +126,7 @@ void replace_button_icon(GladeXML * xml, GdkDrawable * window,
128} 126}
129 127
130/* Main Window Initialization */ 128/* Main Window Initialization */
131void init_main_window(const gchar * glade_file) 129static void init_main_window(const gchar *glade_file)
132{ 130{
133 GladeXML *xml; 131 GladeXML *xml;
134 GtkWidget *widget; 132 GtkWidget *widget;
@@ -190,7 +188,7 @@ void init_main_window(const gchar * glade_file)
190 gtk_widget_show(main_wnd); 188 gtk_widget_show(main_wnd);
191} 189}
192 190
193void init_tree_model(void) 191static void init_tree_model(void)
194{ 192{
195 gint i; 193 gint i;
196 194
@@ -220,7 +218,7 @@ void init_tree_model(void)
220 model1 = GTK_TREE_MODEL(tree1); 218 model1 = GTK_TREE_MODEL(tree1);
221} 219}
222 220
223void init_left_tree(void) 221static void init_left_tree(void)
224{ 222{
225 GtkTreeView *view = GTK_TREE_VIEW(tree1_w); 223 GtkTreeView *view = GTK_TREE_VIEW(tree1_w);
226 GtkCellRenderer *renderer; 224 GtkCellRenderer *renderer;
@@ -262,7 +260,7 @@ static void renderer_edited(GtkCellRendererText * cell,
262 const gchar * path_string, 260 const gchar * path_string,
263 const gchar * new_text, gpointer user_data); 261 const gchar * new_text, gpointer user_data);
264 262
265void init_right_tree(void) 263static void init_right_tree(void)
266{ 264{
267 GtkTreeView *view = GTK_TREE_VIEW(tree2_w); 265 GtkTreeView *view = GTK_TREE_VIEW(tree2_w);
268 GtkCellRenderer *renderer; 266 GtkCellRenderer *renderer;
@@ -1212,8 +1210,8 @@ static GtkTreeIter found;
1212/* 1210/*
1213 * Find a menu in the GtkTree starting at parent. 1211 * Find a menu in the GtkTree starting at parent.
1214 */ 1212 */
1215GtkTreeIter *gtktree_iter_find_node(GtkTreeIter * parent, 1213static GtkTreeIter *gtktree_iter_find_node(GtkTreeIter *parent,
1216 struct menu *tofind) 1214 struct menu *tofind)
1217{ 1215{
1218 GtkTreeIter iter; 1216 GtkTreeIter iter;
1219 GtkTreeIter *child = &iter; 1217 GtkTreeIter *child = &iter;
@@ -1424,7 +1422,7 @@ static void display_list(void)
1424 tree = tree2; 1422 tree = tree2;
1425} 1423}
1426 1424
1427void fixup_rootmenu(struct menu *menu) 1425static void fixup_rootmenu(struct menu *menu)
1428{ 1426{
1429 struct menu *child; 1427 struct menu *child;
1430 static int menu_cnt = 0; 1428 static int menu_cnt = 0;
diff --git a/scripts/kconfig/images.c b/scripts/kconfig/images.c
index d4f84bd4a96b..b4fa0e4a63a5 100644
--- a/scripts/kconfig/images.c
+++ b/scripts/kconfig/images.c
@@ -1,9 +1,11 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0.
4 */ 4 */
5 5
6static const char *xpm_load[] = { 6#include "images.h"
7
8const char *xpm_load[] = {
7"22 22 5 1", 9"22 22 5 1",
8". c None", 10". c None",
9"# c #000000", 11"# c #000000",
@@ -33,7 +35,7 @@ static const char *xpm_load[] = {
33"###############.......", 35"###############.......",
34"......................"}; 36"......................"};
35 37
36static const char *xpm_save[] = { 38const char *xpm_save[] = {
37"22 22 5 1", 39"22 22 5 1",
38". c None", 40". c None",
39"# c #000000", 41"# c #000000",
@@ -63,7 +65,7 @@ static const char *xpm_save[] = {
63"..##################..", 65"..##################..",
64"......................"}; 66"......................"};
65 67
66static const char *xpm_back[] = { 68const char *xpm_back[] = {
67"22 22 3 1", 69"22 22 3 1",
68". c None", 70". c None",
69"# c #000083", 71"# c #000083",
@@ -91,7 +93,7 @@ static const char *xpm_back[] = {
91"......................", 93"......................",
92"......................"}; 94"......................"};
93 95
94static const char *xpm_tree_view[] = { 96const char *xpm_tree_view[] = {
95"22 22 2 1", 97"22 22 2 1",
96". c None", 98". c None",
97"# c #000000", 99"# c #000000",
@@ -118,7 +120,7 @@ static const char *xpm_tree_view[] = {
118"......................", 120"......................",
119"......................"}; 121"......................"};
120 122
121static const char *xpm_single_view[] = { 123const char *xpm_single_view[] = {
122"22 22 2 1", 124"22 22 2 1",
123". c None", 125". c None",
124"# c #000000", 126"# c #000000",
@@ -145,7 +147,7 @@ static const char *xpm_single_view[] = {
145"......................", 147"......................",
146"......................"}; 148"......................"};
147 149
148static const char *xpm_split_view[] = { 150const char *xpm_split_view[] = {
149"22 22 2 1", 151"22 22 2 1",
150". c None", 152". c None",
151"# c #000000", 153"# c #000000",
@@ -172,7 +174,7 @@ static const char *xpm_split_view[] = {
172"......................", 174"......................",
173"......................"}; 175"......................"};
174 176
175static const char *xpm_symbol_no[] = { 177const char *xpm_symbol_no[] = {
176"12 12 2 1", 178"12 12 2 1",
177" c white", 179" c white",
178". c black", 180". c black",
@@ -189,7 +191,7 @@ static const char *xpm_symbol_no[] = {
189" .......... ", 191" .......... ",
190" "}; 192" "};
191 193
192static const char *xpm_symbol_mod[] = { 194const char *xpm_symbol_mod[] = {
193"12 12 2 1", 195"12 12 2 1",
194" c white", 196" c white",
195". c black", 197". c black",
@@ -206,7 +208,7 @@ static const char *xpm_symbol_mod[] = {
206" .......... ", 208" .......... ",
207" "}; 209" "};
208 210
209static const char *xpm_symbol_yes[] = { 211const char *xpm_symbol_yes[] = {
210"12 12 2 1", 212"12 12 2 1",
211" c white", 213" c white",
212". c black", 214". c black",
@@ -223,7 +225,7 @@ static const char *xpm_symbol_yes[] = {
223" .......... ", 225" .......... ",
224" "}; 226" "};
225 227
226static const char *xpm_choice_no[] = { 228const char *xpm_choice_no[] = {
227"12 12 2 1", 229"12 12 2 1",
228" c white", 230" c white",
229". c black", 231". c black",
@@ -240,7 +242,7 @@ static const char *xpm_choice_no[] = {
240" .... ", 242" .... ",
241" "}; 243" "};
242 244
243static const char *xpm_choice_yes[] = { 245const char *xpm_choice_yes[] = {
244"12 12 2 1", 246"12 12 2 1",
245" c white", 247" c white",
246". c black", 248". c black",
@@ -257,7 +259,7 @@ static const char *xpm_choice_yes[] = {
257" .... ", 259" .... ",
258" "}; 260" "};
259 261
260static const char *xpm_menu[] = { 262const char *xpm_menu[] = {
261"12 12 2 1", 263"12 12 2 1",
262" c white", 264" c white",
263". c black", 265". c black",
@@ -274,7 +276,7 @@ static const char *xpm_menu[] = {
274" .......... ", 276" .......... ",
275" "}; 277" "};
276 278
277static const char *xpm_menu_inv[] = { 279const char *xpm_menu_inv[] = {
278"12 12 2 1", 280"12 12 2 1",
279" c white", 281" c white",
280". c black", 282". c black",
@@ -291,7 +293,7 @@ static const char *xpm_menu_inv[] = {
291" .......... ", 293" .......... ",
292" "}; 294" "};
293 295
294static const char *xpm_menuback[] = { 296const char *xpm_menuback[] = {
295"12 12 2 1", 297"12 12 2 1",
296" c white", 298" c white",
297". c black", 299". c black",
@@ -308,7 +310,7 @@ static const char *xpm_menuback[] = {
308" .......... ", 310" .......... ",
309" "}; 311" "};
310 312
311static const char *xpm_void[] = { 313const char *xpm_void[] = {
312"12 12 2 1", 314"12 12 2 1",
313" c white", 315" c white",
314". c black", 316". c black",
diff --git a/scripts/kconfig/images.h b/scripts/kconfig/images.h
new file mode 100644
index 000000000000..d8ff614bd087
--- /dev/null
+++ b/scripts/kconfig/images.h
@@ -0,0 +1,33 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
4 */
5
6#ifndef IMAGES_H
7#define IMAGES_H
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13extern const char *xpm_load[];
14extern const char *xpm_save[];
15extern const char *xpm_back[];
16extern const char *xpm_tree_view[];
17extern const char *xpm_single_view[];
18extern const char *xpm_split_view[];
19extern const char *xpm_symbol_no[];
20extern const char *xpm_symbol_mod[];
21extern const char *xpm_symbol_yes[];
22extern const char *xpm_choice_no[];
23extern const char *xpm_choice_yes[];
24extern const char *xpm_menu[];
25extern const char *xpm_menu_inv[];
26extern const char *xpm_menuback[];
27extern const char *xpm_void[];
28
29#ifdef __cplusplus
30}
31#endif
32
33#endif /* IMAGES_H */
diff --git a/scripts/kconfig/kconf_id.c b/scripts/kconfig/kconf_id.c
deleted file mode 100644
index b3e0ea0ac732..000000000000
--- a/scripts/kconfig/kconf_id.c
+++ /dev/null
@@ -1,52 +0,0 @@
1
2static struct kconf_id kconf_id_array[] = {
3 { "mainmenu", T_MAINMENU, TF_COMMAND },
4 { "menu", T_MENU, TF_COMMAND },
5 { "endmenu", T_ENDMENU, TF_COMMAND },
6 { "source", T_SOURCE, TF_COMMAND },
7 { "choice", T_CHOICE, TF_COMMAND },
8 { "endchoice", T_ENDCHOICE, TF_COMMAND },
9 { "comment", T_COMMENT, TF_COMMAND },
10 { "config", T_CONFIG, TF_COMMAND },
11 { "menuconfig", T_MENUCONFIG, TF_COMMAND },
12 { "help", T_HELP, TF_COMMAND },
13 { "---help---", T_HELP, TF_COMMAND },
14 { "if", T_IF, TF_COMMAND|TF_PARAM },
15 { "endif", T_ENDIF, TF_COMMAND },
16 { "depends", T_DEPENDS, TF_COMMAND },
17 { "optional", T_OPTIONAL, TF_COMMAND },
18 { "default", T_DEFAULT, TF_COMMAND, S_UNKNOWN },
19 { "prompt", T_PROMPT, TF_COMMAND },
20 { "tristate", T_TYPE, TF_COMMAND, S_TRISTATE },
21 { "def_tristate", T_DEFAULT, TF_COMMAND, S_TRISTATE },
22 { "bool", T_TYPE, TF_COMMAND, S_BOOLEAN },
23 { "def_bool", T_DEFAULT, TF_COMMAND, S_BOOLEAN },
24 { "int", T_TYPE, TF_COMMAND, S_INT },
25 { "hex", T_TYPE, TF_COMMAND, S_HEX },
26 { "string", T_TYPE, TF_COMMAND, S_STRING },
27 { "select", T_SELECT, TF_COMMAND },
28 { "imply", T_IMPLY, TF_COMMAND },
29 { "range", T_RANGE, TF_COMMAND },
30 { "visible", T_VISIBLE, TF_COMMAND },
31 { "option", T_OPTION, TF_COMMAND },
32 { "on", T_ON, TF_PARAM },
33 { "modules", T_OPT_MODULES, TF_OPTION },
34 { "defconfig_list", T_OPT_DEFCONFIG_LIST, TF_OPTION },
35 { "allnoconfig_y", T_OPT_ALLNOCONFIG_Y, TF_OPTION },
36};
37
38#define KCONF_ID_ARRAY_SIZE (sizeof(kconf_id_array)/sizeof(struct kconf_id))
39
40static const struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len)
41{
42 int i;
43
44 for (i = 0; i < KCONF_ID_ARRAY_SIZE; i++) {
45 struct kconf_id *id = kconf_id_array+i;
46 int l = strlen(id->name);
47
48 if (len == l && !memcmp(str, id->name, len))
49 return id;
50 }
51 return NULL;
52}
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 9eb7c837cd8f..531ff7c57d92 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -1,6 +1,6 @@
1/* SPDX-License-Identifier: GPL-2.0 */
1/* 2/*
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0.
4 */ 4 */
5 5
6#ifndef LKC_H 6#ifndef LKC_H
@@ -30,10 +30,6 @@ static inline const char *CONFIG_prefix(void)
30#undef CONFIG_ 30#undef CONFIG_
31#define CONFIG_ CONFIG_prefix() 31#define CONFIG_ CONFIG_prefix()
32 32
33#define TF_COMMAND 0x0001
34#define TF_PARAM 0x0002
35#define TF_OPTION 0x0004
36
37enum conf_def_mode { 33enum conf_def_mode {
38 def_default, 34 def_default,
39 def_yes, 35 def_yes,
@@ -42,17 +38,6 @@ enum conf_def_mode {
42 def_random 38 def_random
43}; 39};
44 40
45#define T_OPT_MODULES 1
46#define T_OPT_DEFCONFIG_LIST 2
47#define T_OPT_ALLNOCONFIG_Y 4
48
49struct kconf_id {
50 const char *name;
51 int token;
52 unsigned int flags;
53 enum symbol_type stype;
54};
55
56extern int yylineno; 41extern int yylineno;
57void zconfdump(FILE *out); 42void zconfdump(FILE *out);
58void zconf_starthelp(void); 43void zconf_starthelp(void);
@@ -91,7 +76,9 @@ void menu_add_visibility(struct expr *dep);
91struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); 76struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
92void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); 77void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
93void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep); 78void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep);
94void menu_add_option(int token, char *arg); 79void menu_add_option_modules(void);
80void menu_add_option_defconfig_list(void);
81void menu_add_option_allnoconfig_y(void);
95void menu_finalize(struct menu *parent); 82void menu_finalize(struct menu *parent);
96void menu_set_type(int type); 83void menu_set_type(int type);
97 84
@@ -103,6 +90,9 @@ void *xrealloc(void *p, size_t size);
103char *xstrdup(const char *s); 90char *xstrdup(const char *s);
104char *xstrndup(const char *s, size_t n); 91char *xstrndup(const char *s, size_t n);
105 92
93/* zconf.l */
94int yylex(void);
95
106struct gstr { 96struct gstr {
107 size_t len; 97 size_t len;
108 char *s; 98 char *s;
@@ -121,6 +111,7 @@ const char *str_get(struct gstr *gs);
121/* symbol.c */ 111/* symbol.c */
122void sym_clear_all_valid(void); 112void sym_clear_all_valid(void);
123struct symbol *sym_choice_default(struct symbol *sym); 113struct symbol *sym_choice_default(struct symbol *sym);
114struct property *sym_get_range_prop(struct symbol *sym);
124const char *sym_get_string_default(struct symbol *sym); 115const char *sym_get_string_default(struct symbol *sym);
125struct symbol *sym_check_deps(struct symbol *sym); 116struct symbol *sym_check_deps(struct symbol *sym);
126struct property *prop_alloc(enum prop_type type, struct symbol *sym); 117struct property *prop_alloc(enum prop_type type, struct symbol *sym);
diff --git a/scripts/kconfig/lxdialog/checklist.c b/scripts/kconfig/lxdialog/checklist.c
index 2e96323ad11b..fd161cfff121 100644
--- a/scripts/kconfig/lxdialog/checklist.c
+++ b/scripts/kconfig/lxdialog/checklist.c
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0+
1/* 2/*
2 * checklist.c -- implements the checklist box 3 * checklist.c -- implements the checklist box
3 * 4 *
@@ -5,20 +6,6 @@
5 * Stuart Herbert - S.Herbert@sheffield.ac.uk: radiolist extension 6 * Stuart Herbert - S.Herbert@sheffield.ac.uk: radiolist extension
6 * Alessandro Rubini - rubini@ipvvis.unipv.it: merged the two 7 * Alessandro Rubini - rubini@ipvvis.unipv.it: merged the two
7 * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) 8 * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com)
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */ 9 */
23 10
24#include "dialog.h" 11#include "dialog.h"
diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h
index 0b00be5abaa6..68b565e3c495 100644
--- a/scripts/kconfig/lxdialog/dialog.h
+++ b/scripts/kconfig/lxdialog/dialog.h
@@ -1,21 +1,8 @@
1/* SPDX-License-Identifier: GPL-2.0+ */
1/* 2/*
2 * dialog.h -- common declarations for all dialog modules 3 * dialog.h -- common declarations for all dialog modules
3 * 4 *
4 * AUTHOR: Savio Lam (lam836@cs.cuhk.hk) 5 * AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */ 6 */
20 7
21#include <sys/types.h> 8#include <sys/types.h>
diff --git a/scripts/kconfig/lxdialog/inputbox.c b/scripts/kconfig/lxdialog/inputbox.c
index fe82ff6d744e..611945611bf8 100644
--- a/scripts/kconfig/lxdialog/inputbox.c
+++ b/scripts/kconfig/lxdialog/inputbox.c
@@ -1,22 +1,9 @@
1// SPDX-License-Identifier: GPL-2.0+
1/* 2/*
2 * inputbox.c -- implements the input box 3 * inputbox.c -- implements the input box
3 * 4 *
4 * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) 5 * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
5 * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) 6 * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 7 */
21 8
22#include "dialog.h" 9#include "dialog.h"
diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index d70cab36137e..58c2f8afe59b 100644
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -1,22 +1,9 @@
1// SPDX-License-Identifier: GPL-2.0+
1/* 2/*
2 * menubox.c -- implements the menu box 3 * menubox.c -- implements the menu box
3 * 4 *
4 * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) 5 * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
5 * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcapw@cfw.com) 6 * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcapw@cfw.com)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 7 */
21 8
22/* 9/*
diff --git a/scripts/kconfig/lxdialog/textbox.c b/scripts/kconfig/lxdialog/textbox.c
index 88d2818ed956..4e339b12664e 100644
--- a/scripts/kconfig/lxdialog/textbox.c
+++ b/scripts/kconfig/lxdialog/textbox.c
@@ -1,22 +1,9 @@
1// SPDX-License-Identifier: GPL-2.0+
1/* 2/*
2 * textbox.c -- implements the text box 3 * textbox.c -- implements the text box
3 * 4 *
4 * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) 5 * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
5 * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) 6 * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 7 */
21 8
22#include "dialog.h" 9#include "dialog.h"
diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c
index f7abdeb92af0..1b490d4af0d3 100644
--- a/scripts/kconfig/lxdialog/util.c
+++ b/scripts/kconfig/lxdialog/util.c
@@ -1,22 +1,9 @@
1// SPDX-License-Identifier: GPL-2.0+
1/* 2/*
2 * util.c 3 * util.c
3 * 4 *
4 * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) 5 * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
5 * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) 6 * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 7 */
21 8
22#include <stdarg.h> 9#include <stdarg.h>
diff --git a/scripts/kconfig/lxdialog/yesno.c b/scripts/kconfig/lxdialog/yesno.c
index cd1223c903d1..bcaac9b7bab2 100644
--- a/scripts/kconfig/lxdialog/yesno.c
+++ b/scripts/kconfig/lxdialog/yesno.c
@@ -1,22 +1,9 @@
1// SPDX-License-Identifier: GPL-2.0+
1/* 2/*
2 * yesno.c -- implements the yes/no box 3 * yesno.c -- implements the yes/no box
3 * 4 *
4 * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) 5 * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
5 * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) 6 * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 7 */
21 8
22#include "dialog.h" 9#include "dialog.h"
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 143c05fec161..5f8c82a4cb08 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -1,6 +1,6 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0.
4 * 4 *
5 * Introduced single menu mode (show all sub-menus in one large tree). 5 * Introduced single menu mode (show all sub-menus in one large tree).
6 * 2002-11-06 Petr Baudis <pasky@ucw.cz> 6 * 2002-11-06 Petr Baudis <pasky@ucw.cz>
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 4cf15d449c05..d9d16469859a 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -1,6 +1,6 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0.
4 */ 4 */
5 5
6#include <ctype.h> 6#include <ctype.h>
@@ -195,29 +195,26 @@ void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep)
195 menu_add_prop(type, NULL, expr_alloc_symbol(sym), dep); 195 menu_add_prop(type, NULL, expr_alloc_symbol(sym), dep);
196} 196}
197 197
198void menu_add_option(int token, char *arg) 198void menu_add_option_modules(void)
199{ 199{
200 switch (token) { 200 if (modules_sym)
201 case T_OPT_MODULES: 201 zconf_error("symbol '%s' redefines option 'modules' already defined by symbol '%s'",
202 if (modules_sym) 202 current_entry->sym->name, modules_sym->name);
203 zconf_error("symbol '%s' redefines option 'modules'" 203 modules_sym = current_entry->sym;
204 " already defined by symbol '%s'", 204}
205 current_entry->sym->name, 205
206 modules_sym->name 206void menu_add_option_defconfig_list(void)
207 ); 207{
208 modules_sym = current_entry->sym; 208 if (!sym_defconfig_list)
209 break; 209 sym_defconfig_list = current_entry->sym;
210 case T_OPT_DEFCONFIG_LIST: 210 else if (sym_defconfig_list != current_entry->sym)
211 if (!sym_defconfig_list) 211 zconf_error("trying to redefine defconfig symbol");
212 sym_defconfig_list = current_entry->sym; 212 sym_defconfig_list->flags |= SYMBOL_NO_WRITE;
213 else if (sym_defconfig_list != current_entry->sym) 213}
214 zconf_error("trying to redefine defconfig symbol"); 214
215 sym_defconfig_list->flags |= SYMBOL_NO_WRITE; 215void menu_add_option_allnoconfig_y(void)
216 break; 216{
217 case T_OPT_ALLNOCONFIG_Y: 217 current_entry->sym->flags |= SYMBOL_ALLNOCONFIG_Y;
218 current_entry->sym->flags |= SYMBOL_ALLNOCONFIG_Y;
219 break;
220 }
221} 218}
222 219
223static int menu_validate_number(struct symbol *sym, struct symbol *sym2) 220static int menu_validate_number(struct symbol *sym, struct symbol *sym2)
diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
index 0ef906499646..d924c51d28b7 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -1,4 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3#
2# merge_config.sh - Takes a list of config fragment values, and merges 4# merge_config.sh - Takes a list of config fragment values, and merges
3# them one by one. Provides warnings on overridden values, and specified 5# them one by one. Provides warnings on overridden values, and specified
4# values that did not make it to the resulting .config file (due to missed 6# values that did not make it to the resulting .config file (due to missed
@@ -10,18 +12,10 @@
10# 12#
11# Copyright (c) 2009-2010 Wind River Systems, Inc. 13# Copyright (c) 2009-2010 Wind River Systems, Inc.
12# Copyright 2011 Linaro 14# Copyright 2011 Linaro
13#
14# This program is free software; you can redistribute it and/or modify
15# it under the terms of the GNU General Public License version 2 as
16# published by the Free Software Foundation.
17#
18# This program is distributed in the hope that it will be useful,
19# but WITHOUT ANY WARRANTY; without even the implied warranty of
20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21# See the GNU General Public License for more details.
22 15
23clean_up() { 16clean_up() {
24 rm -f $TMP_FILE 17 rm -f $TMP_FILE
18 rm -f $MERGE_FILE
25 exit 19 exit
26} 20}
27trap clean_up HUP INT TERM 21trap clean_up HUP INT TERM
@@ -32,6 +26,7 @@ usage() {
32 echo " -m only merge the fragments, do not execute the make command" 26 echo " -m only merge the fragments, do not execute the make command"
33 echo " -n use allnoconfig instead of alldefconfig" 27 echo " -n use allnoconfig instead of alldefconfig"
34 echo " -r list redundant entries when merging fragments" 28 echo " -r list redundant entries when merging fragments"
29 echo " -y make builtin have precedence over modules"
35 echo " -O dir to put generated output files. Consider setting \$KCONFIG_CONFIG instead." 30 echo " -O dir to put generated output files. Consider setting \$KCONFIG_CONFIG instead."
36 echo 31 echo
37 echo "Used prefix: '$CONFIG_PREFIX'. You can redefine it with \$CONFIG_ environment variable." 32 echo "Used prefix: '$CONFIG_PREFIX'. You can redefine it with \$CONFIG_ environment variable."
@@ -40,6 +35,7 @@ usage() {
40RUNMAKE=true 35RUNMAKE=true
41ALLTARGET=alldefconfig 36ALLTARGET=alldefconfig
42WARNREDUN=false 37WARNREDUN=false
38BUILTIN=false
43OUTPUT=. 39OUTPUT=.
44CONFIG_PREFIX=${CONFIG_-CONFIG_} 40CONFIG_PREFIX=${CONFIG_-CONFIG_}
45 41
@@ -64,6 +60,11 @@ while true; do
64 shift 60 shift
65 continue 61 continue
66 ;; 62 ;;
63 "-y")
64 BUILTIN=true
65 shift
66 continue
67 ;;
67 "-O") 68 "-O")
68 if [ -d $2 ];then 69 if [ -d $2 ];then
69 OUTPUT=$(echo $2 | sed 's/\/*$//') 70 OUTPUT=$(echo $2 | sed 's/\/*$//')
@@ -106,32 +107,45 @@ SED_CONFIG_EXP1="s/^\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)=.*/\1/p"
106SED_CONFIG_EXP2="s/^# \(${CONFIG_PREFIX}[a-zA-Z0-9_]*\) is not set$/\1/p" 107SED_CONFIG_EXP2="s/^# \(${CONFIG_PREFIX}[a-zA-Z0-9_]*\) is not set$/\1/p"
107 108
108TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX) 109TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX)
110MERGE_FILE=$(mktemp ./.merge_tmp.config.XXXXXXXXXX)
109 111
110echo "Using $INITFILE as base" 112echo "Using $INITFILE as base"
111cat $INITFILE > $TMP_FILE 113cat $INITFILE > $TMP_FILE
112 114
113# Merge files, printing warnings on overridden values 115# Merge files, printing warnings on overridden values
114for MERGE_FILE in $MERGE_LIST ; do 116for ORIG_MERGE_FILE in $MERGE_LIST ; do
115 echo "Merging $MERGE_FILE" 117 echo "Merging $ORIG_MERGE_FILE"
116 if [ ! -r "$MERGE_FILE" ]; then 118 if [ ! -r "$ORIG_MERGE_FILE" ]; then
117 echo "The merge file '$MERGE_FILE' does not exist. Exit." >&2 119 echo "The merge file '$ORIG_MERGE_FILE' does not exist. Exit." >&2
118 exit 1 120 exit 1
119 fi 121 fi
122 cat $ORIG_MERGE_FILE > $MERGE_FILE
120 CFG_LIST=$(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $MERGE_FILE) 123 CFG_LIST=$(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $MERGE_FILE)
121 124
122 for CFG in $CFG_LIST ; do 125 for CFG in $CFG_LIST ; do
123 grep -q -w $CFG $TMP_FILE || continue 126 grep -q -w $CFG $TMP_FILE || continue
124 PREV_VAL=$(grep -w $CFG $TMP_FILE) 127 PREV_VAL=$(grep -w $CFG $TMP_FILE)
125 NEW_VAL=$(grep -w $CFG $MERGE_FILE) 128 NEW_VAL=$(grep -w $CFG $MERGE_FILE)
126 if [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then 129 BUILTIN_FLAG=false
127 echo Value of $CFG is redefined by fragment $MERGE_FILE: 130 if [ "$BUILTIN" = "true" ] && [ "${NEW_VAL#CONFIG_*=}" = "m" ] && [ "${PREV_VAL#CONFIG_*=}" = "y" ]; then
131 echo Previous value: $PREV_VAL
132 echo New value: $NEW_VAL
133 echo -y passed, will not demote y to m
134 echo
135 BUILTIN_FLAG=true
136 elif [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then
137 echo Value of $CFG is redefined by fragment $ORIG_MERGE_FILE:
128 echo Previous value: $PREV_VAL 138 echo Previous value: $PREV_VAL
129 echo New value: $NEW_VAL 139 echo New value: $NEW_VAL
130 echo 140 echo
131 elif [ "$WARNREDUN" = "true" ]; then 141 elif [ "$WARNREDUN" = "true" ]; then
132 echo Value of $CFG is redundant by fragment $MERGE_FILE: 142 echo Value of $CFG is redundant by fragment $ORIG_MERGE_FILE:
143 fi
144 if [ "$BUILTIN_FLAG" = "false" ]; then
145 sed -i "/$CFG[ =]/d" $TMP_FILE
146 else
147 sed -i "/$CFG[ =]/d" $MERGE_FILE
133 fi 148 fi
134 sed -i "/$CFG[ =]/d" $TMP_FILE
135 done 149 done
136 cat $MERGE_FILE >> $TMP_FILE 150 cat $MERGE_FILE >> $TMP_FILE
137done 151done
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index 1ef232ae5ab9..a4670f4e825a 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -1,9 +1,8 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com? 3 * Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com>
3 * Released under the terms of the GNU GPL v2.0.
4 * 4 *
5 * Derived from menuconfig. 5 * Derived from menuconfig.
6 *
7 */ 6 */
8#ifndef _GNU_SOURCE 7#ifndef _GNU_SOURCE
9#define _GNU_SOURCE 8#define _GNU_SOURCE
diff --git a/scripts/kconfig/nconf.gui.c b/scripts/kconfig/nconf.gui.c
index 88874acfda36..7be620a1fcdb 100644
--- a/scripts/kconfig/nconf.gui.c
+++ b/scripts/kconfig/nconf.gui.c
@@ -1,9 +1,8 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com? 3 * Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com>
3 * Released under the terms of the GNU GPL v2.0.
4 * 4 *
5 * Derived from menuconfig. 5 * Derived from menuconfig.
6 *
7 */ 6 */
8#include "nconf.h" 7#include "nconf.h"
9#include "lkc.h" 8#include "lkc.h"
diff --git a/scripts/kconfig/nconf.h b/scripts/kconfig/nconf.h
index 2b9e19f603c4..fa5245eb93a7 100644
--- a/scripts/kconfig/nconf.h
+++ b/scripts/kconfig/nconf.h
@@ -1,9 +1,8 @@
1/* SPDX-License-Identifier: GPL-2.0 */
1/* 2/*
2 * Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com? 3 * Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com>
3 * Released under the terms of the GNU GPL v2.0.
4 * 4 *
5 * Derived from menuconfig. 5 * Derived from menuconfig.
6 *
7 */ 6 */
8 7
9#include <ctype.h> 8#include <ctype.h>
diff --git a/scripts/kconfig/preprocess.c b/scripts/kconfig/preprocess.c
index 5ca2df790d3c..592dfbfa9fb3 100644
--- a/scripts/kconfig/preprocess.c
+++ b/scripts/kconfig/preprocess.c
@@ -2,6 +2,7 @@
2// 2//
3// Copyright (C) 2018 Masahiro Yamada <yamada.masahiro@socionext.com> 3// Copyright (C) 2018 Masahiro Yamada <yamada.masahiro@socionext.com>
4 4
5#include <ctype.h>
5#include <stdarg.h> 6#include <stdarg.h>
6#include <stdbool.h> 7#include <stdbool.h>
7#include <stdio.h> 8#include <stdio.h>
@@ -9,6 +10,7 @@
9#include <string.h> 10#include <string.h>
10 11
11#include "list.h" 12#include "list.h"
13#include "lkc.h"
12 14
13#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) 15#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
14 16
@@ -555,8 +557,7 @@ char *expand_string(const char *in)
555 557
556static bool is_end_of_token(char c) 558static bool is_end_of_token(char c)
557{ 559{
558 /* Why are '.' and '/' valid characters for symbols? */ 560 return !(isalnum(c) || c == '_' || c == '-');
559 return !(isalnum(c) || c == '_' || c == '-' || c == '.' || c == '/');
560} 561}
561 562
562/* 563/*
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index ef4310f2558b..8be8a70c5542 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1,7 +1,7 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Copyright (C) 2015 Boris Barbulovski <bbarbulovski@gmail.com> 4 * Copyright (C) 2015 Boris Barbulovski <bbarbulovski@gmail.com>
4 * Released under the terms of the GNU GPL v2.0.
5 */ 5 */
6 6
7#include <qglobal.h> 7#include <qglobal.h>
@@ -32,7 +32,7 @@
32#include "qconf.h" 32#include "qconf.h"
33 33
34#include "qconf.moc" 34#include "qconf.moc"
35#include "images.c" 35#include "images.h"
36 36
37 37
38static QApplication *configApp; 38static QApplication *configApp;
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index a40036d1b059..41df466e67d9 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -1,6 +1,6 @@
1/* SPDX-License-Identifier: GPL-2.0 */
1/* 2/*
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0.
4 */ 4 */
5 5
6#include <QTextBrowser> 6#include <QTextBrowser>
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index 4686531e2f8c..08d76d7b3b81 100755
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -1,7 +1,7 @@
1#!/usr/bin/env perl 1#!/usr/bin/env perl
2# SPDX-License-Identifier: GPL-2.0
2# 3#
3# Copyright 2005-2009 - Steven Rostedt 4# Copyright 2005-2009 - Steven Rostedt
4# Licensed under the terms of the GNU GPL License version 2
5# 5#
6# It's simple enough to figure out how this works. 6# It's simple enough to figure out how this works.
7# If not, then you can ask me at stripconfig@goodmis.org 7# If not, then you can ask me at stripconfig@goodmis.org
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 703b9b899ee9..1f9266dadedf 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -1,6 +1,6 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0.
4 */ 4 */
5 5
6#include <ctype.h> 6#include <ctype.h>
@@ -61,8 +61,6 @@ const char *sym_type_name(enum symbol_type type)
61 return "string"; 61 return "string";
62 case S_UNKNOWN: 62 case S_UNKNOWN:
63 return "unknown"; 63 return "unknown";
64 case S_OTHER:
65 break;
66 } 64 }
67 return "???"; 65 return "???";
68} 66}
@@ -88,7 +86,7 @@ static struct property *sym_get_default_prop(struct symbol *sym)
88 return NULL; 86 return NULL;
89} 87}
90 88
91static struct property *sym_get_range_prop(struct symbol *sym) 89struct property *sym_get_range_prop(struct symbol *sym)
92{ 90{
93 struct property *prop; 91 struct property *prop;
94 92
@@ -757,7 +755,6 @@ const char *sym_get_string_default(struct symbol *sym)
757 return str; 755 return str;
758 case S_STRING: 756 case S_STRING:
759 return str; 757 return str;
760 case S_OTHER:
761 case S_UNKNOWN: 758 case S_UNKNOWN:
762 break; 759 break;
763 } 760 }
diff --git a/scripts/kconfig/tests/auto_submenu/Kconfig b/scripts/kconfig/tests/auto_submenu/Kconfig
index c17bf2caa7e6..b20761edc2f4 100644
--- a/scripts/kconfig/tests/auto_submenu/Kconfig
+++ b/scripts/kconfig/tests/auto_submenu/Kconfig
@@ -1,3 +1,5 @@
1# SPDX-License-Identifier: GPL-2.0
2
1config A 3config A
2 bool "A" 4 bool "A"
3 default y 5 default y
diff --git a/scripts/kconfig/tests/auto_submenu/__init__.py b/scripts/kconfig/tests/auto_submenu/__init__.py
index 32e79b85faeb..25abd927fd0a 100644
--- a/scripts/kconfig/tests/auto_submenu/__init__.py
+++ b/scripts/kconfig/tests/auto_submenu/__init__.py
@@ -1,3 +1,4 @@
1# SPDX-License-Identifier: GPL-2.0
1""" 2"""
2Create submenu for symbols that depend on the preceding one. 3Create submenu for symbols that depend on the preceding one.
3 4
diff --git a/scripts/kconfig/tests/choice/Kconfig b/scripts/kconfig/tests/choice/Kconfig
index cc60e9ce2c03..a412205b1b0c 100644
--- a/scripts/kconfig/tests/choice/Kconfig
+++ b/scripts/kconfig/tests/choice/Kconfig
@@ -1,3 +1,5 @@
1# SPDX-License-Identifier: GPL-2.0
2
1config MODULES 3config MODULES
2 bool "Enable loadable module support" 4 bool "Enable loadable module support"
3 option modules 5 option modules
diff --git a/scripts/kconfig/tests/choice/__init__.py b/scripts/kconfig/tests/choice/__init__.py
index 9edcc5262134..4318fce05912 100644
--- a/scripts/kconfig/tests/choice/__init__.py
+++ b/scripts/kconfig/tests/choice/__init__.py
@@ -1,3 +1,4 @@
1# SPDX-License-Identifier: GPL-2.0
1""" 2"""
2Basic choice tests. 3Basic choice tests.
3 4
diff --git a/scripts/kconfig/tests/choice_value_with_m_dep/Kconfig b/scripts/kconfig/tests/choice_value_with_m_dep/Kconfig
index 11ac25c26040..7106c26bb3a8 100644
--- a/scripts/kconfig/tests/choice_value_with_m_dep/Kconfig
+++ b/scripts/kconfig/tests/choice_value_with_m_dep/Kconfig
@@ -1,3 +1,5 @@
1# SPDX-License-Identifier: GPL-2.0
2
1config MODULES 3config MODULES
2 def_bool y 4 def_bool y
3 option modules 5 option modules
diff --git a/scripts/kconfig/tests/choice_value_with_m_dep/__init__.py b/scripts/kconfig/tests/choice_value_with_m_dep/__init__.py
index f8d728c7b101..075b4e08696e 100644
--- a/scripts/kconfig/tests/choice_value_with_m_dep/__init__.py
+++ b/scripts/kconfig/tests/choice_value_with_m_dep/__init__.py
@@ -1,3 +1,4 @@
1# SPDX-License-Identifier: GPL-2.0
1""" 2"""
2Hide tristate choice values with mod dependency in y choice. 3Hide tristate choice values with mod dependency in y choice.
3 4
diff --git a/scripts/kconfig/tests/err_recursive_inc/__init__.py b/scripts/kconfig/tests/err_recursive_inc/__init__.py
index 0e4c839c54aa..27aa1895a0b2 100644
--- a/scripts/kconfig/tests/err_recursive_inc/__init__.py
+++ b/scripts/kconfig/tests/err_recursive_inc/__init__.py
@@ -1,3 +1,4 @@
1# SPDX-License-Identifier: GPL-2.0
1""" 2"""
2Detect recursive inclusion error. 3Detect recursive inclusion error.
3 4
diff --git a/scripts/kconfig/tests/inter_choice/Kconfig b/scripts/kconfig/tests/inter_choice/Kconfig
index e44449f075df..5698a4018dd0 100644
--- a/scripts/kconfig/tests/inter_choice/Kconfig
+++ b/scripts/kconfig/tests/inter_choice/Kconfig
@@ -1,3 +1,5 @@
1# SPDX-License-Identifier: GPL-2.0
2
1config MODULES 3config MODULES
2 def_bool y 4 def_bool y
3 option modules 5 option modules
diff --git a/scripts/kconfig/tests/inter_choice/__init__.py b/scripts/kconfig/tests/inter_choice/__init__.py
index 5c7fc365ed40..ffea6b1148a6 100644
--- a/scripts/kconfig/tests/inter_choice/__init__.py
+++ b/scripts/kconfig/tests/inter_choice/__init__.py
@@ -1,3 +1,4 @@
1# SPDX-License-Identifier: GPL-2.0
1""" 2"""
2Do not affect user-assigned choice value by another choice. 3Do not affect user-assigned choice value by another choice.
3 4
diff --git a/scripts/kconfig/tests/new_choice_with_dep/Kconfig b/scripts/kconfig/tests/new_choice_with_dep/Kconfig
index 53ef1b86e7bf..127731c046b5 100644
--- a/scripts/kconfig/tests/new_choice_with_dep/Kconfig
+++ b/scripts/kconfig/tests/new_choice_with_dep/Kconfig
@@ -1,3 +1,5 @@
1# SPDX-License-Identifier: GPL-2.0
2
1config A 3config A
2 bool "A" 4 bool "A"
3 help 5 help
diff --git a/scripts/kconfig/tests/new_choice_with_dep/__init__.py b/scripts/kconfig/tests/new_choice_with_dep/__init__.py
index f0e0ead0f32f..fe9d322539c9 100644
--- a/scripts/kconfig/tests/new_choice_with_dep/__init__.py
+++ b/scripts/kconfig/tests/new_choice_with_dep/__init__.py
@@ -1,3 +1,4 @@
1# SPDX-License-Identifier: GPL-2.0
1""" 2"""
2Ask new choice values when they become visible. 3Ask new choice values when they become visible.
3 4
diff --git a/scripts/kconfig/tests/no_write_if_dep_unmet/Kconfig b/scripts/kconfig/tests/no_write_if_dep_unmet/Kconfig
index c00b8fe54f45..4767aab6d8e3 100644
--- a/scripts/kconfig/tests/no_write_if_dep_unmet/Kconfig
+++ b/scripts/kconfig/tests/no_write_if_dep_unmet/Kconfig
@@ -1,3 +1,5 @@
1# SPDX-License-Identifier: GPL-2.0
2
1config A 3config A
2 bool "A" 4 bool "A"
3 5
diff --git a/scripts/kconfig/tests/no_write_if_dep_unmet/__init__.py b/scripts/kconfig/tests/no_write_if_dep_unmet/__init__.py
index 207261b0fe00..ffd469d1f226 100644
--- a/scripts/kconfig/tests/no_write_if_dep_unmet/__init__.py
+++ b/scripts/kconfig/tests/no_write_if_dep_unmet/__init__.py
@@ -1,3 +1,4 @@
1# SPDX-License-Identifier: GPL-2.0
1""" 2"""
2Do not write choice values to .config if the dependency is unmet. 3Do not write choice values to .config if the dependency is unmet.
3 4
diff --git a/scripts/kconfig/tests/rand_nested_choice/Kconfig b/scripts/kconfig/tests/rand_nested_choice/Kconfig
index c591d512929f..8350de7f732b 100644
--- a/scripts/kconfig/tests/rand_nested_choice/Kconfig
+++ b/scripts/kconfig/tests/rand_nested_choice/Kconfig
@@ -1,3 +1,5 @@
1# SPDX-License-Identifier: GPL-2.0
2
1choice 3choice
2 prompt "choice" 4 prompt "choice"
3 5
diff --git a/scripts/kconfig/tests/rand_nested_choice/__init__.py b/scripts/kconfig/tests/rand_nested_choice/__init__.py
index e729a4e85218..9e4b2db53581 100644
--- a/scripts/kconfig/tests/rand_nested_choice/__init__.py
+++ b/scripts/kconfig/tests/rand_nested_choice/__init__.py
@@ -1,3 +1,4 @@
1# SPDX-License-Identifier: GPL-2.0
1""" 2"""
2Set random values recursively in nested choices. 3Set random values recursively in nested choices.
3 4
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c
index d999683bb2a7..29585394df71 100644
--- a/scripts/kconfig/util.c
+++ b/scripts/kconfig/util.c
@@ -1,8 +1,7 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Copyright (C) 2002-2005 Roman Zippel <zippel@linux-m68k.org> 3 * Copyright (C) 2002-2005 Roman Zippel <zippel@linux-m68k.org>
3 * Copyright (C) 2002-2005 Sam Ravnborg <sam@ravnborg.org> 4 * Copyright (C) 2002-2005 Sam Ravnborg <sam@ravnborg.org>
4 *
5 * Released under the terms of the GNU GPL v2.0.
6 */ 5 */
7 6
8#include <stdarg.h> 7#include <stdarg.h>
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
index 25bd2b89fe3f..b2d0a3b0bce9 100644
--- a/scripts/kconfig/zconf.l
+++ b/scripts/kconfig/zconf.l
@@ -1,11 +1,11 @@
1%option nostdinit noyywrap never-interactive full ecs 1/* SPDX-License-Identifier: GPL-2.0 */
2%option 8bit nodefault yylineno
3%x COMMAND HELP STRING PARAM ASSIGN_VAL
4%{
5/* 2/*
6 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
7 * Released under the terms of the GNU GPL v2.0.
8 */ 4 */
5%option nostdinit noyywrap never-interactive full ecs
6%option 8bit nodefault yylineno
7%x ASSIGN_VAL HELP STRING
8%{
9 9
10#include <assert.h> 10#include <assert.h>
11#include <limits.h> 11#include <limits.h>
@@ -15,6 +15,9 @@
15#include <unistd.h> 15#include <unistd.h>
16 16
17#include "lkc.h" 17#include "lkc.h"
18#include "zconf.tab.h"
19
20#define YY_DECL static int yylex1(void)
18 21
19#define START_STRSIZE 16 22#define START_STRSIZE 16
20 23
@@ -23,6 +26,8 @@ static struct {
23 int lineno; 26 int lineno;
24} current_pos; 27} current_pos;
25 28
29static int prev_prev_token = T_EOL;
30static int prev_token = T_EOL;
26static char *text; 31static char *text;
27static int text_size, text_asize; 32static int text_size, text_asize;
28 33
@@ -73,7 +78,7 @@ static void warn_ignored_character(char chr)
73{ 78{
74 fprintf(stderr, 79 fprintf(stderr,
75 "%s:%d:warning: ignoring unsupported character '%c'\n", 80 "%s:%d:warning: ignoring unsupported character '%c'\n",
76 zconf_curname(), zconf_lineno(), chr); 81 current_file->name, yylineno, chr);
77} 82}
78%} 83%}
79 84
@@ -83,54 +88,73 @@ n [A-Za-z0-9_-]
83 int str = 0; 88 int str = 0;
84 int ts, i; 89 int ts, i;
85 90
86[ \t]*#.*\n | 91#.* /* ignore comment */
87[ \t]*\n { 92[ \t]* /* whitespaces */
88 return T_EOL; 93\\\n /* escaped new line */
89} 94\n return T_EOL;
90[ \t]*#.* 95"allnoconfig_y" return T_ALLNOCONFIG_Y;
91 96"bool" return T_BOOL;
92 97"choice" return T_CHOICE;
93[ \t]+ { 98"comment" return T_COMMENT;
94 BEGIN(COMMAND); 99"config" return T_CONFIG;
95} 100"def_bool" return T_DEF_BOOL;
96 101"def_tristate" return T_DEF_TRISTATE;
97. { 102"default" return T_DEFAULT;
98 unput(yytext[0]); 103"defconfig_list" return T_DEFCONFIG_LIST;
99 BEGIN(COMMAND); 104"depends" return T_DEPENDS;
100} 105"endchoice" return T_ENDCHOICE;
101 106"endif" return T_ENDIF;
102 107"endmenu" return T_ENDMENU;
103<COMMAND>{ 108"help"|"---help---" return T_HELP;
104 {n}+ { 109"hex" return T_HEX;
105 const struct kconf_id *id = kconf_id_lookup(yytext, yyleng); 110"if" return T_IF;
106 current_pos.file = current_file; 111"imply" return T_IMPLY;
107 current_pos.lineno = yylineno; 112"int" return T_INT;
108 if (id && id->flags & TF_COMMAND) { 113"mainmenu" return T_MAINMENU;
109 BEGIN(PARAM); 114"menu" return T_MENU;
110 yylval.id = id; 115"menuconfig" return T_MENUCONFIG;
111 return id->token; 116"modules" return T_MODULES;
112 } 117"on" return T_ON;
113 alloc_string(yytext, yyleng); 118"option" return T_OPTION;
114 yylval.string = text; 119"optional" return T_OPTIONAL;
115 return T_VARIABLE; 120"prompt" return T_PROMPT;
116 } 121"range" return T_RANGE;
117 ({n}|$)+ { 122"select" return T_SELECT;
118 /* this token includes at least one '$' */ 123"source" return T_SOURCE;
119 yylval.string = expand_token(yytext, yyleng); 124"string" return T_STRING;
120 if (strlen(yylval.string)) 125"tristate" return T_TRISTATE;
121 return T_VARIABLE; 126"visible" return T_VISIBLE;
122 free(yylval.string); 127"||" return T_OR;
123 } 128"&&" return T_AND;
124 "=" { BEGIN(ASSIGN_VAL); yylval.flavor = VAR_RECURSIVE; return T_ASSIGN; } 129"=" return T_EQUAL;
125 ":=" { BEGIN(ASSIGN_VAL); yylval.flavor = VAR_SIMPLE; return T_ASSIGN; } 130"!=" return T_UNEQUAL;
126 "+=" { BEGIN(ASSIGN_VAL); yylval.flavor = VAR_APPEND; return T_ASSIGN; } 131"<" return T_LESS;
127 [[:blank:]]+ 132"<=" return T_LESS_EQUAL;
128 . warn_ignored_character(*yytext); 133">" return T_GREATER;
129 \n { 134">=" return T_GREATER_EQUAL;
130 BEGIN(INITIAL); 135"!" return T_NOT;
131 return T_EOL; 136"(" return T_OPEN_PAREN;
132 } 137")" return T_CLOSE_PAREN;
133} 138":=" return T_COLON_EQUAL;
139"+=" return T_PLUS_EQUAL;
140\"|\' {
141 str = yytext[0];
142 new_string();
143 BEGIN(STRING);
144 }
145{n}+ {
146 alloc_string(yytext, yyleng);
147 yylval.string = text;
148 return T_WORD;
149 }
150({n}|$)+ {
151 /* this token includes at least one '$' */
152 yylval.string = expand_token(yytext, yyleng);
153 if (strlen(yylval.string))
154 return T_WORD;
155 free(yylval.string);
156 }
157. warn_ignored_character(*yytext);
134 158
135<ASSIGN_VAL>{ 159<ASSIGN_VAL>{
136 [^[:blank:]\n]+.* { 160 [^[:blank:]\n]+.* {
@@ -142,71 +166,17 @@ n [A-Za-z0-9_-]
142 . 166 .
143} 167}
144 168
145<PARAM>{
146 "&&" return T_AND;
147 "||" return T_OR;
148 "(" return T_OPEN_PAREN;
149 ")" return T_CLOSE_PAREN;
150 "!" return T_NOT;
151 "=" return T_EQUAL;
152 "!=" return T_UNEQUAL;
153 "<=" return T_LESS_EQUAL;
154 ">=" return T_GREATER_EQUAL;
155 "<" return T_LESS;
156 ">" return T_GREATER;
157 \"|\' {
158 str = yytext[0];
159 new_string();
160 BEGIN(STRING);
161 }
162 \n BEGIN(INITIAL); return T_EOL;
163 ({n}|[/.])+ {
164 const struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
165 if (id && id->flags & TF_PARAM) {
166 yylval.id = id;
167 return id->token;
168 }
169 alloc_string(yytext, yyleng);
170 yylval.string = text;
171 return T_WORD;
172 }
173 ({n}|[/.$])+ {
174 /* this token includes at least one '$' */
175 yylval.string = expand_token(yytext, yyleng);
176 if (strlen(yylval.string))
177 return T_WORD;
178 free(yylval.string);
179 }
180 #.* /* comment */
181 \\\n ;
182 [[:blank:]]+
183 . warn_ignored_character(*yytext);
184 <<EOF>> {
185 BEGIN(INITIAL);
186 }
187}
188
189<STRING>{ 169<STRING>{
190 "$".* append_expanded_string(yytext); 170 "$".* append_expanded_string(yytext);
191 [^$'"\\\n]+/\n {
192 append_string(yytext, yyleng);
193 yylval.string = text;
194 return T_WORD_QUOTE;
195 }
196 [^$'"\\\n]+ { 171 [^$'"\\\n]+ {
197 append_string(yytext, yyleng); 172 append_string(yytext, yyleng);
198 } 173 }
199 \\.?/\n {
200 append_string(yytext + 1, yyleng - 1);
201 yylval.string = text;
202 return T_WORD_QUOTE;
203 }
204 \\.? { 174 \\.? {
205 append_string(yytext + 1, yyleng - 1); 175 append_string(yytext + 1, yyleng - 1);
206 } 176 }
207 \'|\" { 177 \'|\" {
208 if (str == yytext[0]) { 178 if (str == yytext[0]) {
209 BEGIN(PARAM); 179 BEGIN(INITIAL);
210 yylval.string = text; 180 yylval.string = text;
211 return T_WORD_QUOTE; 181 return T_WORD_QUOTE;
212 } else 182 } else
@@ -216,11 +186,15 @@ n [A-Za-z0-9_-]
216 fprintf(stderr, 186 fprintf(stderr,
217 "%s:%d:warning: multi-line strings not supported\n", 187 "%s:%d:warning: multi-line strings not supported\n",
218 zconf_curname(), zconf_lineno()); 188 zconf_curname(), zconf_lineno());
189 unput('\n');
219 BEGIN(INITIAL); 190 BEGIN(INITIAL);
220 return T_EOL; 191 yylval.string = text;
192 return T_WORD_QUOTE;
221 } 193 }
222 <<EOF>> { 194 <<EOF>> {
223 BEGIN(INITIAL); 195 BEGIN(INITIAL);
196 yylval.string = text;
197 return T_WORD_QUOTE;
224 } 198 }
225} 199}
226 200
@@ -271,6 +245,12 @@ n [A-Za-z0-9_-]
271} 245}
272 246
273<<EOF>> { 247<<EOF>> {
248 BEGIN(INITIAL);
249
250 if (prev_token != T_EOL && prev_token != T_HELPTEXT)
251 fprintf(stderr, "%s:%d:warning: no new line at end of file\n",
252 current_file->name, yylineno);
253
274 if (current_file) { 254 if (current_file) {
275 zconf_endfile(); 255 zconf_endfile();
276 return T_EOL; 256 return T_EOL;
@@ -280,6 +260,41 @@ n [A-Za-z0-9_-]
280} 260}
281 261
282%% 262%%
263
264/* second stage lexer */
265int yylex(void)
266{
267 int token;
268
269repeat:
270 token = yylex1();
271
272 if (prev_token == T_EOL || prev_token == T_HELPTEXT) {
273 if (token == T_EOL) {
274 /* Do not pass unneeded T_EOL to the parser. */
275 goto repeat;
276 } else {
277 /*
278 * For the parser, update file/lineno at the first token
279 * of each statement. Generally, \n is a statement
280 * terminator in Kconfig, but it is not always true
281 * because \n could be escaped by a backslash.
282 */
283 current_pos.file = current_file;
284 current_pos.lineno = yylineno;
285 }
286 }
287
288 if (prev_prev_token == T_EOL && prev_token == T_WORD &&
289 (token == T_EQUAL || token == T_COLON_EQUAL || token == T_PLUS_EQUAL))
290 BEGIN(ASSIGN_VAL);
291
292 prev_prev_token = prev_token;
293 prev_token = token;
294
295 return token;
296}
297
283static char *expand_token(const char *in, size_t n) 298static char *expand_token(const char *in, size_t n)
284{ 299{
285 char *out; 300 char *out;
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index 22fceb264cf5..69409abc7dc2 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -1,8 +1,8 @@
1%{ 1/* SPDX-License-Identifier: GPL-2.0 */
2/* 2/*
3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
4 * Released under the terms of the GNU GPL v2.0.
5 */ 4 */
5%{
6 6
7#include <ctype.h> 7#include <ctype.h>
8#include <stdarg.h> 8#include <stdarg.h>
@@ -20,18 +20,17 @@
20 20
21int cdebug = PRINTD; 21int cdebug = PRINTD;
22 22
23int yylex(void);
24static void yyerror(const char *err); 23static void yyerror(const char *err);
25static void zconfprint(const char *err, ...); 24static void zconfprint(const char *err, ...);
26static void zconf_error(const char *err, ...); 25static void zconf_error(const char *err, ...);
27static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken); 26static bool zconf_endtoken(const char *tokenname,
27 const char *expected_tokenname);
28 28
29struct symbol *symbol_hash[SYMBOL_HASHSIZE]; 29struct symbol *symbol_hash[SYMBOL_HASHSIZE];
30 30
31static struct menu *current_menu, *current_entry; 31static struct menu *current_menu, *current_entry;
32 32
33%} 33%}
34%expect 30
35 34
36%union 35%union
37{ 36{
@@ -40,46 +39,50 @@ static struct menu *current_menu, *current_entry;
40 struct symbol *symbol; 39 struct symbol *symbol;
41 struct expr *expr; 40 struct expr *expr;
42 struct menu *menu; 41 struct menu *menu;
43 const struct kconf_id *id; 42 enum symbol_type type;
44 enum variable_flavor flavor; 43 enum variable_flavor flavor;
45} 44}
46 45
47%token <id>T_MAINMENU
48%token <id>T_MENU
49%token <id>T_ENDMENU
50%token <id>T_SOURCE
51%token <id>T_CHOICE
52%token <id>T_ENDCHOICE
53%token <id>T_COMMENT
54%token <id>T_CONFIG
55%token <id>T_MENUCONFIG
56%token <id>T_HELP
57%token <string> T_HELPTEXT 46%token <string> T_HELPTEXT
58%token <id>T_IF
59%token <id>T_ENDIF
60%token <id>T_DEPENDS
61%token <id>T_OPTIONAL
62%token <id>T_PROMPT
63%token <id>T_TYPE
64%token <id>T_DEFAULT
65%token <id>T_SELECT
66%token <id>T_IMPLY
67%token <id>T_RANGE
68%token <id>T_VISIBLE
69%token <id>T_OPTION
70%token <id>T_ON
71%token <string> T_WORD 47%token <string> T_WORD
72%token <string> T_WORD_QUOTE 48%token <string> T_WORD_QUOTE
73%token T_UNEQUAL 49%token T_ALLNOCONFIG_Y
74%token T_LESS 50%token T_BOOL
75%token T_LESS_EQUAL 51%token T_CHOICE
76%token T_GREATER
77%token T_GREATER_EQUAL
78%token T_CLOSE_PAREN 52%token T_CLOSE_PAREN
53%token T_COLON_EQUAL
54%token T_COMMENT
55%token T_CONFIG
56%token T_DEFAULT
57%token T_DEFCONFIG_LIST
58%token T_DEF_BOOL
59%token T_DEF_TRISTATE
60%token T_DEPENDS
61%token T_ENDCHOICE
62%token T_ENDIF
63%token T_ENDMENU
64%token T_HELP
65%token T_HEX
66%token T_IF
67%token T_IMPLY
68%token T_INT
69%token T_MAINMENU
70%token T_MENU
71%token T_MENUCONFIG
72%token T_MODULES
73%token T_ON
79%token T_OPEN_PAREN 74%token T_OPEN_PAREN
75%token T_OPTION
76%token T_OPTIONAL
77%token T_PLUS_EQUAL
78%token T_PROMPT
79%token T_RANGE
80%token T_SELECT
81%token T_SOURCE
82%token T_STRING
83%token T_TRISTATE
84%token T_VISIBLE
80%token T_EOL 85%token T_EOL
81%token <string> T_VARIABLE
82%token <flavor> T_ASSIGN
83%token <string> T_ASSIGN_VAL 86%token <string> T_ASSIGN_VAL
84 87
85%left T_OR 88%left T_OR
@@ -91,12 +94,13 @@ static struct menu *current_menu, *current_entry;
91%type <string> prompt 94%type <string> prompt
92%type <symbol> nonconst_symbol 95%type <symbol> nonconst_symbol
93%type <symbol> symbol 96%type <symbol> symbol
97%type <type> type logic_type default
94%type <expr> expr 98%type <expr> expr
95%type <expr> if_expr 99%type <expr> if_expr
96%type <id> end 100%type <string> end
97%type <id> option_name
98%type <menu> if_entry menu_entry choice_entry 101%type <menu> if_entry menu_entry choice_entry
99%type <string> symbol_option_arg word_opt assign_val 102%type <string> word_opt assign_val
103%type <flavor> assign_op
100 104
101%destructor { 105%destructor {
102 fprintf(stderr, "%s:%d: missing end statement for this entry\n", 106 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
@@ -105,15 +109,8 @@ static struct menu *current_menu, *current_entry;
105 menu_end_menu(); 109 menu_end_menu();
106} if_entry menu_entry choice_entry 110} if_entry menu_entry choice_entry
107 111
108%{
109/* Include kconf_id.c here so it can see the token constants. */
110#include "kconf_id.c"
111%}
112
113%% 112%%
114input: nl start | start; 113input: mainmenu_stmt stmt_list | stmt_list;
115
116start: mainmenu_stmt stmt_list | stmt_list;
117 114
118/* mainmenu entry */ 115/* mainmenu entry */
119 116
@@ -127,22 +124,12 @@ stmt_list:
127 | stmt_list common_stmt 124 | stmt_list common_stmt
128 | stmt_list choice_stmt 125 | stmt_list choice_stmt
129 | stmt_list menu_stmt 126 | stmt_list menu_stmt
130 | stmt_list end { zconf_error("unexpected end statement"); }
131 | stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); } 127 | stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); }
132 | stmt_list option_name error T_EOL
133{
134 zconf_error("unexpected option \"%s\"", $2->name);
135}
136 | stmt_list error T_EOL { zconf_error("invalid statement"); } 128 | stmt_list error T_EOL { zconf_error("invalid statement"); }
137; 129;
138 130
139option_name:
140 T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_IMPLY | T_OPTIONAL | T_RANGE | T_DEFAULT | T_VISIBLE
141;
142
143common_stmt: 131common_stmt:
144 T_EOL 132 if_stmt
145 | if_stmt
146 | comment_stmt 133 | comment_stmt
147 | config_stmt 134 | config_stmt
148 | menuconfig_stmt 135 | menuconfig_stmt
@@ -150,12 +137,6 @@ common_stmt:
150 | assignment_stmt 137 | assignment_stmt
151; 138;
152 139
153option_error:
154 T_WORD error T_EOL { zconf_error("unknown option \"%s\"", $1); }
155 | error T_EOL { zconf_error("invalid option"); }
156;
157
158
159/* config/menuconfig entry */ 140/* config/menuconfig entry */
160 141
161config_entry_start: T_CONFIG nonconst_symbol T_EOL 142config_entry_start: T_CONFIG nonconst_symbol T_EOL
@@ -189,19 +170,16 @@ menuconfig_stmt: menuconfig_entry_start config_option_list
189config_option_list: 170config_option_list:
190 /* empty */ 171 /* empty */
191 | config_option_list config_option 172 | config_option_list config_option
192 | config_option_list symbol_option
193 | config_option_list depends 173 | config_option_list depends
194 | config_option_list help 174 | config_option_list help
195 | config_option_list option_error
196 | config_option_list T_EOL
197; 175;
198 176
199config_option: T_TYPE prompt_stmt_opt T_EOL 177config_option: type prompt_stmt_opt T_EOL
200{ 178{
201 menu_set_type($1->stype); 179 menu_set_type($1);
202 printd(DEBUG_PARSE, "%s:%d:type(%u)\n", 180 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
203 zconf_curname(), zconf_lineno(), 181 zconf_curname(), zconf_lineno(),
204 $1->stype); 182 $1);
205}; 183};
206 184
207config_option: T_PROMPT prompt if_expr T_EOL 185config_option: T_PROMPT prompt if_expr T_EOL
@@ -210,14 +188,14 @@ config_option: T_PROMPT prompt if_expr T_EOL
210 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); 188 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
211}; 189};
212 190
213config_option: T_DEFAULT expr if_expr T_EOL 191config_option: default expr if_expr T_EOL
214{ 192{
215 menu_add_expr(P_DEFAULT, $2, $3); 193 menu_add_expr(P_DEFAULT, $2, $3);
216 if ($1->stype != S_UNKNOWN) 194 if ($1 != S_UNKNOWN)
217 menu_set_type($1->stype); 195 menu_set_type($1);
218 printd(DEBUG_PARSE, "%s:%d:default(%u)\n", 196 printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
219 zconf_curname(), zconf_lineno(), 197 zconf_curname(), zconf_lineno(),
220 $1->stype); 198 $1);
221}; 199};
222 200
223config_option: T_SELECT nonconst_symbol if_expr T_EOL 201config_option: T_SELECT nonconst_symbol if_expr T_EOL
@@ -238,27 +216,20 @@ config_option: T_RANGE symbol symbol if_expr T_EOL
238 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno()); 216 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
239}; 217};
240 218
241symbol_option: T_OPTION symbol_option_list T_EOL 219config_option: T_OPTION T_MODULES T_EOL
242; 220{
221 menu_add_option_modules();
222};
243 223
244symbol_option_list: 224config_option: T_OPTION T_DEFCONFIG_LIST T_EOL
245 /* empty */
246 | symbol_option_list T_WORD symbol_option_arg
247{ 225{
248 const struct kconf_id *id = kconf_id_lookup($2, strlen($2)); 226 menu_add_option_defconfig_list();
249 if (id && id->flags & TF_OPTION) {
250 menu_add_option(id->token, $3);
251 free($3);
252 }
253 else
254 zconfprint("warning: ignoring unknown option %s", $2);
255 free($2);
256}; 227};
257 228
258symbol_option_arg: 229config_option: T_OPTION T_ALLNOCONFIG_Y T_EOL
259 /* empty */ { $$ = NULL; } 230{
260 | T_EQUAL prompt { $$ = $2; } 231 menu_add_option_allnoconfig_y();
261; 232};
262 233
263/* choice entry */ 234/* choice entry */
264 235
@@ -279,7 +250,7 @@ choice_entry: choice choice_option_list
279 250
280choice_end: end 251choice_end: end
281{ 252{
282 if (zconf_endtoken($1, T_CHOICE, T_ENDCHOICE)) { 253 if (zconf_endtoken($1, "choice")) {
283 menu_end_menu(); 254 menu_end_menu();
284 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno()); 255 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
285 } 256 }
@@ -293,8 +264,6 @@ choice_option_list:
293 | choice_option_list choice_option 264 | choice_option_list choice_option
294 | choice_option_list depends 265 | choice_option_list depends
295 | choice_option_list help 266 | choice_option_list help
296 | choice_option_list T_EOL
297 | choice_option_list option_error
298; 267;
299 268
300choice_option: T_PROMPT prompt if_expr T_EOL 269choice_option: T_PROMPT prompt if_expr T_EOL
@@ -303,15 +272,11 @@ choice_option: T_PROMPT prompt if_expr T_EOL
303 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); 272 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
304}; 273};
305 274
306choice_option: T_TYPE prompt_stmt_opt T_EOL 275choice_option: logic_type prompt_stmt_opt T_EOL
307{ 276{
308 if ($1->stype == S_BOOLEAN || $1->stype == S_TRISTATE) { 277 menu_set_type($1);
309 menu_set_type($1->stype); 278 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
310 printd(DEBUG_PARSE, "%s:%d:type(%u)\n", 279 zconf_curname(), zconf_lineno(), $1);
311 zconf_curname(), zconf_lineno(),
312 $1->stype);
313 } else
314 YYERROR;
315}; 280};
316 281
317choice_option: T_OPTIONAL T_EOL 282choice_option: T_OPTIONAL T_EOL
@@ -322,14 +287,26 @@ choice_option: T_OPTIONAL T_EOL
322 287
323choice_option: T_DEFAULT nonconst_symbol if_expr T_EOL 288choice_option: T_DEFAULT nonconst_symbol if_expr T_EOL
324{ 289{
325 if ($1->stype == S_UNKNOWN) { 290 menu_add_symbol(P_DEFAULT, $2, $3);
326 menu_add_symbol(P_DEFAULT, $2, $3); 291 printd(DEBUG_PARSE, "%s:%d:default\n",
327 printd(DEBUG_PARSE, "%s:%d:default\n", 292 zconf_curname(), zconf_lineno());
328 zconf_curname(), zconf_lineno());
329 } else
330 YYERROR;
331}; 293};
332 294
295type:
296 logic_type
297 | T_INT { $$ = S_INT; }
298 | T_HEX { $$ = S_HEX; }
299 | T_STRING { $$ = S_STRING; }
300
301logic_type:
302 T_BOOL { $$ = S_BOOLEAN; }
303 | T_TRISTATE { $$ = S_TRISTATE; }
304
305default:
306 T_DEFAULT { $$ = S_UNKNOWN; }
307 | T_DEF_BOOL { $$ = S_BOOLEAN; }
308 | T_DEF_TRISTATE { $$ = S_TRISTATE; }
309
333choice_block: 310choice_block:
334 /* empty */ 311 /* empty */
335 | choice_block common_stmt 312 | choice_block common_stmt
@@ -347,20 +324,13 @@ if_entry: T_IF expr T_EOL
347 324
348if_end: end 325if_end: end
349{ 326{
350 if (zconf_endtoken($1, T_IF, T_ENDIF)) { 327 if (zconf_endtoken($1, "if")) {
351 menu_end_menu(); 328 menu_end_menu();
352 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno()); 329 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
353 } 330 }
354}; 331};
355 332
356if_stmt: if_entry if_block if_end 333if_stmt: if_entry stmt_list if_end
357;
358
359if_block:
360 /* empty */
361 | if_block common_stmt
362 | if_block menu_stmt
363 | if_block choice_stmt
364; 334;
365 335
366/* menu entry */ 336/* menu entry */
@@ -372,27 +342,26 @@ menu: T_MENU prompt T_EOL
372 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); 342 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
373}; 343};
374 344
375menu_entry: menu visibility_list depends_list 345menu_entry: menu menu_option_list
376{ 346{
377 $$ = menu_add_menu(); 347 $$ = menu_add_menu();
378}; 348};
379 349
380menu_end: end 350menu_end: end
381{ 351{
382 if (zconf_endtoken($1, T_MENU, T_ENDMENU)) { 352 if (zconf_endtoken($1, "menu")) {
383 menu_end_menu(); 353 menu_end_menu();
384 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno()); 354 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
385 } 355 }
386}; 356};
387 357
388menu_stmt: menu_entry menu_block menu_end 358menu_stmt: menu_entry stmt_list menu_end
389; 359;
390 360
391menu_block: 361menu_option_list:
392 /* empty */ 362 /* empty */
393 | menu_block common_stmt 363 | menu_option_list visible
394 | menu_block menu_stmt 364 | menu_option_list depends
395 | menu_block choice_stmt
396; 365;
397 366
398source_stmt: T_SOURCE prompt T_EOL 367source_stmt: T_SOURCE prompt T_EOL
@@ -411,7 +380,12 @@ comment: T_COMMENT prompt T_EOL
411 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno()); 380 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
412}; 381};
413 382
414comment_stmt: comment depends_list 383comment_stmt: comment comment_option_list
384;
385
386comment_option_list:
387 /* empty */
388 | comment_option_list depends
415; 389;
416 390
417/* help option */ 391/* help option */
@@ -440,13 +414,6 @@ help: help_start T_HELPTEXT
440 414
441/* depends option */ 415/* depends option */
442 416
443depends_list:
444 /* empty */
445 | depends_list depends
446 | depends_list T_EOL
447 | depends_list option_error
448;
449
450depends: T_DEPENDS T_ON expr T_EOL 417depends: T_DEPENDS T_ON expr T_EOL
451{ 418{
452 menu_add_dep($3); 419 menu_add_dep($3);
@@ -454,14 +421,7 @@ depends: T_DEPENDS T_ON expr T_EOL
454}; 421};
455 422
456/* visibility option */ 423/* visibility option */
457 424visible: T_VISIBLE if_expr T_EOL
458visibility_list:
459 /* empty */
460 | visibility_list visible
461 | visibility_list T_EOL
462;
463
464visible: T_VISIBLE if_expr
465{ 425{
466 menu_add_visibility($2); 426 menu_add_visibility($2);
467}; 427};
@@ -479,14 +439,9 @@ prompt: T_WORD
479 | T_WORD_QUOTE 439 | T_WORD_QUOTE
480; 440;
481 441
482end: T_ENDMENU T_EOL { $$ = $1; } 442end: T_ENDMENU T_EOL { $$ = "menu"; }
483 | T_ENDCHOICE T_EOL { $$ = $1; } 443 | T_ENDCHOICE T_EOL { $$ = "choice"; }
484 | T_ENDIF T_EOL { $$ = $1; } 444 | T_ENDIF T_EOL { $$ = "if"; }
485;
486
487nl:
488 T_EOL
489 | nl T_EOL
490; 445;
491 446
492if_expr: /* empty */ { $$ = NULL; } 447if_expr: /* empty */ { $$ = NULL; }
@@ -518,7 +473,13 @@ word_opt: /* empty */ { $$ = NULL; }
518 473
519/* assignment statement */ 474/* assignment statement */
520 475
521assignment_stmt: T_VARIABLE T_ASSIGN assign_val T_EOL { variable_add($1, $3, $2); free($1); free($3); } 476assignment_stmt: T_WORD assign_op assign_val T_EOL { variable_add($1, $3, $2); free($1); free($3); }
477
478assign_op:
479 T_EQUAL { $$ = VAR_RECURSIVE; }
480 | T_COLON_EQUAL { $$ = VAR_SIMPLE; }
481 | T_PLUS_EQUAL { $$ = VAR_APPEND; }
482;
522 483
523assign_val: 484assign_val:
524 /* empty */ { $$ = xstrdup(""); }; 485 /* empty */ { $$ = xstrdup(""); };
@@ -563,35 +524,21 @@ void conf_parse(const char *name)
563 sym_set_change_count(1); 524 sym_set_change_count(1);
564} 525}
565 526
566static const char *zconf_tokenname(int token) 527static bool zconf_endtoken(const char *tokenname,
567{ 528 const char *expected_tokenname)
568 switch (token) {
569 case T_MENU: return "menu";
570 case T_ENDMENU: return "endmenu";
571 case T_CHOICE: return "choice";
572 case T_ENDCHOICE: return "endchoice";
573 case T_IF: return "if";
574 case T_ENDIF: return "endif";
575 case T_DEPENDS: return "depends";
576 case T_VISIBLE: return "visible";
577 }
578 return "<token>";
579}
580
581static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken)
582{ 529{
583 if (id->token != endtoken) { 530 if (strcmp(tokenname, expected_tokenname)) {
584 zconf_error("unexpected '%s' within %s block", 531 zconf_error("unexpected '%s' within %s block",
585 id->name, zconf_tokenname(starttoken)); 532 tokenname, expected_tokenname);
586 yynerrs++; 533 yynerrs++;
587 return false; 534 return false;
588 } 535 }
589 if (current_menu->file != current_file) { 536 if (current_menu->file != current_file) {
590 zconf_error("'%s' in different file than '%s'", 537 zconf_error("'%s' in different file than '%s'",
591 id->name, zconf_tokenname(starttoken)); 538 tokenname, expected_tokenname);
592 fprintf(stderr, "%s:%d: location of the '%s'\n", 539 fprintf(stderr, "%s:%d: location of the '%s'\n",
593 current_menu->file->name, current_menu->lineno, 540 current_menu->file->name, current_menu->lineno,
594 zconf_tokenname(starttoken)); 541 expected_tokenname);
595 yynerrs++; 542 yynerrs++;
596 return false; 543 return false;
597 } 544 }
@@ -781,10 +728,5 @@ void zconfdump(FILE *out)
781 } 728 }
782} 729}
783 730
784#include "zconf.lex.c"
785#include "util.c" 731#include "util.c"
786#include "confdata.c"
787#include "expr.c"
788#include "symbol.c"
789#include "menu.c" 732#include "menu.c"
790#include "preprocess.c"
diff --git a/security/Kconfig b/security/Kconfig
index d9aa521b5206..e4fe2f3c2c65 100644
--- a/security/Kconfig
+++ b/security/Kconfig
@@ -4,7 +4,7 @@
4 4
5menu "Security options" 5menu "Security options"
6 6
7source security/keys/Kconfig 7source "security/keys/Kconfig"
8 8
9config SECURITY_DMESG_RESTRICT 9config SECURITY_DMESG_RESTRICT
10 bool "Restrict unprivileged access to the kernel syslog" 10 bool "Restrict unprivileged access to the kernel syslog"
@@ -230,14 +230,14 @@ config STATIC_USERMODEHELPER_PATH
230 If you wish for all usermode helper programs to be disabled, 230 If you wish for all usermode helper programs to be disabled,
231 specify an empty string here (i.e. ""). 231 specify an empty string here (i.e. "").
232 232
233source security/selinux/Kconfig 233source "security/selinux/Kconfig"
234source security/smack/Kconfig 234source "security/smack/Kconfig"
235source security/tomoyo/Kconfig 235source "security/tomoyo/Kconfig"
236source security/apparmor/Kconfig 236source "security/apparmor/Kconfig"
237source security/loadpin/Kconfig 237source "security/loadpin/Kconfig"
238source security/yama/Kconfig 238source "security/yama/Kconfig"
239 239
240source security/integrity/Kconfig 240source "security/integrity/Kconfig"
241 241
242choice 242choice
243 prompt "Default security module" 243 prompt "Default security module"
diff --git a/security/integrity/Kconfig b/security/integrity/Kconfig
index da9565891738..877af1f2d904 100644
--- a/security/integrity/Kconfig
+++ b/security/integrity/Kconfig
@@ -66,7 +66,7 @@ config INTEGRITY_AUDIT
66 be enabled by specifying 'integrity_audit=1' on the kernel 66 be enabled by specifying 'integrity_audit=1' on the kernel
67 command line. 67 command line.
68 68
69source security/integrity/ima/Kconfig 69source "security/integrity/ima/Kconfig"
70source security/integrity/evm/Kconfig 70source "security/integrity/evm/Kconfig"
71 71
72endif # if INTEGRITY 72endif # if INTEGRITY