dmaengine: k3dma: remove dma_slave_config direction usage
authorVinod Koul <vkoul@kernel.org>
Thu, 19 Jul 2018 16:52:26 +0000 (22:22 +0530)
committerVinod Koul <vkoul@kernel.org>
Sun, 7 Oct 2018 13:55:10 +0000 (19:25 +0530)
dma_slave_config direction was marked as deprecated quite some
time back, remove the usage from this driver so that the field
can be removed

Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/k3dma.c

index 964dcb46755b54d00fc09bdb33ab6fdf0363bc59..fdec2b6cfbb0f05238daff11afaf1861f13c48cf 100644 (file)
@@ -87,10 +87,10 @@ struct k3_dma_chan {
        struct virt_dma_chan    vc;
        struct k3_dma_phy       *phy;
        struct list_head        node;
-       enum dma_transfer_direction dir;
        dma_addr_t              dev_addr;
        enum dma_status         status;
        bool                    cyclic;
+       struct dma_slave_config slave_config;
 };
 
 struct k3_dma_phy {
@@ -118,6 +118,10 @@ struct k3_dma_dev {
 
 #define to_k3_dma(dmadev) container_of(dmadev, struct k3_dma_dev, slave)
 
+static int k3_dma_config_write(struct dma_chan *chan,
+                              enum dma_transfer_direction dir,
+                              struct dma_slave_config *cfg);
+
 static struct k3_dma_chan *to_k3_chan(struct dma_chan *chan)
 {
        return container_of(chan, struct k3_dma_chan, vc.chan);
@@ -536,6 +540,7 @@ static struct dma_async_tx_descriptor *k3_dma_prep_slave_sg(
        if (!ds)
                return NULL;
        num = 0;
+       k3_dma_config_write(chan, dir, &c->slave_config);
 
        for_each_sg(sgl, sg, sglen, i) {
                addr = sg_dma_address(sg);
@@ -596,6 +601,7 @@ k3_dma_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf_addr,
        avail = buf_len;
        total = avail;
        num = 0;
+       k3_dma_config_write(chan, dir, &c->slave_config);
 
        if (period_len < modulo)
                modulo = period_len;
@@ -636,18 +642,26 @@ static int k3_dma_config(struct dma_chan *chan,
                         struct dma_slave_config *cfg)
 {
        struct k3_dma_chan *c = to_k3_chan(chan);
+
+       memcpy(&c->slave_config, cfg, sizeof(*cfg));
+
+       return 0;
+}
+
+static int k3_dma_config_write(struct dma_chan *chan,
+                              enum dma_transfer_direction dir,
+                              struct dma_slave_config *cfg)
+{
+       struct k3_dma_chan *c = to_k3_chan(chan);
        u32 maxburst = 0, val = 0;
        enum dma_slave_buswidth width = DMA_SLAVE_BUSWIDTH_UNDEFINED;
 
-       if (cfg == NULL)
-               return -EINVAL;
-       c->dir = cfg->direction;
-       if (c->dir == DMA_DEV_TO_MEM) {
+       if (dir == DMA_DEV_TO_MEM) {
                c->ccfg = CX_CFG_DSTINCR;
                c->dev_addr = cfg->src_addr;
                maxburst = cfg->src_maxburst;
                width = cfg->src_addr_width;
-       } else if (c->dir == DMA_MEM_TO_DEV) {
+       } else if (dir == DMA_MEM_TO_DEV) {
                c->ccfg = CX_CFG_SRCINCR;
                c->dev_addr = cfg->dst_addr;
                maxburst = cfg->dst_maxburst;