Skip to contentSkip to conversation

PCI: dwc: Drop or replace unused linux/gpio.h

PATCH Applied Andy Shevchenko 3 participants 8 messages May 6

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover PCI: dwc: Drop or replace unused linux/gpio.h

The <linux/gpio.h> is a legacy header that is going to die. Make sure that PCI DesignWare drivers do not include it.

Compile tested on x86_64.

Andy Shevchenko (4):
PCI: amd-mdb: Use the right GPIO header
PCI: designware-plat: Drop unused include
PCI: fu740: Drop unused include
PCI: visconti: Drop unused include

 drivers/pci/controller/dwc/pcie-amd-mdb.c         | 2 +-
 drivers/pci/controller/dwc/pcie-designware-plat.c | 1 -
 drivers/pci/controller/dwc/pcie-fu740.c           | 1 -
 drivers/pci/controller/dwc/pcie-visconti.c        | 1 -
 4 files changed, 1 insertion(+), 4 deletions(-)
Signature · 1 line
2.50.1
#1 lore raw

PATCH 1/4 PCI: amd-mdb: Use the right GPIO header

The driver includes the legacy GPIO header <linux/gpio.h> but does not use any symbols from it and actually wants <linux/gpio/consumer.h>, so fix this up.

---
 drivers/pci/controller/dwc/pcie-amd-mdb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/dwc/pcie-amd-mdb.c +1 -1
index 7e50e11fbffd..88208e967201 100644
@@ -7,7 +7,7 @@
 
 #include <linux/clk.h>
 #include <linux/delay.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/interrupt.h>
 #include <linux/irqdomain.h>
 #include <linux/kernel.h>
Signature · 1 line
2.50.1
#2 lore raw

PATCH 2/4 PCI: designware-plat: Drop unused include

In reply to Andy Shevchenko

This file does not use the symbols from the legacy <linux/gpio.h> header, so let's drop it.

---
 drivers/pci/controller/dwc/pcie-designware-plat.c | 1 -
 1 file changed, 1 deletion(-)
drivers/pci/controller/dwc/pcie-designware-plat.c +0 -1
index d103ab759c4e..7d896752d43c 100644
@@ -8,7 +8,6 @@
  */
 #include <linux/clk.h>
 #include <linux/delay.h>
-#include <linux/gpio.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
Signature · 1 line
2.50.1
#3 lore raw

Re: [PATCH v1 2/4] PCI: designware-plat: Drop unused include

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] In `dw_plat_pcie_probe()`, `pci_epc_init_notify()` is incorrectly called on the error path if…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] In dw_plat_pcie_probe(), pci_epc_init_notify() is incorrectly called on the error path if dw_pcie_ep_init_registers() fails, falsely notifying EPF drivers that the EPC is ready. --

commit e1010c1890e8eeb7c02639fb9293500993fe3d21
Author: Andy Shevchenko <[email protected]>

PCI: designware-plat: Drop unused include

This commit removes the unused <linux/gpio.h> header from the pcie-designware-plat.c file since its symbols are not used.

drivers/pci/controller/dwc/pcie-designware-plat.c

Quoted 4 lines
drivers/pci/controller/dwc/pcie-designware-plat.c +0 -0
index d103ab759c4ee..7d896752d43cd 100644

[ ... ]

While reviewing this file, I noticed a pre-existing regression in the error handling path of dw_plat_pcie_probe():

drivers/pci/controller/dwc/pcie-designware-plat.c:dw_plat_pcie_probe() {
        ...
        ret = dw_pcie_ep_init_registers(&pci->ep);
        if (ret) {
                dev_err(dev, "Failed to initialize DWC endpoint registers\n");
                dw_pcie_ep_deinit(&pci->ep);
        }

        pci_epc_init_notify(pci->ep.epc);
        ...
}

If dw_pcie_ep_init_registers() fails, execution falls through and unconditionally calls pci_epc_init_notify(pci->ep.epc) rather than returning an error.

Will this falsely notify all registered endpoint functions that the endpoint controller was successfully initialized?

Endpoint function drivers react to the epc_init event by attempting to allocate memory, set BARs, and configure hardware registers. Because the memory windows are destroyed by dw_pcie_ep_deinit() when it sets num_windows to 0, could these operations lead to failed memory allocations or synchronous external aborts when writing to inaccessible registers?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#4 lore raw

Re: [PATCH v1 2/4] PCI: designware-plat: Drop unused include

Quoted 3 lines · On Wed, May 06, 2026 at 10:16:51AM +0000, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] In dw_plat_pcie_probe(), pci_epc_init_notify() is incorrectly called on the error path if dw_pcie_ep_init_registers() fails, falsely notifying EPF drivers that the EPC is ready. --

Nice, but completely unrelated to the scope of this mini-series. Whoever knows better the code and wants to address that, please do.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#5 lore raw

PATCH 3/4 PCI: fu740: Drop unused include

In reply to Andy Shevchenko

This file does not use the symbols from the legacy <linux/gpio.h> header, so let's drop it.

---
 drivers/pci/controller/dwc/pcie-fu740.c | 1 -
 1 file changed, 1 deletion(-)
drivers/pci/controller/dwc/pcie-fu740.c +0 -1
index 66367252032b..d0a34f680397 100644
@@ -13,7 +13,6 @@
 
 #include <linux/clk.h>
 #include <linux/delay.h>
-#include <linux/gpio.h>
 #include <linux/gpio/consumer.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
Signature · 1 line
2.50.1
#6 lore raw

PATCH 4/4 PCI: visconti: Drop unused include

In reply to Andy Shevchenko

This file does not use the symbols from the legacy <linux/gpio.h> header, so let's drop it.

---
 drivers/pci/controller/dwc/pcie-visconti.c | 1 -
 1 file changed, 1 deletion(-)
drivers/pci/controller/dwc/pcie-visconti.c +0 -1
index cdeac6177143..f21775c3b3a1 100644
@@ -10,7 +10,6 @@
 
 #include <linux/clk.h>
 #include <linux/delay.h>
-#include <linux/gpio.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
 #include <linux/iopoll.h>
Signature · 1 line
2.50.1
#7 lore raw
In reply to Andy Shevchenko
Quoted 5 lines · Andy Shevchenko

The <linux/gpio.h> is a legacy header that is going to die. Make sure that PCI DesignWare drivers do not include it.

Compile tested on x86_64.

Quoted 7 lines

Andy Shevchenko (4):
PCI: amd-mdb: Use the right GPIO header
PCI: designware-plat: Drop unused include
PCI: fu740: Drop unused include
PCI: visconti: Drop unused include

[...]

Applied, thanks!

[1/4] PCI: amd-mdb: Use the right GPIO header

      commit: 8d846a0a6f95cd717df892b077a1c990a86b29fa
[2/4] PCI: designware-plat: Drop unused include
      commit: 800c861cfcbedd033bdffa65c00188fefdcf0767
[3/4] PCI: fu740: Drop unused include
      commit: 71d007f6fb17f519c2fe51d35e0bee5f602169e6
[4/4] PCI: visconti: Drop unused include
      commit: 7cc21269ef74269e423d64defc940808ccbf9774

Best regards,

Signature · 1 line
Manivannan Sadhasivam <[email protected]>