[PATCH] PCI: imx6: Add deinit for imx pci

From: Xiaolei Wang
Date: Tue Jul 04 2023 - 21:07:28 EST


Commit da56a1bfbab5("PCI: dwc: Wait for link up only if
link is started") adds the judgment on the return value
of dw_pcie_wait_for_link(). When no pci device is connected
and pci does not appear link up, the link will be stopped at
this time. Run host_deinit, so add host_deinit callback function.

WARNING: CPU: 2 PID: 70 at drivers/regulator/core.c:2398 _regulator_put.part.0+0x17c/0x194
Modules linked in:
CPU: 2 PID: 70 Comm: kworker/u8:4 Not tainted 6.4.0-rc1-00001-gda56a1bfbab5-dirty #22
Hardware name: NXP i.MX8MQ EVK (DT)
Call trace:
_regulator_put.part.0+0x17c/0x194
regulator_put+0x3c/0x54
devm_regulator_release+0x14/0x20
release_nodes+0x8c/0x13c
devres_release_all+0x8c/0x108
device_unbind_cleanup+0x18/0x68
really_probe+0xe4/0x27c
__driver_probe_device+0x78/0x12c
driver_probe_device+0x3c/0x118
__device_attach_driver+0xb8/0xf8
bus_for_each_drv+0x84/0xe4
__device_attach_async_helper+0xc0/0xe4
async_run_entry_fn+0x34/0xe0
process_one_work+0x290/0x5c4
worker_thread+0x4c/0x408
kthread+0x128/0x134
ret_from_fork+0x10/0x20

Signed-off-by: Xiaolei Wang <xiaolei.wang@xxxxxxxxxxxxx>
---
drivers/pci/controller/dwc/pci-imx6.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 52906f999f2b..e4942bd2598d 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -1039,6 +1039,7 @@ static void imx6_pcie_host_exit(struct dw_pcie_rp *pp)

static const struct dw_pcie_host_ops imx6_pcie_host_ops = {
.host_init = imx6_pcie_host_init,
+ .host_deinit = imx6_pcie_host_exit,
};

static const struct dw_pcie_ops dw_pcie_ops = {
--
2.25.1