Skip to content

Commit db28512

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

File tree

1 file changed

+7
-32
lines changed

1 file changed

+7
-32
lines changed

drivers/crypto/atmel-sha.c

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2608,32 +2608,16 @@ static int atmel_sha_register_algs(struct atmel_sha_dev *dd)
26082608
return err;
26092609
}
26102610

2611-
static bool atmel_sha_filter(struct dma_chan *chan, void *slave)
2612-
{
2613-
struct at_dma_slave *sl = slave;
2614-
2615-
if (sl && sl->dma_dev == chan->device->dev) {
2616-
chan->private = sl;
2617-
return true;
2618-
} else {
2619-
return false;
2620-
}
2621-
}
2622-
26232611
static int atmel_sha_dma_init(struct atmel_sha_dev *dd,
26242612
struct crypto_platform_data *pdata)
26252613
{
2626-
dma_cap_mask_t mask_in;
2614+
dd->dma_lch_in.chan = dma_request_chan(dd->dev, "tx");
2615+
if (IS_ERR(dd->dma_lch_in.chan)) {
2616+
int ret = PTR_ERR(dd->dma_lch_in.chan);
26272617

2628-
/* Try to grab DMA channel */
2629-
dma_cap_zero(mask_in);
2630-
dma_cap_set(DMA_SLAVE, mask_in);
2631-
2632-
dd->dma_lch_in.chan = dma_request_slave_channel_compat(mask_in,
2633-
atmel_sha_filter, &pdata->dma_slave->rxdata, dd->dev, "tx");
2634-
if (!dd->dma_lch_in.chan) {
2635-
dev_warn(dd->dev, "no DMA channel available\n");
2636-
return -ENODEV;
2618+
if (ret != -EPROBE_DEFER)
2619+
dev_warn(dd->dev, "no DMA channel available\n");
2620+
return ret;
26372621
}
26382622

26392623
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
27242708
if (!pdata)
27252709
return ERR_PTR(-ENOMEM);
27262710

2727-
pdata->dma_slave = devm_kzalloc(&pdev->dev,
2728-
sizeof(*(pdata->dma_slave)),
2729-
GFP_KERNEL);
2730-
if (!pdata->dma_slave)
2731-
return ERR_PTR(-ENOMEM);
2732-
27332711
return pdata;
27342712
}
27352713
#else /* CONFIG_OF */
@@ -2823,10 +2801,7 @@ static int atmel_sha_probe(struct platform_device *pdev)
28232801
goto iclk_unprepare;
28242802
}
28252803
}
2826-
if (!pdata->dma_slave) {
2827-
err = -ENXIO;
2828-
goto iclk_unprepare;
2829-
}
2804+
28302805
err = atmel_sha_dma_init(sha_dd, pdata);
28312806
if (err)
28322807
goto err_sha_dma;

0 commit comments

Comments
 (0)