net: ethernet: ti: cpdma: use devm_ioremap
authorGrygorii Strashko <grygorii.strashko@ti.com>
Fri, 6 Jan 2017 20:07:32 +0000 (14:07 -0600)
committerDavid S. Miller <davem@davemloft.net>
Sun, 8 Jan 2017 01:48:14 +0000 (20:48 -0500)
Use devm_ioremap() and simplify the code.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ti/davinci_cpdma.c

index 7080eb9eceff8c887ee73543a7097696bbc6732d..b229bf3df91210d47568d261e53b5522dc5cd3ef 100644 (file)
@@ -195,8 +195,6 @@ static void cpdma_desc_pool_destroy(struct cpdma_ctlr *ctlr)
        if (pool->cpumap)
                dma_free_coherent(ctlr->dev, pool->mem_size, pool->cpumap,
                                  pool->phys);
-       else
-               iounmap(pool->iomap);
 }
 
 /*
@@ -231,7 +229,8 @@ int cpdma_desc_pool_create(struct cpdma_ctlr *ctlr)
 
        if (cpdma_params->desc_mem_phys) {
                pool->phys  = cpdma_params->desc_mem_phys;
-               pool->iomap = ioremap(pool->phys, pool->mem_size);
+               pool->iomap = devm_ioremap(ctlr->dev, pool->phys,
+                                          pool->mem_size);
                pool->hw_addr = cpdma_params->desc_hw_addr;
        } else {
                pool->cpumap = dma_alloc_coherent(ctlr->dev,  pool->mem_size,