[PATCH 04/46] dmaengine: xgene-dma: use dmaenginem_async_device_register to simplify the code

From: Huang Shijie
Date: Fri Aug 03 2018 - 03:25:37 EST


Use dmaenginem_async_device_register to simplify the code:
remove xgene_dma_async_register
remove dma_async_device_unregister

Signed-off-by: Huang Shijie <sjhuang@xxxxxxxxxxx>
---
drivers/dma/xgene-dma.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/drivers/dma/xgene-dma.c b/drivers/dma/xgene-dma.c
index 1d5988849aa6..192322bbdc29 100644
--- a/drivers/dma/xgene-dma.c
+++ b/drivers/dma/xgene-dma.c
@@ -1564,7 +1564,7 @@ static int xgene_dma_async_register(struct xgene_dma *pdma, int id)
list_add_tail(&chan->dma_chan.device_node, &dma_dev->channels);

/* Register with Linux async DMA framework*/
- ret = dma_async_device_register(dma_dev);
+ ret = dmaenginem_async_device_register(dma_dev);
if (ret) {
chan_err(chan, "Failed to register async device %d", ret);
tasklet_kill(&chan->tasklet);
@@ -1588,10 +1588,8 @@ static int xgene_dma_init_async(struct xgene_dma *pdma)
for (i = 0; i < XGENE_DMA_MAX_CHANNEL ; i++) {
ret = xgene_dma_async_register(pdma, i);
if (ret) {
- for (j = 0; j < i; j++) {
- dma_async_device_unregister(&pdma->dma_dev[j]);
+ for (j = 0; j < i; j++)
tasklet_kill(&pdma->chan[j].tasklet);
- }

return ret;
}
@@ -1600,14 +1598,6 @@ static int xgene_dma_init_async(struct xgene_dma *pdma)
return ret;
}

-static void xgene_dma_async_unregister(struct xgene_dma *pdma)
-{
- int i;
-
- for (i = 0; i < XGENE_DMA_MAX_CHANNEL; i++)
- dma_async_device_unregister(&pdma->dma_dev[i]);
-}
-
static void xgene_dma_init_channels(struct xgene_dma *pdma)
{
struct xgene_dma_chan *chan;
@@ -1796,8 +1786,6 @@ static int xgene_dma_remove(struct platform_device *pdev)
struct xgene_dma_chan *chan;
int i;

- xgene_dma_async_unregister(pdma);
-
/* Mask interrupts and disable DMA engine */
xgene_dma_mask_interrupts(pdma);
xgene_dma_disable(pdma);
--
2.17.1