dmaengine: edma: Split device_control
authorMaxime Ripard <maxime.ripard@free-electrons.com>
Mon, 17 Nov 2014 13:42:13 +0000 (14:42 +0100)
committerVinod Koul <vinod.koul@intel.com>
Mon, 22 Dec 2014 06:58:58 +0000 (12:28 +0530)
Split the device_control callback of the TI EDMA driver to make use of the
newly introduced callbacks, that will eventually be used to retrieve slave
capabilities.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/edma.c

index 2b49fe6f04653a6dc0c37c9d81e0ac2187484d65..8feb096786f81410546534bad1e852d07b1316d4 100644 (file)
@@ -244,8 +244,9 @@ static void edma_execute(struct edma_chan *echan)
        }
 }
 
-static int edma_terminate_all(struct edma_chan *echan)
+static int edma_terminate_all(struct dma_chan *chan)
 {
+       struct edma_chan *echan = to_edma_chan(chan);
        unsigned long flags;
        LIST_HEAD(head);
 
@@ -273,9 +274,11 @@ static int edma_terminate_all(struct edma_chan *echan)
        return 0;
 }
 
-static int edma_slave_config(struct edma_chan *echan,
+static int edma_slave_config(struct dma_chan *chan,
        struct dma_slave_config *cfg)
 {
+       struct edma_chan *echan = to_edma_chan(chan);
+
        if (cfg->src_addr_width == DMA_SLAVE_BUSWIDTH_8_BYTES ||
            cfg->dst_addr_width == DMA_SLAVE_BUSWIDTH_8_BYTES)
                return -EINVAL;
@@ -285,8 +288,10 @@ static int edma_slave_config(struct edma_chan *echan,
        return 0;
 }
 
-static int edma_dma_pause(struct edma_chan *echan)
+static int edma_dma_pause(struct dma_chan *chan)
 {
+       struct edma_chan *echan = to_edma_chan(chan);
+
        /* Pause/Resume only allowed with cyclic mode */
        if (!echan->edesc || !echan->edesc->cyclic)
                return -EINVAL;
@@ -295,8 +300,10 @@ static int edma_dma_pause(struct edma_chan *echan)
        return 0;
 }
 
-static int edma_dma_resume(struct edma_chan *echan)
+static int edma_dma_resume(struct dma_chan *chan)
 {
+       struct edma_chan *echan = to_edma_chan(chan);
+
        /* Pause/Resume only allowed with cyclic mode */
        if (!echan->edesc->cyclic)
                return -EINVAL;
@@ -305,36 +312,6 @@ static int edma_dma_resume(struct edma_chan *echan)
        return 0;
 }
 
-static int edma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
-                       unsigned long arg)
-{
-       int ret = 0;
-       struct dma_slave_config *config;
-       struct edma_chan *echan = to_edma_chan(chan);
-
-       switch (cmd) {
-       case DMA_TERMINATE_ALL:
-               edma_terminate_all(echan);
-               break;
-       case DMA_SLAVE_CONFIG:
-               config = (struct dma_slave_config *)arg;
-               ret = edma_slave_config(echan, config);
-               break;
-       case DMA_PAUSE:
-               ret = edma_dma_pause(echan);
-               break;
-
-       case DMA_RESUME:
-               ret = edma_dma_resume(echan);
-               break;
-
-       default:
-               ret = -ENOSYS;
-       }
-
-       return ret;
-}
-
 /*
  * A PaRAM set configuration abstraction used by other modes
  * @chan: Channel who's PaRAM set we're configuring
@@ -1017,7 +994,10 @@ static void edma_dma_init(struct edma_cc *ecc, struct dma_device *dma,
        dma->device_free_chan_resources = edma_free_chan_resources;
        dma->device_issue_pending = edma_issue_pending;
        dma->device_tx_status = edma_tx_status;
-       dma->device_control = edma_control;
+       dma->device_config = edma_slave_config;
+       dma->device_pause = edma_dma_pause;
+       dma->device_resume = edma_dma_resume;
+       dma->device_terminate_all = edma_terminate_all;
        dma->device_slave_caps = edma_dma_device_slave_caps;
        dma->dev = dev;