[PATCH] pci: dead code cleanup in Kconfig

Julian Braha posted 1 patch 1 day, 10 hours ago
drivers/pci/Kconfig | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
[PATCH] pci: dead code cleanup in Kconfig
Posted by Julian Braha 1 day, 10 hours ago
There is already an 'if PCI' condition wrapping several config options
e.g. PCI_DOMAINS and VGA_ARB, making the 'depends on PCI' statement for
each of these a duplicate dependency (dead code).

I propose leaving the outer 'if PCI...endif' and removing the individual
'depends on PCI' statement from each option.

This dead code was found by kconfirm, a static analysis tool for Kconfig.

Signed-off-by: Julian Braha <julianbraha@gmail.com>
---
 drivers/pci/Kconfig | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
index e3f848ffb52a..33c88432b728 100644
--- a/drivers/pci/Kconfig
+++ b/drivers/pci/Kconfig
@@ -31,7 +31,6 @@ if PCI
 
 config PCI_DOMAINS
 	bool
-	depends on PCI
 
 config PCI_DOMAINS_GENERIC
 	bool
@@ -255,7 +254,7 @@ config PCI_DYNAMIC_OF_NODES
 choice
 	prompt "PCI Express hierarchy optimization setting"
 	default PCIE_BUS_DEFAULT
-	depends on PCI && EXPERT
+	depends on EXPERT
 	help
 	  MPS (Max Payload Size) and MRRS (Max Read Request Size) are PCIe
 	  device parameters that affect performance and the ability to
@@ -272,20 +271,17 @@ choice
 
 config PCIE_BUS_TUNE_OFF
 	bool "Tune Off"
-	depends on PCI
 	help
 	  Use the BIOS defaults; don't touch MPS at all.  This is the same
 	  as booting with 'pci=pcie_bus_tune_off'.
 
 config PCIE_BUS_DEFAULT
 	bool "Default"
-	depends on PCI
 	help
 	  Default choice; ensure that the MPS matches upstream bridge.
 
 config PCIE_BUS_SAFE
 	bool "Safe"
-	depends on PCI
 	help
 	  Use largest MPS that boot-time devices support.  If you have a
 	  closed system with no possibility of adding new devices, this
@@ -294,7 +290,6 @@ config PCIE_BUS_SAFE
 
 config PCIE_BUS_PERFORMANCE
 	bool "Performance"
-	depends on PCI
 	help
 	  Use MPS and MRRS for best performance.  Ensure that a given
 	  device's MPS is no larger than its parent MPS, which allows us to
@@ -303,7 +298,6 @@ config PCIE_BUS_PERFORMANCE
 
 config PCIE_BUS_PEER2PEER
 	bool "Peer2peer"
-	depends on PCI
 	help
 	  Set MPS = 128 for all devices.  MPS configuration effected by the
 	  other options could cause the MPS on one root port to be
@@ -317,7 +311,7 @@ endchoice
 config VGA_ARB
 	bool "VGA Arbitration" if EXPERT
 	default y
-	depends on (PCI && !S390)
+	depends on !S390
 	select SCREEN_INFO if X86
 	help
 	  Some "legacy" VGA devices implemented on PCI typically have the same
@@ -340,4 +334,4 @@ source "drivers/pci/endpoint/Kconfig"
 source "drivers/pci/switch/Kconfig"
 source "drivers/pci/pwrctrl/Kconfig"
 
-endif
+endif # PCI
-- 
2.51.2
Re: [PATCH] pci: dead code cleanup in Kconfig
Posted by Bjorn Helgaas 12 hours ago
On Mon, Mar 30, 2026 at 10:45:49PM +0100, Julian Braha wrote:
> There is already an 'if PCI' condition wrapping several config options
> e.g. PCI_DOMAINS and VGA_ARB, making the 'depends on PCI' statement for
> each of these a duplicate dependency (dead code).
> 
> I propose leaving the outer 'if PCI...endif' and removing the individual
> 'depends on PCI' statement from each option.
> 
> This dead code was found by kconfirm, a static analysis tool for Kconfig.
> 
> Signed-off-by: Julian Braha <julianbraha@gmail.com>
> ---
>  drivers/pci/Kconfig | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)

