Skip to contentSkip to conversation

dma: imx-sdma: Modify SDMA's remove operation

PATCH Superseded Vignesh Raman 2 participants 11 messages Jul 30, 2014 – Aug 5, 2014

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover dma: imx-sdma: Modify SDMA's remove operation

This is a patch set which contains two patches which modify's sdma_remove operation and add tasklet_kill in sdma_remove function.

Vignesh Raman (2):
dma: imx-sdma: use module_platform_driver for SDMA driver
dma: imx-sdma: Adding tasklet_kill() in sdma_remove function.

 drivers/dma/imx-sdma.c |   23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/2 dma: imx-sdma: use module_platform_driver for SDMA driver

Currently there is no module_exit declared in SDMA driver, so that once sdma module is inserted, it's shown with permanent attribute by lsmod, and it can't be removed.
Use module_platform_driver to register/unregister SDMA driver and modify SDMA's remove operation, to make SDMA driver possible to be removed.

---
 drivers/dma/imx-sdma.c |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/dma/imx-sdma.c +15 -1
index 14867e3..1360b9d 100644
@@ -1633,7 +1633,21 @@ err_irq:
 
 static int sdma_remove(struct platform_device *pdev)
 {
-	return -EBUSY;
+	struct sdma_engine *sdma = platform_get_drvdata(pdev);
+	struct resource *iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	int irq = platform_get_irq(pdev, 0);
+
+	dma_async_device_unregister(&sdma->dma_device);
+	kfree(sdma->script_addrs);
+	free_irq(irq, sdma);
+	iounmap(sdma->regs);
+	release_mem_region(iores->start, resource_size(iores));
+	kfree(sdma);
+
+	platform_set_drvdata(pdev, NULL);
+
+	dev_info(&pdev->dev, "Removed...\n");
+	return 0;
 }
 
 static struct platform_driver sdma_driver = {
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH 1/2] dma: imx-sdma: use module_platform_driver for SDMA driver

Quoted 5 lines · Vignesh Raman

Currently there is no module_exit declared in SDMA driver, so that once sdma module is inserted, it's shown with permanent attribute by lsmod, and it can't be removed.
Use module_platform_driver to register/unregister SDMA driver and modify SDMA's remove operation, to make SDMA driver possible to be removed.

where is this bit below?

Signature · 1 line
~Vinod
Quoted 36 lines
---
 drivers/dma/imx-sdma.c |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/dma/imx-sdma.c +15 -1
