summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/mxs-dcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/crypto/mxs-dcp.c')
-rw-r--r--drivers/crypto/mxs-dcp.c52
1 files changed, 17 insertions, 35 deletions
diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c
index 7bbe0ab21eca..b5f7e6db24d4 100644
--- a/drivers/crypto/mxs-dcp.c
+++ b/drivers/crypto/mxs-dcp.c
@@ -104,7 +104,6 @@ struct dcp_sha_req_ctx {
* design of Linux Crypto API.
*/
static struct dcp *global_sdcp;
-static DEFINE_MUTEX(global_mutex);
/* DCP register layout. */
#define MXS_DCP_CTRL 0x00
@@ -482,7 +481,7 @@ static int mxs_dcp_aes_setkey(struct crypto_ablkcipher *tfm, const u8 *key,
static int mxs_dcp_aes_fallback_init(struct crypto_tfm *tfm)
{
- const char *name = tfm->__crt_alg->cra_name;
+ const char *name = crypto_tfm_alg_name(tfm);
const uint32_t flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK;
struct dcp_async_ctx *actx = crypto_tfm_ctx(tfm);
struct crypto_ablkcipher *blk;
@@ -907,60 +906,49 @@ static int mxs_dcp_probe(struct platform_device *pdev)
struct resource *iores;
int dcp_vmi_irq, dcp_irq;
- mutex_lock(&global_mutex);
if (global_sdcp) {
dev_err(dev, "Only one DCP instance allowed!\n");
- ret = -ENODEV;
- goto err_mutex;
+ return -ENODEV;
}
iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
dcp_vmi_irq = platform_get_irq(pdev, 0);
- if (dcp_vmi_irq < 0) {
- ret = dcp_vmi_irq;
- goto err_mutex;
- }
+ if (dcp_vmi_irq < 0)
+ return dcp_vmi_irq;
dcp_irq = platform_get_irq(pdev, 1);
- if (dcp_irq < 0) {
- ret = dcp_irq;
- goto err_mutex;
- }
+ if (dcp_irq < 0)
+ return dcp_irq;
sdcp = devm_kzalloc(dev, sizeof(*sdcp), GFP_KERNEL);
- if (!sdcp) {
- ret = -ENOMEM;
- goto err_mutex;
- }
+ if (!sdcp)
+ return -ENOMEM;
sdcp->dev = dev;
sdcp->base = devm_ioremap_resource(dev, iores);
- if (IS_ERR(sdcp->base)) {
- ret = PTR_ERR(sdcp->base);
- goto err_mutex;
- }
+ if (IS_ERR(sdcp->base))
+ return PTR_ERR(sdcp->base);
+
ret = devm_request_irq(dev, dcp_vmi_irq, mxs_dcp_irq, 0,
"dcp-vmi-irq", sdcp);
if (ret) {
dev_err(dev, "Failed to claim DCP VMI IRQ!\n");
- goto err_mutex;
+ return ret;
}
ret = devm_request_irq(dev, dcp_irq, mxs_dcp_irq, 0,
"dcp-irq", sdcp);
if (ret) {
dev_err(dev, "Failed to claim DCP IRQ!\n");
- goto err_mutex;
+ return ret;
}
/* Allocate coherent helper block. */
sdcp->coh = devm_kzalloc(dev, sizeof(*sdcp->coh) + DCP_ALIGNMENT,
GFP_KERNEL);
- if (!sdcp->coh) {
- ret = -ENOMEM;
- goto err_mutex;
- }
+ if (!sdcp->coh)
+ return -ENOMEM;
/* Re-align the structure so it fits the DCP constraints. */
sdcp->coh = PTR_ALIGN(sdcp->coh, DCP_ALIGNMENT);
@@ -968,7 +956,7 @@ static int mxs_dcp_probe(struct platform_device *pdev)
/* Restart the DCP block. */
ret = stmp_reset_block(sdcp->base);
if (ret)
- goto err_mutex;
+ return ret;
/* Initialize control register. */
writel(MXS_DCP_CTRL_GATHER_RESIDUAL_WRITES |
@@ -1006,8 +994,7 @@ static int mxs_dcp_probe(struct platform_device *pdev)
NULL, "mxs_dcp_chan/sha");
if (IS_ERR(sdcp->thread[DCP_CHAN_HASH_SHA])) {
dev_err(dev, "Error starting SHA thread!\n");
- ret = PTR_ERR(sdcp->thread[DCP_CHAN_HASH_SHA]);
- goto err_mutex;
+ return PTR_ERR(sdcp->thread[DCP_CHAN_HASH_SHA]);
}
sdcp->thread[DCP_CHAN_CRYPTO] = kthread_run(dcp_chan_thread_aes,
@@ -1064,9 +1051,6 @@ err_destroy_aes_thread:
err_destroy_sha_thread:
kthread_stop(sdcp->thread[DCP_CHAN_HASH_SHA]);
-
-err_mutex:
- mutex_unlock(&global_mutex);
return ret;
}
@@ -1088,9 +1072,7 @@ static int mxs_dcp_remove(struct platform_device *pdev)
platform_set_drvdata(pdev, NULL);
- mutex_lock(&global_mutex);
global_sdcp = NULL;
- mutex_unlock(&global_mutex);
return 0;
}
OpenPOWER on IntegriCloud