diff mbox series

[1/2] dmaengine: fsl-edma: cleanup chan after dma_async_device_unregister

Message ID 20241101101410.1449891-1-peng.fan@oss.nxp.com (mailing list archive)
State Superseded
Headers show
Series [1/2] dmaengine: fsl-edma: cleanup chan after dma_async_device_unregister | expand

Commit Message

Peng Fan Nov. 1, 2024, 10:14 a.m. UTC
From: Peng Fan <peng.fan@nxp.com>

There is kernel dump when do module test:
sysfs: cannot create duplicate filename '/devices/platform/soc@0/44000000.bus/44000000.dma-controller/dma/dma0chan0'
 __dma_async_device_channel_register+0x128/0x19c
 dma_async_device_register+0x150/0x454
 fsl_edma_probe+0x6cc/0x8a0
 platform_probe+0x68/0xc8

Clean up chan after dma_async_device_unregister to address this.

Fixes: 6f93b93b2a1b ("dmaengine: fsl-edma: kill the tasklets upon exit")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/dma/fsl-edma-main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Frank Li Nov. 1, 2024, 6:27 p.m. UTC | #1
On Fri, Nov 01, 2024 at 06:14:09PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> There is kernel dump when do module test:
> sysfs: cannot create duplicate filename '/devices/platform/soc@0/44000000.bus/44000000.dma-controller/dma/dma0chan0'
>  __dma_async_device_channel_register+0x128/0x19c
>  dma_async_device_register+0x150/0x454
>  fsl_edma_probe+0x6cc/0x8a0
>  platform_probe+0x68/0xc8
>
> Clean up chan after dma_async_device_unregister to address this.

Can you explan why move it after dma_async_device_unregiste() can fix this
problem?

Frank
>
> Fixes: 6f93b93b2a1b ("dmaengine: fsl-edma: kill the tasklets upon exit")
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  drivers/dma/fsl-edma-main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
> index f9f1eda79254..01bd5cb24a49 100644
> --- a/drivers/dma/fsl-edma-main.c
> +++ b/drivers/dma/fsl-edma-main.c
> @@ -668,9 +668,9 @@ static void fsl_edma_remove(struct platform_device *pdev)
>  	struct fsl_edma_engine *fsl_edma = platform_get_drvdata(pdev);
>
>  	fsl_edma_irq_exit(pdev, fsl_edma);
> -	fsl_edma_cleanup_vchan(&fsl_edma->dma_dev);
>  	of_dma_controller_free(np);
>  	dma_async_device_unregister(&fsl_edma->dma_dev);
> +	fsl_edma_cleanup_vchan(&fsl_edma->dma_dev);
>  	fsl_disable_clocks(fsl_edma, fsl_edma->drvdata->dmamuxs);
>  }
>
> --
> 2.37.1
>
Peng Fan Nov. 4, 2024, 5:35 a.m. UTC | #2
> Subject: Re: [PATCH 1/2] dmaengine: fsl-edma: cleanup chan after
> dma_async_device_unregister
> 
> On Fri, Nov 01, 2024 at 06:14:09PM +0800, Peng Fan (OSS) wrote:
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > There is kernel dump when do module test:
> > sysfs: cannot create duplicate filename
> '/devices/platform/soc@0/44000000.bus/44000000.dma-
> controller/dma/dma0chan0'
> >  __dma_async_device_channel_register+0x128/0x19c
> >  dma_async_device_register+0x150/0x454
> >  fsl_edma_probe+0x6cc/0x8a0
> >  platform_probe+0x68/0xc8
> >
> > Clean up chan after dma_async_device_unregister to address this.
> 
> Can you explan why move it after dma_async_device_unregiste() can
> fix this problem?

fsl_edma_cleanup_vchan will unlink vchan.chan.device_node,
while dma_async_device_unregister  needs the link to do
__dma_async_device_channel_unregister. So need move
fsl_edma_cleanup_vchan after dma_async_device_unregister
to make sure channel could be freed.

I will include this in V2 commit log.

Thanks,
Peng.

> 
> Frank
> >
> > Fixes: 6f93b93b2a1b ("dmaengine: fsl-edma: kill the tasklets upon
> > exit")
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> >  drivers/dma/fsl-edma-main.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-
> main.c
> > index f9f1eda79254..01bd5cb24a49 100644
> > --- a/drivers/dma/fsl-edma-main.c
> > +++ b/drivers/dma/fsl-edma-main.c
> > @@ -668,9 +668,9 @@ static void fsl_edma_remove(struct
> platform_device *pdev)
> >  	struct fsl_edma_engine *fsl_edma =
> platform_get_drvdata(pdev);
> >
> >  	fsl_edma_irq_exit(pdev, fsl_edma);
> > -	fsl_edma_cleanup_vchan(&fsl_edma->dma_dev);
> >  	of_dma_controller_free(np);
> >  	dma_async_device_unregister(&fsl_edma->dma_dev);
> > +	fsl_edma_cleanup_vchan(&fsl_edma->dma_dev);
> >  	fsl_disable_clocks(fsl_edma, fsl_edma->drvdata->dmamuxs);  }
> >
> > --
> > 2.37.1
> >
diff mbox series

Patch

diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
index f9f1eda79254..01bd5cb24a49 100644
--- a/drivers/dma/fsl-edma-main.c
+++ b/drivers/dma/fsl-edma-main.c
@@ -668,9 +668,9 @@  static void fsl_edma_remove(struct platform_device *pdev)
 	struct fsl_edma_engine *fsl_edma = platform_get_drvdata(pdev);
 
 	fsl_edma_irq_exit(pdev, fsl_edma);
-	fsl_edma_cleanup_vchan(&fsl_edma->dma_dev);
 	of_dma_controller_free(np);
 	dma_async_device_unregister(&fsl_edma->dma_dev);
+	fsl_edma_cleanup_vchan(&fsl_edma->dma_dev);
 	fsl_disable_clocks(fsl_edma, fsl_edma->drvdata->dmamuxs);
 }