mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-01 16:14:13 +08:00
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:
parent
62f72cbdcf
commit
db28512f48
@ -2608,32 +2608,16 @@ err_sha_1_256_algs:
|
|||||||
return err;
|
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,
|
static int atmel_sha_dma_init(struct atmel_sha_dev *dd,
|
||||||
struct crypto_platform_data *pdata)
|
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 */
|
if (ret != -EPROBE_DEFER)
|
||||||
dma_cap_zero(mask_in);
|
dev_warn(dd->dev, "no DMA channel available\n");
|
||||||
dma_cap_set(DMA_SLAVE, mask_in);
|
return ret;
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dd->dma_lch_in.dma_conf.direction = DMA_MEM_TO_DEV;
|
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)
|
if (!pdata)
|
||||||
return ERR_PTR(-ENOMEM);
|
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;
|
return pdata;
|
||||||
}
|
}
|
||||||
#else /* CONFIG_OF */
|
#else /* CONFIG_OF */
|
||||||
@ -2823,10 +2801,7 @@ static int atmel_sha_probe(struct platform_device *pdev)
|
|||||||
goto iclk_unprepare;
|
goto iclk_unprepare;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!pdata->dma_slave) {
|
|
||||||
err = -ENXIO;
|
|
||||||
goto iclk_unprepare;
|
|
||||||
}
|
|
||||||
err = atmel_sha_dma_init(sha_dd, pdata);
|
err = atmel_sha_dma_init(sha_dd, pdata);
|
||||||
if (err)
|
if (err)
|
||||||
goto err_sha_dma;
|
goto err_sha_dma;
|
||||||
|
Loading…
Reference in New Issue
Block a user