[PATCH 2/6] dmaengine: mxs: add the remove function

From: Han Xu
Date: Tue Jan 14 2020 - 16:48:40 EST


add the remove function for mxs-dma

Signed-off-by: Han Xu <han.xu@xxxxxxx>
---
drivers/dma/mxs-dma.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
index 9deaaf4fc58f..b458f06f9067 100644
--- a/drivers/dma/mxs-dma.c
+++ b/drivers/dma/mxs-dma.c
@@ -863,6 +863,22 @@ static int mxs_dma_probe(struct platform_device *pdev)
return 0;
}

+static int mxs_dma_remove(struct platform_device *pdev)
+{
+ struct mxs_dma_engine *mxs_dma = platform_get_drvdata(pdev);
+ int i;
+
+ dma_async_device_unregister(&mxs_dma->dma_device);
+
+ for (i = 0; i < MXS_DMA_CHANNELS; i++) {
+ struct mxs_dma_chan *mxs_chan = &mxs_dma->mxs_chans[i];
+
+ tasklet_kill(&mxs_chan->tasklet);
+ }
+
+ return 0;
+}
+
static struct platform_driver mxs_dma_driver = {
.driver = {
.name = "mxs-dma",
@@ -870,6 +886,7 @@ static struct platform_driver mxs_dma_driver = {
},
.id_table = mxs_dma_ids,
.probe = mxs_dma_probe,
+ .remove = mxs_dma_remove,
};

module_platform_driver(mxs_dma_driver);
--
2.17.1