Merge tag 'for-linus-20161008' of git://git.infradead.org/linux-mtd
[cascardo/linux.git] / drivers / dma / coh901318.c
index e4acd63..74794c9 100644 (file)
@@ -1319,10 +1319,10 @@ static void coh901318_list_print(struct coh901318_chan *cohc,
        int i = 0;
 
        while (l) {
-               dev_vdbg(COHC_2_DEV(cohc), "i %d, lli %p, ctrl 0x%x, src 0x%x"
-                        ", dst 0x%x, link 0x%x virt_link_addr 0x%p\n",
-                        i, l, l->control, l->src_addr, l->dst_addr,
-                        l->link_addr, l->virt_link_addr);
+               dev_vdbg(COHC_2_DEV(cohc), "i %d, lli %p, ctrl 0x%x, src 0x%pad"
+                        ", dst 0x%pad, link 0x%pad virt_link_addr 0x%p\n",
+                        i, l, l->control, &l->src_addr, &l->dst_addr,
+                        &l->link_addr, l->virt_link_addr);
                i++;
                l = l->virt_link_addr;
        }
@@ -1335,7 +1335,7 @@ static void coh901318_list_print(struct coh901318_chan *cohc,
 static struct coh901318_base *debugfs_dma_base;
 static struct dentry *dma_dentry;
 
-static int coh901318_debugfs_read(struct file *file, char __user *buf,
+static ssize_t coh901318_debugfs_read(struct file *file, char __user *buf,
                                  size_t count, loff_t *f_pos)
 {
        u64 started_channels = debugfs_dma_base->pm.started_channels;
@@ -1352,9 +1352,10 @@ static int coh901318_debugfs_read(struct file *file, char __user *buf,
 
        tmp += sprintf(tmp, "DMA -- enabled dma channels\n");
 
-       for (i = 0; i < U300_DMA_CHANNELS; i++)
-               if (started_channels & (1 << i))
+       for (i = 0; i < U300_DMA_CHANNELS; i++) {
+               if (started_channels & (1ULL << i))
                        tmp += sprintf(tmp, "channel %d\n", i);
+       }
 
        tmp += sprintf(tmp, "Pool alloc nbr %d\n", pool_count);
 
@@ -1553,15 +1554,8 @@ coh901318_desc_submit(struct coh901318_chan *cohc, struct coh901318_desc *desc)
 static struct coh901318_desc *
 coh901318_first_active_get(struct coh901318_chan *cohc)
 {
-       struct coh901318_desc *d;
-
-       if (list_empty(&cohc->active))
-               return NULL;
-
-       d = list_first_entry(&cohc->active,
-                            struct coh901318_desc,
-                            node);
-       return d;
+       return list_first_entry_or_null(&cohc->active, struct coh901318_desc,
+                                       node);
 }
 
 static void
@@ -1579,15 +1573,8 @@ coh901318_desc_queue(struct coh901318_chan *cohc, struct coh901318_desc *desc)
 static struct coh901318_desc *
 coh901318_first_queued(struct coh901318_chan *cohc)
 {
-       struct coh901318_desc *d;
-
-       if (list_empty(&cohc->queue))
-               return NULL;
-
-       d = list_first_entry(&cohc->queue,
-                            struct coh901318_desc,
-                            node);
-       return d;
+       return list_first_entry_or_null(&cohc->queue, struct coh901318_desc,
+                                       node);
 }
 
 static inline u32 coh901318_get_bytes_in_lli(struct coh901318_lli *in_lli)
@@ -1766,7 +1753,7 @@ static int coh901318_resume(struct dma_chan *chan)
 
 bool coh901318_filter_id(struct dma_chan *chan, void *chan_id)
 {
-       unsigned int ch_nr = (unsigned int) chan_id;
+       unsigned long ch_nr = (unsigned long) chan_id;
 
        if (ch_nr == to_coh901318_chan(chan)->id)
                return true;
@@ -1888,8 +1875,7 @@ static void dma_tasklet(unsigned long data)
        struct coh901318_chan *cohc = (struct coh901318_chan *) data;
        struct coh901318_desc *cohd_fin;
        unsigned long flags;
-       dma_async_tx_callback callback;
-       void *callback_param;
+       struct dmaengine_desc_callback cb;
 
        dev_vdbg(COHC_2_DEV(cohc), "[%s] chan_id %d"
                 " nbr_active_done %ld\n", __func__,
@@ -1904,8 +1890,7 @@ static void dma_tasklet(unsigned long data)
                goto err;
 
        /* locate callback to client */
-       callback = cohd_fin->desc.callback;
-       callback_param = cohd_fin->desc.callback_param;
+       dmaengine_desc_get_callback(&cohd_fin->desc, &cb);
 
        /* sign this job as completed on the channel */
        dma_cookie_complete(&cohd_fin->desc);
@@ -1920,8 +1905,7 @@ static void dma_tasklet(unsigned long data)
        spin_unlock_irqrestore(&cohc->lock, flags);
 
        /* Call the callback when we're done */
-       if (callback)
-               callback(callback_param);
+       dmaengine_desc_callback_invoke(&cb, NULL);
 
        spin_lock_irqsave(&cohc->lock, flags);
 
@@ -2247,8 +2231,8 @@ coh901318_prep_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
        spin_lock_irqsave(&cohc->lock, flg);
 
        dev_vdbg(COHC_2_DEV(cohc),
-                "[%s] channel %d src 0x%x dest 0x%x size %d\n",
-                __func__, cohc->id, src, dest, size);
+                "[%s] channel %d src 0x%pad dest 0x%pad size %zu\n",
+                __func__, cohc->id, &src, &dest, size);
 
        if (flags & DMA_PREP_INTERRUPT)
                /* Trigger interrupt after last lli */
@@ -2744,8 +2728,8 @@ static int __init coh901318_probe(struct platform_device *pdev)
                goto err_register_of_dma;
 
        platform_set_drvdata(pdev, base);
-       dev_info(&pdev->dev, "Initialized COH901318 DMA on virtual base 0x%08x\n",
-               (u32) base->virtbase);
+       dev_info(&pdev->dev, "Initialized COH901318 DMA on virtual base 0x%p\n",
+               base->virtbase);
 
        return err;