I think there might be more redundant dependencies, e.g.,

  - HOTPLUG_PCI in drivers/pci/hotplug/Kconfig depends on PCI but this
    file is only included 'if PCI'

  - there are several "depends on PCI" things in
      drivers/pci/controller/Kconfig
      drivers/pci/controller/cadence/Kconfig
      drivers/pci/controller/dwc/Kconfig
      drivers/pci/controller/plda/Kconfig
      drivers/pci/switch/Kconfig
    I think all these are only included 'if PCI'
Re: [PATCH] pci: dead code cleanup in Kconfig
Posted by Bjorn Helgaas 1 day, 9 hours ago
On Mon, Mar 30, 2026 at 10:45:49PM +0100, Julian Braha wrote:
> There is already an 'if PCI' condition wrapping several config options
> e.g. PCI_DOMAINS and VGA_ARB, making the 'depends on PCI' statement for
> each of these a duplicate dependency (dead code).
> 
> I propose leaving the outer 'if PCI...endif' and removing the individual
> 'depends on PCI' statement from each option.
> 
> This dead code was found by kconfirm, a static analysis tool for Kconfig.
> 
> Signed-off-by: Julian Braha <julianbraha@gmail.com>

Applied to pci/misc for v7.1, thanks!

> ---
>  drivers/pci/Kconfig | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
> index e3f848ffb52a..33c88432b728 100644
> --- a/drivers/pci/Kconfig
> +++ b/drivers/pci/Kconfig
> @@ -31,7 +31,6 @@ if PCI
>  
>  config PCI_DOMAINS
>  	bool
> -	depends on PCI
>  
>  config PCI_DOMAINS_GENERIC
>  	bool
> @@ -255,7 +254,7 @@ config PCI_DYNAMIC_OF_NODES
>  choice
>  	prompt "PCI Express hierarchy optimization setting"
>  	default PCIE_BUS_DEFAULT
> -	depends on PCI && EXPERT
> +	depends on EXPERT
>  	help
>  	  MPS (Max Payload Size) and MRRS (Max Read Request Size) are PCIe
>  	  device parameters that affect performance and the ability to
> @@ -272,20 +271,17 @@ choice
>  
>  config PCIE_BUS_TUNE_OFF
>  	bool "Tune Off"
> -	depends on PCI
>  	help
>  	  Use the BIOS defaults; don't touch MPS at all.  This is the same
>  	  as booting with 'pci=pcie_bus_tune_off'.
>  
>  config PCIE_BUS_DEFAULT
>  	bool "Default"
> -	depends on PCI
>  	help
>  	  Default choice; ensure that the MPS matches upstream bridge.
>  
>  config PCIE_BUS_SAFE
>  	bool "Safe"
> -	depends on PCI
>  	help
>  	  Use largest MPS that boot-time devices support.  If you have a
>  	  closed system with no possibility of adding new devices, this
> @@ -294,7 +290,6 @@ config PCIE_BUS_SAFE
>  
>  config PCIE_BUS_PERFORMANCE
>  	bool "Performance"
> -	depends on PCI
>  	help
>  	  Use MPS and MRRS for best performance.  Ensure that a given
>  	  device's MPS is no larger than its parent MPS, which allows us to
> @@ -303,7 +298,6 @@ config PCIE_BUS_PERFORMANCE
>  
>  config PCIE_BUS_PEER2PEER
>  	bool "Peer2peer"
> -	depends on PCI
>  	help
>  	  Set MPS = 128 for all devices.  MPS configuration effected by the
>  	  other options could cause the MPS on one root port to be
> @@ -317,7 +311,7 @@ endchoice
>  config VGA_ARB
>  	bool "VGA Arbitration" if EXPERT
>  	default y
> -	depends on (PCI && !S390)
> +	depends on !S390
>  	select SCREEN_INFO if X86
>  	help
>  	  Some "legacy" VGA devices implemented on PCI typically have the same
> @@ -340,4 +334,4 @@ source "drivers/pci/endpoint/Kconfig"
>  source "drivers/pci/switch/Kconfig"
>  source "drivers/pci/pwrctrl/Kconfig"
>  
> -endif
> +endif # PCI
> -- 
> 2.51.2
>