]> err.no Git - linux-2.6/blobdiff - crypto/async_tx/async_memset.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc
[linux-2.6] / crypto / async_tx / async_memset.c
index 760972803958dff3fd5da44a87e3ada0acee847a..f5ff3906b035d52d5c6b28949ca6470b46d60f88 100644 (file)
@@ -46,26 +46,28 @@ async_memset(struct page *dest, int val, unsigned int offset,
        struct dma_async_tx_descriptor *depend_tx,
        dma_async_tx_callback cb_fn, void *cb_param)
 {
-       struct dma_chan *chan = async_tx_find_channel(depend_tx, DMA_MEMSET);
+       struct dma_chan *chan = async_tx_find_channel(depend_tx, DMA_MEMSET,
+                                                     &dest, 1, NULL, 0, len);
        struct dma_device *device = chan ? chan->device : NULL;
-       int int_en = cb_fn ? 1 : 0;
-       struct dma_async_tx_descriptor *tx = device ?
-               device->device_prep_dma_memset(chan, val, len,
-                       int_en) : NULL;
+       struct dma_async_tx_descriptor *tx = NULL;
 
-       if (tx) { /* run the memset asynchronously */
-               dma_addr_t dma_addr;
+       if (device) {
+               dma_addr_t dma_dest;
+               unsigned long dma_prep_flags = cb_fn ? DMA_PREP_INTERRUPT : 0;
 
-               pr_debug("%s: (async) len: %zu\n", __FUNCTION__, len);
-
-               dma_addr = dma_map_page(device->dev, dest, offset, len,
+               dma_dest = dma_map_page(device->dev, dest, offset, len,
                                        DMA_FROM_DEVICE);
-               tx->tx_set_dest(dma_addr, tx, 0);
 
+               tx = device->device_prep_dma_memset(chan, dma_dest, val, len,
+                                                   dma_prep_flags);
+       }
+
+       if (tx) {
+               pr_debug("%s: (async) len: %zu\n", __func__, len);
                async_tx_submit(chan, tx, flags, depend_tx, cb_fn, cb_param);
        } else { /* run the memset synchronously */
                void *dest_buf;
-               pr_debug("%s: (sync) len: %zu\n", __FUNCTION__, len);
+               pr_debug("%s: (sync) len: %zu\n", __func__, len);
 
                dest_buf = (void *) (((char *) page_address(dest)) + offset);
 
@@ -77,7 +79,7 @@ async_memset(struct page *dest, int val, unsigned int offset,
                        BUG_ON(depend_tx->ack);
                        if (dma_wait_for_async_tx(depend_tx) == DMA_ERROR)
                                panic("%s: DMA_ERROR waiting for depend_tx\n",
-                                       __FUNCTION__);
+                                       __func__);
                }
 
                memset(dest_buf, val, len);