index 14867e3..1360b9d 100644
@@ -1633,7 +1633,21 @@ err_irq:
 
 static int sdma_remove(struct platform_device *pdev)
 {
-	return -EBUSY;
+	struct sdma_engine *sdma = platform_get_drvdata(pdev);
+	struct resource *iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	int irq = platform_get_irq(pdev, 0);
+
+	dma_async_device_unregister(&sdma->dma_device);
+	kfree(sdma->script_addrs);
+	free_irq(irq, sdma);
+	iounmap(sdma->regs);
+	release_mem_region(iores->start, resource_size(iores));
+	kfree(sdma);
+
+	platform_set_drvdata(pdev, NULL);
+
+	dev_info(&pdev->dev, "Removed...\n");
+	return 0;
 }
 
 static struct platform_driver sdma_driver = {
Signature · 1 line
1.7.9.5
#3 lore raw

Re: [PATCH 1/2] dma: imx-sdma: use module_platform_driver for SDMA driver

Quoted 8 lines · Vinod Koul
Quoted 5 lines · Vignesh Raman

Currently there is no module_exit declared in SDMA driver, so that once sdma module is inserted, it's shown with permanent attribute by lsmod, and it can't be removed.
Use module_platform_driver to register/unregister SDMA driver and modify SDMA's remove operation, to make SDMA driver possible to be removed.

where is this bit below?

I'm not clear with your question. Are you asking about the unregister SDMA driver function? It is done by dma_async_device_unregister.

Regards,
Vignesh.

#4 lore raw

Re: [PATCH 1/2] dma: imx-sdma: use module_platform_driver for SDMA driver

Quoted 11 lines · Vignesh Raman
Quoted 8 lines · Vinod Koul
Quoted 5 lines · Vignesh Raman

Currently there is no module_exit declared in SDMA driver, so that once sdma module is inserted, it's shown with permanent attribute by lsmod, and it can't be removed.
Use module_platform_driver to register/unregister SDMA driver and modify SDMA's remove operation, to make SDMA driver possible to be removed.

where is this bit below?

I'm not clear with your question. Are you asking about the unregister SDMA driver function? It is done by dma_async_device_unregister.

Driver already uses module_platform_driver, so I dont see what information the last two lines are trying to convey.

Patch needs to talk about what is done in current patch

Signature · 1 line
~Vinod
#5 lore raw

Re: [PATCH 1/2] dma: imx-sdma: use module_platform_driver for SDMA driver

Quoted 8 lines · Vinod Koul
Quoted 7 lines · Vignesh Raman
Quoted 6 lines · Vinod Koul
Quoted 5 lines · Vignesh Raman

Currently there is no module_exit declared in SDMA driver, so that once sdma module is inserted, it's shown with permanent attribute by lsmod, and it can't be removed.
Use module_platform_driver to register/unregister SDMA driver and modify SDMA's remove operation, to make SDMA driver possible to be removed.

Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

where is this bit below?

I'm not clear with your question. Are you asking about the unregister SDMA driver function? It is done by dma_async_device_unregister.

Driver already uses module_platform_driver, so I dont see what information the last two lines are trying to convey.

Patch needs to talk about what is done in current patch

I missed some changes in Jiada's patch while merging to mainline kernel. I will update and send the latest version.

Thanks,
Vignesh.

#6 lore raw

PATCH 2/2 dma: imx-sdma: Adding tasklet_kill() in sdma_remove function.

In reply to Vignesh Raman

Several dma drivers calls tasklet_kill() in remove function. This is missing in imx driver, so adding tasklet_kill() in sdma_remove function.

---
 drivers/dma/imx-sdma.c |    7 +++++++
 1 file changed, 7 insertions(+)
drivers/dma/imx-sdma.c +7 -0
index 1360b9d..974337f 100644
@@ -1636,12 +1636,19 @@ static int sdma_remove(struct platform_device *pdev)
 	struct sdma_engine *sdma = platform_get_drvdata(pdev);
 	struct resource *iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	int irq = platform_get_irq(pdev, 0);
+	int i;
 
 	dma_async_device_unregister(&sdma->dma_device);
 	kfree(sdma->script_addrs);
 	free_irq(irq, sdma);
 	iounmap(sdma->regs);
 	release_mem_region(iores->start, resource_size(iores));
+	/* Kill the tasklet */
+	for (i = 0; i < MAX_DMA_CHANNELS; i++) {
+		struct sdma_channel *sdmac = &sdma->channel[i];
+
+		tasklet_kill(&sdmac->tasklet);
+	}
 	kfree(sdma);
 
 	platform_set_drvdata(pdev, NULL);
Signature · 1 line
1.7.9.5
#7 lore raw

Re: [PATCH 2/2] dma: imx-sdma: Adding tasklet_kill() in sdma_remove function.

Quoted 2 lines · Vignesh Raman

Several dma drivers calls tasklet_kill() in remove function. This is missing in imx driver, so adding tasklet_kill() in sdma_remove function.

And why should we do that ?

Signature · 1 line
~Vinod
Quoted 33 lines
---
 drivers/dma/imx-sdma.c |    7 +++++++
 1 file changed, 7 insertions(+)
drivers/dma/imx-sdma.c +7 -0
index 1360b9d..974337f 100644
@@ -1636,12 +1636,19 @@ static int sdma_remove(struct platform_device *pdev)
 	struct sdma_engine *sdma = platform_get_drvdata(pdev);
 	struct resource *iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	int irq = platform_get_irq(pdev, 0);
+	int i;
 
 	dma_async_device_unregister(&sdma->dma_device);
 	kfree(sdma->script_addrs);
 	free_irq(irq, sdma);
 	iounmap(sdma->regs);
 	release_mem_region(iores->start, resource_size(iores));
+	/* Kill the tasklet */
+	for (i = 0; i < MAX_DMA_CHANNELS; i++) {
+		struct sdma_channel *sdmac = &sdma->channel[i];
+
+		tasklet_kill(&sdmac->tasklet);
+	}
 	kfree(sdma);
 
 	platform_set_drvdata(pdev, NULL);
Signature · 1 line
1.7.9.5
#8 lore raw

Re: [PATCH 2/2] dma: imx-sdma: Adding tasklet_kill() in sdma_remove function.

Quoted 5 lines · Vinod Koul
Quoted 2 lines · Vignesh Raman

Several dma drivers calls tasklet_kill() in remove function. This is missing in imx driver, so adding tasklet_kill() in sdma_remove function.

And why should we do that ?

This is done because all running tasklets should be killed on remove.

Regards,
Vignesh.

#9 lore raw

Re: [PATCH 2/2] dma: imx-sdma: Adding tasklet_kill() in sdma_remove function.

Quoted 7 lines · Vignesh Raman
Quoted 5 lines · Vinod Koul
Quoted 2 lines · Vignesh Raman

Several dma drivers calls tasklet_kill() in remove function. This is missing in imx driver, so adding tasklet_kill() in sdma_remove function.

And why should we do that ?

This is done because all running tasklets should be killed on remove.

And what prevents is from mentioning this in changelog!

Signature · 1 line
~Vinod
#10 lore raw

Re: [PATCH 2/2] dma: imx-sdma: Adding tasklet_kill() in sdma_remove function.

Quoted 11 lines · Vinod Koul
Quoted 7 lines · Vignesh Raman
Quoted 5 lines · Vinod Koul
Quoted 2 lines · Vignesh Raman

Several dma drivers calls tasklet_kill() in remove function. This is missing in imx driver, so adding tasklet_kill() in sdma_remove function.

And why should we do that ?

This is done because all running tasklets should be killed on remove.

And what prevents is from mentioning this in changelog!

I should have mentioned in the Changelog but missed it, sorry about that. I will add it and send updated version.

Regards,
Vignesh.