diff mbox

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

Message ID 1406725875-9171-2-git-send-email-Vignesh_Raman@mentor.com (mailing list archive)
State Rejected
Delegated to: Vinod Koul
Headers show

Commit Message

Vignesh Raman July 30, 2014, 1:11 p.m. UTC
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.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
---
 drivers/dma/imx-sdma.c |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

Comments

Vinod Koul July 31, 2014, noon UTC | #1
On Wed, Jul 30, 2014 at 06:41:14PM +0530, Vignesh Raman wrote:
> 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?
Vinod Koul Aug. 4, 2014, 8:38 a.m. UTC | #2
On Mon, Aug 04, 2014 at 02:11:01PM +0530, Vignesh Raman wrote:
> On Thursday 31 July 2014 05:30 PM, Vinod Koul wrote:
> > On Wed, Jul 30, 2014 at 06:41:14PM +0530, Vignesh Raman wrote:
> >> 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
Vignesh Raman Aug. 4, 2014, 8:41 a.m. UTC | #3
On Thursday 31 July 2014 05:30 PM, Vinod Koul wrote:
> On Wed, Jul 30, 2014 at 06:41:14PM +0530, Vignesh Raman wrote:
>> 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.
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vignesh Raman Aug. 5, 2014, 6:27 a.m. UTC | #4
On Monday 04 August 2014 02:08 PM, Vinod Koul wrote:
> On Mon, Aug 04, 2014 at 02:11:01PM +0530, Vignesh Raman wrote:
>> On Thursday 31 July 2014 05:30 PM, Vinod Koul wrote:
>>> On Wed, Jul 30, 2014 at 06:41:14PM +0530, Vignesh Raman wrote:
>>>> 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
> 
I missed some changes in Jiada's patch while merging to mainline kernel.
I will update and send the latest version.

Thanks,
Vignesh.
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 14867e3..1360b9d 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -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 = {