diff mbox series

PCI: imx6: Add deinit for imx pci

Message ID 20230705010624.3912934-1-xiaolei.wang@windriver.com (mailing list archive)
State New, archived
Headers show
Series PCI: imx6: Add deinit for imx pci | expand

Commit Message

Xiaolei Wang July 5, 2023, 1:06 a.m. UTC
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@windriver.com>
---
 drivers/pci/controller/dwc/pci-imx6.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Richard Zhu July 5, 2023, 2:33 a.m. UTC | #1
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/20230704122635.1362156-1-festevam@gmail.com/

Best Regards
Richard Zhu

> -----Original Message-----
> From: Xiaolei Wang <xiaolei.wang@windriver.com>
> Sent: 2023年7月5日 9:06
> To: Hongxing Zhu <hongxing.zhu@nxp.com>; l.stach@pengutronix.de;
> kw@linux.com; bhelgaas@google.com; shawnguo@kernel.org;
> s.hauer@pengutronix.de; kernel@pengutronix.de; festevam@gmail.com;
> dl-linux-imx <linux-imx@nxp.com>
> Cc: linux-pci@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> linux-kernel@vger.kernel.org
> 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 <xiaolei.wang@windriver.com>
> ---
>  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
diff mbox series

Patch

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 = {