]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/mtd/nand/tango_nand.c
mtd: nand: tango: Enforce DMA direction type
[karo-tx-linux.git] / drivers / mtd / nand / tango_nand.c
index 4a5e948c62df1b7d29ff9fe78b50e7d0858b01d5..05b6e106520331ddd48f619f798d21c4cfeb2059 100644 (file)
@@ -223,12 +223,13 @@ static void tango_dma_callback(void *arg)
        complete(arg);
 }
 
-static int do_dma(struct tango_nfc *nfc, int dir, int cmd, const void *buf,
-                 int len, int page)
+static int do_dma(struct tango_nfc *nfc, enum dma_data_direction dir, int cmd,
+                 const void *buf, int len, int page)
 {
        void __iomem *addr = nfc->reg_base + NFC_STATUS;
        struct dma_chan *chan = nfc->chan;
        struct dma_async_tx_descriptor *desc;
+       enum dma_transfer_direction tdir;
        struct scatterlist sg;
        struct completion tx_done;
        int err = -EIO;
@@ -238,7 +239,8 @@ static int do_dma(struct tango_nfc *nfc, int dir, int cmd, const void *buf,
        if (dma_map_sg(chan->device->dev, &sg, 1, dir) != 1)
                return -EIO;
 
-       desc = dmaengine_prep_slave_sg(chan, &sg, 1, dir, DMA_PREP_INTERRUPT);
+       tdir = dir == DMA_TO_DEVICE ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
+       desc = dmaengine_prep_slave_sg(chan, &sg, 1, tdir, DMA_PREP_INTERRUPT);
        if (!desc)
                goto dma_unmap;