Commit dbe24620 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Herbert Xu

crypto: omap-sham - Use dma_request_chan() for requesting DMA channel

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: default avatarPeter 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: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 2f6f0680
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <linux/scatterlist.h> #include <linux/scatterlist.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/dmaengine.h> #include <linux/dmaengine.h>
#include <linux/omap-dma.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h> #include <linux/of_device.h>
...@@ -219,7 +218,6 @@ struct omap_sham_dev { ...@@ -219,7 +218,6 @@ struct omap_sham_dev {
int irq; int irq;
spinlock_t lock; spinlock_t lock;
int err; int err;
unsigned int dma;
struct dma_chan *dma_lch; struct dma_chan *dma_lch;
struct tasklet_struct done_task; struct tasklet_struct done_task;
u8 polling_mode; u8 polling_mode;
...@@ -1842,7 +1840,6 @@ static int omap_sham_get_res_of(struct omap_sham_dev *dd, ...@@ -1842,7 +1840,6 @@ static int omap_sham_get_res_of(struct omap_sham_dev *dd,
goto err; goto err;
} }
dd->dma = -1; /* Dummy value that's unused */
dd->pdata = match->data; dd->pdata = match->data;
err: err:
...@@ -1884,15 +1881,6 @@ static int omap_sham_get_res_pdev(struct omap_sham_dev *dd, ...@@ -1884,15 +1881,6 @@ static int omap_sham_get_res_pdev(struct omap_sham_dev *dd,
goto err; 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 */ /* Only OMAP2/3 can be non-DT */
dd->pdata = &omap_sham_pdata_omap2; dd->pdata = &omap_sham_pdata_omap2;
...@@ -1946,9 +1934,12 @@ static int omap_sham_probe(struct platform_device *pdev) ...@@ -1946,9 +1934,12 @@ static int omap_sham_probe(struct platform_device *pdev)
dma_cap_zero(mask); dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask); dma_cap_set(DMA_SLAVE, mask);
dd->dma_lch = dma_request_slave_channel_compat(mask, omap_dma_filter_fn, dd->dma_lch = dma_request_chan(dev, "rx");
&dd->dma, dev, "rx"); if (IS_ERR(dd->dma_lch)) {
if (!dd->dma_lch) { err = PTR_ERR(dd->dma_lch);
if (err == -EPROBE_DEFER)
goto data_err;
dd->polling_mode = 1; dd->polling_mode = 1;
dev_dbg(dev, "using polling mode instead of dma\n"); dev_dbg(dev, "using polling mode instead of dma\n");
} }
...@@ -1995,7 +1986,7 @@ static int omap_sham_probe(struct platform_device *pdev) ...@@ -1995,7 +1986,7 @@ static int omap_sham_probe(struct platform_device *pdev)
&dd->pdata->algs_info[i].algs_list[j]); &dd->pdata->algs_info[i].algs_list[j]);
err_pm: err_pm:
pm_runtime_disable(dev); pm_runtime_disable(dev);
if (dd->dma_lch) if (dd->polling_mode)
dma_release_channel(dd->dma_lch); dma_release_channel(dd->dma_lch);
data_err: data_err:
dev_err(dev, "initialization failed.\n"); dev_err(dev, "initialization failed.\n");
...@@ -2021,7 +2012,7 @@ static int omap_sham_remove(struct platform_device *pdev) ...@@ -2021,7 +2012,7 @@ static int omap_sham_remove(struct platform_device *pdev)
tasklet_kill(&dd->done_task); tasklet_kill(&dd->done_task);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
if (dd->dma_lch) if (!dd->polling_mode)
dma_release_channel(dd->dma_lch); dma_release_channel(dd->dma_lch);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment