crypto: atmel-sha - Retire dma_request_slave_channel_compat()

The driver no longer boots in legacy mode, only via DT. This makes the
dma_request_slave_channel_compat() redundant.
If ever the filter function would be executed it will return false as the
dma_slave is not really initialized.

Switch to use dma_request_chan() which would allow legacy boot if ever
needed again by configuring dma_slave_map for the DMA driver.

At the same time skip allocating memory for dma_slave as it is not used
anymore.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Peter Ujfalusi 2019-11-21 12:16:01 +02:00 committed by Herbert Xu
parent 62f72cbdcf
commit db28512f48
1 changed files with 7 additions and 32 deletions

View File

@ -2608,32 +2608,16 @@ err_sha_1_256_algs:
return err;
}
static bool atmel_sha_filter(struct dma_chan *chan, void *slave)
{
struct at_dma_slave *sl = slave;
if (sl && sl->dma_dev == chan->device->dev) {
chan->private = sl;
return true;
} else {
return false;
}
}
static int atmel_sha_dma_init(struct atmel_sha_dev *dd,
struct crypto_platform_data *pdata)
{
dma_cap_mask_t mask_in;
dd->dma_lch_in.chan = dma_request_chan(dd->dev, "tx");
if (IS_ERR(dd->dma_lch_in.chan)) {
int ret = PTR_ERR(dd->dma_lch_in.chan);
/* Try to grab DMA channel */
dma_cap_zero(mask_in);
dma_cap_set(DMA_SLAVE, mask_in);
dd->dma_lch_in.chan = dma_request_slave_channel_compat(mask_in,
atmel_sha_filter, &pdata->dma_slave->rxdata, dd->dev, "tx");
if (!dd->dma_lch_in.chan) {
dev_warn(dd->dev, "no DMA channel available\n");
return -ENODEV;
if (ret != -EPROBE_DEFER)
dev_warn(dd->dev, "no DMA channel available\n");
return ret;
}
dd->dma_lch_in.dma_conf.direction = DMA_MEM_TO_DEV;
@ -2724,12 +2708,6 @@ static struct crypto_platform_data *atmel_sha_of_init(struct platform_device *pd
if (!pdata)
return ERR_PTR(-ENOMEM);
pdata->dma_slave = devm_kzalloc(&pdev->dev,
sizeof(*(pdata->dma_slave)),
GFP_KERNEL);
if (!pdata->dma_slave)
return ERR_PTR(-ENOMEM);
return pdata;
}
#else /* CONFIG_OF */
@ -2823,10 +2801,7 @@ static int atmel_sha_probe(struct platform_device *pdev)
goto iclk_unprepare;
}
}
if (!pdata->dma_slave) {
err = -ENXIO;
goto iclk_unprepare;
}
err = atmel_sha_dma_init(sha_dd, pdata);
if (err)
goto err_sha_dma;