2023-07-05 01:42:11

by Xiaolei Wang

[permalink] [raw]
Subject: [PATCH] PCI: imx6: Add deinit for imx pci

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 <[email protected]>
---
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



2023-07-05 02:59:04

by Richard Zhu

[permalink] [raw]
Subject: RE: [PATCH] PCI: imx6: Add deinit for imx pci

Hi Xiaolei:
Thanks for your patch.
The similar issue had been fixed by another mail-loop.
Issued by Mark and Fabio.
https://lkml.org/lkml/2023/7/3/816
https://patchwork.kernel.org/project/linux-pci/patch/[email protected]/

Best Regards
Richard Zhu

> -----Original Message-----
> From: Xiaolei Wang <[email protected]>
> Sent: 2023??7??5?? 9:06
> To: Hongxing Zhu <[email protected]>; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> dl-linux-imx <[email protected]>
> Cc: [email protected]; [email protected];
> [email protected]
> Subject: [PATCH] PCI: imx6: Add deinit for imx pci
>
> 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 <[email protected]>
> ---
> 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