x86/cpu: cleanup duplicate dependencies in Kconfig
PATCH 1/1 x86/cpu: cleanup duplicate dependencies in Kconfig
The Kconfig in the choice menu already has an 'if X86' affecting all of the config options within the choice, meaning that each of the individual 'depends on' statements in this file is a duplicate dependency (dead code).
Let's leave the initial 'depends on X86_32' in the choice menu, and remove the individual dependencies from each option.
This dead code was found by kconfirm, a static analysis tool for Kconfig.
--- arch/x86/Kconfig.cpu | 16 ---------------- 1 file changed, 16 deletions(-)
arch/x86/Kconfig.cpu +0 -16
@@ -45,21 +45,18 @@ choice config M586TSC bool "Pentium-Classic" - depends on X86_32 help Select this for a Pentium Classic processor with the RDTSC (Read Time Stamp Counter) instruction for benchmarking. config M586MMX bool "Pentium-MMX" - depends on X86_32 help Select this for a Pentium with the MMX graphics/multimedia extended instructions. config M686 bool "Pentium-Pro" - depends on X86_32 help Select this for Intel Pentium Pro chips. This enables the use of Pentium Pro extended instructions, and disables the init-time guard
@@ -67,7 +64,6 @@ config M686 config MPENTIUMII bool "Pentium-II/Celeron(pre-Coppermine)" - depends on X86_32 help Select this for Intel chips based on the Pentium-II and pre-Coppermine Celeron core. This option enables an unaligned
@@ -77,7 +73,6 @@ config MPENTIUMII config MPENTIUMIII bool "Pentium-III/Celeron(Coppermine)/Pentium-III Xeon" - depends on X86_32 help Select this for Intel chips based on the Pentium-III and Celeron-Coppermine core. This option enables use of some
@@ -86,14 +81,12 @@ config MPENTIUMIII config MPENTIUMM bool "Pentium M/Pentium Dual Core/Core Solo/Core Duo" - depends on X86_32 help Select this for Intel Pentium M (not Pentium-4 M) "Merom" Core Solo/Duo notebook chips config MPENTIUM4 bool "Pentium-4/Celeron(P4-based)/Pentium-4 M/older Xeon" - depends on X86_32 help Select this for Intel Pentium 4 chips. This includes the Pentium 4, Pentium D, P4-based Celeron and Xeon, and
@@ -117,7 +110,6 @@ config MPENTIUM4 config MK6 bool "K6/K6-II/K6-III" - depends on X86_32 help Select this for an AMD K6-family processor. Enables use of some extended instructions, and passes appropriate optimization
@@ -125,7 +117,6 @@ config MK6 config MK7 bool "Athlon/Duron/K7" - depends on X86_32 help Select this for an AMD Athlon K7-family processor. Enables use of some extended instructions, and passes appropriate optimization
@@ -133,7 +124,6 @@ config MK7 config MCRUSOE bool "Crusoe" - depends on X86_32 help Select this for a Transmeta Crusoe processor. Treats the processor like a 586 with TSC, and sets some GCC optimization flags (like a
@@ -141,25 +131,21 @@ config MCRUSOE config MEFFICEON bool "Efficeon" - depends on X86_32 help Select this for a Transmeta Efficeon processor. config MGEODEGX1 bool "GeodeGX1" - depends on X86_32 help Select this for a Geode GX1 (Cyrix MediaGX) chip. config MGEODE_LX bool "Geode GX/LX" - depends on X86_32 help Select this for AMD Geode GX and LX processors. config MCYRIXIII bool "CyrixIII/VIA-C3" - depends on X86_32 help Select this for a Cyrix III or C3 chip. Presently Linux and GCC treat this chip as a generic 586. Whilst the CPU is 686 class,
@@ -171,7 +157,6 @@ config MCYRIXIII config MVIAC3_2 bool "VIA C3-2 (Nehemiah)" - depends on X86_32 help Select this for a VIA C3 "Nehemiah". Selecting this enables usage of SSE and tells gcc to treat the CPU as a 686.
@@ -179,7 +164,6 @@ config MVIAC3_2 config MVIAC7 bool "VIA C7" - depends on X86_32 help Select this for a VIA C7. Selecting this uses the correct cache shift and tells gcc to treat the CPU as a 686.
Signature · 1 line
2.54.0
Quoted 24 lines · Julian Braha
The
Kconfigin the choice menu already has an 'if X86' affecting all of the config options within the choice, meaning that each of the individual 'depends on' statements in this file is a duplicate dependency (dead code).Let's leave the initial 'depends on
X86_32' in the choice menu, and remove the individual dependencies from each option.This dead code was found by kconfirm, a static analysis tool for
Kconfig.Signed-off-by Julian Braha <[email protected]>--- arch/x86/Kconfig.cpu | 16 ---------------- 1 file changed, 16 deletions(-)arch/x86/Kconfig.cpu +0
-1@@ -45,21 +45,18 @@ choice config M586TSC bool "Pentium-Classic" - depends on X86_32
arch/x86/Kconfig.cpu choice · line 56
Quoted 10 lines
arch/x86/Kconfig.cpu +0
-1help Select this for a Pentium Classic processor with the RDTSC (Read Time Stamp Counter) instruction for benchmarking. config M586MMX bool "Pentium-MMX" - depends on X86_32 help Select this for a Pentium with the MMX graphics/multimedia extended instructions.
Dunno, I don't really like this change, because it obfuscates the dependency.
Yes, technically the dependency is already expressed shared, but in practice it's useful to see 'at a glance' whether such a CPU config option is 32-bit only, 64-bit only or generic.
Thanks,
Ingo
Quoted 2 lines · Ingo Molnar
in practice it's useful to see 'at a glance' whether such a CPU config option is 32-bit only, 64-bit only or generic.
Hi Ingo,
What do you think about using comments for this? Having spent quite a bit of time looking at Kconfig, I think that comments are underused.
- Julian Braha