Skip to content

Commit 62f72cb

Browse files
Peter Ujfalusiherbertx
authored andcommitted
crypto: atmel-aes - 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 <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 2452cfd commit 62f72cb

File tree

1 file changed

+10
-40
lines changed

1 file changed

+10
-40
lines changed

drivers/crypto/atmel-aes.c

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include <crypto/internal/aead.h>
3939
#include <crypto/internal/skcipher.h>
4040
#include <linux/platform_data/crypto-atmel.h>
41-
#include <dt-bindings/dma/at91.h>
4241
#include "atmel-aes-regs.h"
4342
#include "atmel-authenc.h"
4443

@@ -2364,47 +2363,31 @@ static void atmel_aes_buff_cleanup(struct atmel_aes_dev *dd)
23642363
free_page((unsigned long)dd->buf);
23652364
}
23662365

2367-
static bool atmel_aes_filter(struct dma_chan *chan, void *slave)
2368-
{
2369-
struct at_dma_slave *sl = slave;
2370-
2371-
if (sl && sl->dma_dev == chan->device->dev) {
2372-
chan->private = sl;
2373-
return true;
2374-
} else {
2375-
return false;
2376-
}
2377-
}
2378-
23792366
static int atmel_aes_dma_init(struct atmel_aes_dev *dd,
23802367
struct crypto_platform_data *pdata)
23812368
{
2382-
struct at_dma_slave *slave;
2383-
dma_cap_mask_t mask;
2384-
2385-
dma_cap_zero(mask);
2386-
dma_cap_set(DMA_SLAVE, mask);
2369+
int ret;
23872370

23882371
/* Try to grab 2 DMA channels */
2389-
slave = &pdata->dma_slave->rxdata;
2390-
dd->src.chan = dma_request_slave_channel_compat(mask, atmel_aes_filter,
2391-
slave, dd->dev, "tx");
2392-
if (!dd->src.chan)
2372+
dd->src.chan = dma_request_chan(dd->dev, "tx");
2373+
if (IS_ERR(dd->src.chan)) {
2374+
ret = PTR_ERR(dd->src.chan);
23932375
goto err_dma_in;
2376+
}
23942377

2395-
slave = &pdata->dma_slave->txdata;
2396-
dd->dst.chan = dma_request_slave_channel_compat(mask, atmel_aes_filter,
2397-
slave, dd->dev, "rx");
2398-
if (!dd->dst.chan)
2378+
dd->dst.chan = dma_request_chan(dd->dev, "rx");
2379+
if (IS_ERR(dd->dst.chan)) {
2380+
ret = PTR_ERR(dd->dst.chan);
23992381
goto err_dma_out;
2382+
}
24002383

24012384
return 0;
24022385

24032386
err_dma_out:
24042387
dma_release_channel(dd->src.chan);
24052388
err_dma_in:
24062389
dev_warn(dd->dev, "no DMA channel available\n");
2407-
return -ENODEV;
2390+
return ret;
24082391
}
24092392

24102393
static void atmel_aes_dma_cleanup(struct atmel_aes_dev *dd)
@@ -2592,14 +2575,6 @@ static struct crypto_platform_data *atmel_aes_of_init(struct platform_device *pd
25922575
if (!pdata)
25932576
return ERR_PTR(-ENOMEM);
25942577

2595-
pdata->dma_slave = devm_kzalloc(&pdev->dev,
2596-
sizeof(*(pdata->dma_slave)),
2597-
GFP_KERNEL);
2598-
if (!pdata->dma_slave) {
2599-
devm_kfree(&pdev->dev, pdata);
2600-
return ERR_PTR(-ENOMEM);
2601-
}
2602-
26032578
return pdata;
26042579
}
26052580
#else
@@ -2626,11 +2601,6 @@ static int atmel_aes_probe(struct platform_device *pdev)
26262601
}
26272602
}
26282603

2629-
if (!pdata->dma_slave) {
2630-
err = -ENXIO;
2631-
goto aes_dd_err;
2632-
}
2633-
26342604
aes_dd = devm_kzalloc(&pdev->dev, sizeof(*aes_dd), GFP_KERNEL);
26352605
if (aes_dd == NULL) {
26362606
err = -ENOMEM;

0 commit comments

Comments
 (0)