]> git.karo-electronics.de Git - linux-beck.git/commitdiff
crypto: omap-sham - Use dma_request_chan() for requesting DMA channel
authorPeter Ujfalusi <peter.ujfalusi@ti.com>
Fri, 29 Apr 2016 13:03:41 +0000 (16:03 +0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 3 May 2016 08:09:14 +0000 (16:09 +0800)
With the new dma_request_chan() the client driver does not need to look for
the DMA resource and it does not need to pass filter_fn anymore.
By switching to the new API the driver can now support deferred probing
against DMA.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: Herbert Xu <herbert@gondor.apana.org.au>
CC: David S. Miller <davem@davemloft.net>
CC: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/omap-sham.c

index 48adb2a0903e52a9567682430e5035b50487f6ae..6eefaa2fe58f990ce39ca1d7c7078a3d65eeafa6 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/scatterlist.h>
 #include <linux/dma-mapping.h>
 #include <linux/dmaengine.h>
-#include <linux/omap-dma.h>
 #include <linux/pm_runtime.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
@@ -219,7 +218,6 @@ struct omap_sham_dev {
        int                     irq;
        spinlock_t              lock;
        int                     err;
-       unsigned int            dma;
        struct dma_chan         *dma_lch;
        struct tasklet_struct   done_task;
        u8                      polling_mode;
@@ -1842,7 +1840,6 @@ static int omap_sham_get_res_of(struct omap_sham_dev *dd,
                goto err;
        }
 
-       dd->dma = -1; /* Dummy value that's unused */
        dd->pdata = match->data;
 
 err:
@@ -1884,15 +1881,6 @@ static int omap_sham_get_res_pdev(struct omap_sham_dev *dd,
                goto err;
        }
 
-       /* Get the DMA */
-       r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
-       if (!r) {
-               dev_err(dev, "no DMA resource info\n");
-               err = -ENODEV;
-               goto err;
-       }
-       dd->dma = r->start;
-
        /* Only OMAP2/3 can be non-DT */
        dd->pdata = &omap_sham_pdata_omap2;
 
@@ -1946,9 +1934,12 @@ static int omap_sham_probe(struct platform_device *pdev)
        dma_cap_zero(mask);
        dma_cap_set(DMA_SLAVE, mask);
 
-       dd->dma_lch = dma_request_slave_channel_compat(mask, omap_dma_filter_fn,
-                                                      &dd->dma, dev, "rx");
-       if (!dd->dma_lch) {
+       dd->dma_lch = dma_request_chan(dev, "rx");
+       if (IS_ERR(dd->dma_lch)) {
+               err = PTR_ERR(dd->dma_lch);
+               if (err == -EPROBE_DEFER)
+                       goto data_err;
+
                dd->polling_mode = 1;
                dev_dbg(dev, "using polling mode instead of dma\n");
        }
@@ -1995,7 +1986,7 @@ err_algs:
                                        &dd->pdata->algs_info[i].algs_list[j]);
 err_pm:
        pm_runtime_disable(dev);
-       if (dd->dma_lch)
+       if (dd->polling_mode)
                dma_release_channel(dd->dma_lch);
 data_err:
        dev_err(dev, "initialization failed.\n");
@@ -2021,7 +2012,7 @@ static int omap_sham_remove(struct platform_device *pdev)
        tasklet_kill(&dd->done_task);
        pm_runtime_disable(&pdev->dev);
 
-       if (dd->dma_lch)
+       if (!dd->polling_mode)
                dma_release_channel(dd->dma_lch);
 
        return 0;