diff mbox series

[1/7] crypto: qat - remove spin_lock in qat_ablkcipher_setkey

Message ID 20190429154321.21098-1-giovanni.cabiddu@intel.com (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series [1/7] crypto: qat - remove spin_lock in qat_ablkcipher_setkey | expand

Commit Message

Cabiddu, Giovanni April 29, 2019, 3:43 p.m. UTC
From: Xin Zeng <xin.zeng@intel.com>

Remove unnecessary spin lock in qat_ablkcipher_setkey.

Reviewed-by: Conor Mcloughlin <conor.mcloughlin@intel.com>
Tested-by: Sergey Portnoy <sergey.portnoy@intel.com>
Signed-off-by: Xin Zeng <xin.zeng@intel.com>
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
---
 drivers/crypto/qat/qat_common/qat_algs.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

Comments

Herbert Xu May 23, 2019, 6:50 a.m. UTC | #1
On Mon, Apr 29, 2019 at 04:43:15PM +0100, Giovanni Cabiddu wrote:
> From: Xin Zeng <xin.zeng@intel.com>
> 
> Remove unnecessary spin lock in qat_ablkcipher_setkey.
> 
> Reviewed-by: Conor Mcloughlin <conor.mcloughlin@intel.com>
> Tested-by: Sergey Portnoy <sergey.portnoy@intel.com>
> Signed-off-by: Xin Zeng <xin.zeng@intel.com>
> Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
> ---
>  drivers/crypto/qat/qat_common/qat_algs.c | 16 +++-------------
>  1 file changed, 3 insertions(+), 13 deletions(-)

All applied.  Thanks.
diff mbox series

Patch

diff --git a/drivers/crypto/qat/qat_common/qat_algs.c b/drivers/crypto/qat/qat_common/qat_algs.c
index c8d401646902..413e05e8891e 100644
--- a/drivers/crypto/qat/qat_common/qat_algs.c
+++ b/drivers/crypto/qat/qat_common/qat_algs.c
@@ -131,7 +131,6 @@  struct qat_alg_ablkcipher_ctx {
 	struct icp_qat_fw_la_bulk_req dec_fw_req;
 	struct qat_crypto_instance *inst;
 	struct crypto_tfm *tfm;
-	spinlock_t lock;	/* protects qat_alg_ablkcipher_ctx struct */
 };
 
 static int qat_get_inter_state_size(enum icp_qat_hw_auth_algo qat_hash_alg)
@@ -912,7 +911,6 @@  static int qat_alg_ablkcipher_setkey(struct crypto_ablkcipher *tfm,
 	struct qat_alg_ablkcipher_ctx *ctx = crypto_ablkcipher_ctx(tfm);
 	struct device *dev;
 
-	spin_lock(&ctx->lock);
 	if (ctx->enc_cd) {
 		/* rekeying */
 		dev = &GET_DEV(ctx->inst->accel_dev);
@@ -925,29 +923,22 @@  static int qat_alg_ablkcipher_setkey(struct crypto_ablkcipher *tfm,
 		int node = get_current_node();
 		struct qat_crypto_instance *inst =
 				qat_crypto_get_instance_node(node);
-		if (!inst) {
-			spin_unlock(&ctx->lock);
+		if (!inst)
 			return -EINVAL;
-		}
 
 		dev = &GET_DEV(inst->accel_dev);
 		ctx->inst = inst;
 		ctx->enc_cd = dma_alloc_coherent(dev, sizeof(*ctx->enc_cd),
 						 &ctx->enc_cd_paddr,
 						 GFP_ATOMIC);
-		if (!ctx->enc_cd) {
-			spin_unlock(&ctx->lock);
+		if (!ctx->enc_cd)
 			return -ENOMEM;
-		}
 		ctx->dec_cd = dma_alloc_coherent(dev, sizeof(*ctx->dec_cd),
 						 &ctx->dec_cd_paddr,
 						 GFP_ATOMIC);
-		if (!ctx->dec_cd) {
-			spin_unlock(&ctx->lock);
+		if (!ctx->dec_cd)
 			goto out_free_enc;
-		}
 	}
-	spin_unlock(&ctx->lock);
 	if (qat_alg_ablkcipher_init_sessions(ctx, key, keylen, mode))
 		goto out_free_all;
 
@@ -1119,7 +1110,6 @@  static int qat_alg_ablkcipher_init(struct crypto_tfm *tfm)
 {
 	struct qat_alg_ablkcipher_ctx *ctx = crypto_tfm_ctx(tfm);
 
-	spin_lock_init(&ctx->lock);
 	tfm->crt_ablkcipher.reqsize = sizeof(struct qat_crypto_request);
 	ctx->tfm = tfm;
 	return 0;