From b4a9a8a065b426ab80da69bdec67295f471feac1 Mon Sep 17 00:00:00 2001
From: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Date: Thu, 23 Feb 2012 17:14:36 +0100
Subject: [PATCH 182/291] cryptodev: Revert

This reverts commit b756e5aceb89d45f98f314374fc5e914acae79de.
---
 drivers/staging/crypto/cryptodev/NEWS       |  2 --
 drivers/staging/crypto/cryptodev/cryptlib.c | 26 +++-----------------------
 2 files changed, 3 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/crypto/cryptodev/NEWS b/drivers/staging/crypto/cryptodev/NEWS
index 72defed2ef2a..7ccc3bffc22f 100644
--- a/drivers/staging/crypto/cryptodev/NEWS
+++ b/drivers/staging/crypto/cryptodev/NEWS
@@ -9,8 +9,6 @@ flag unconditionally.
 * Added COP_FLAG_RESET to allow resetting the state
 in multi-update.
 
-* Added mv_cesa driver hack.
-
 
 Version 1.1 (released 2012-02-20)
 
diff --git a/drivers/staging/crypto/cryptodev/cryptlib.c b/drivers/staging/crypto/cryptodev/cryptlib.c
index 98466a3198ac..4bd073ab88c5 100644
--- a/drivers/staging/crypto/cryptodev/cryptlib.c
+++ b/drivers/staging/crypto/cryptodev/cryptlib.c
@@ -30,7 +30,6 @@
 #include <linux/random.h>
 #include <linux/scatterlist.h>
 #include <linux/uaccess.h>
-#include <linux/delay.h>
 #include <crypto/algapi.h>
 #include <crypto/hash.h>
 #include <crypto/cryptodev.h>
@@ -40,7 +39,6 @@
 
 struct cryptodev_result {
 	struct completion completion;
-	int wait; /* for buggy drivers, the wait time in ms after completion */
 	int err;
 };
 
@@ -56,10 +54,9 @@ static void cryptodev_complete(struct crypto_async_request *req, int err)
 }
 
 int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
-			  uint8_t *keyp, size_t keylen, int stream, int aead)
+				uint8_t *keyp, size_t keylen, int stream, int aead)
 {
 	int ret;
-	struct crypto_tfm *tfm;
 
 	memset(out, 0, sizeof(*out));
 
@@ -92,7 +89,6 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
 		out->blocksize = crypto_ablkcipher_blocksize(out->async.s);
 		out->ivsize = crypto_ablkcipher_ivsize(out->async.s);
 		out->alignmask = crypto_ablkcipher_alignmask(out->async.s);
-		tfm = crypto_ablkcipher_tfm(out->async.s);
 
 		ret = crypto_ablkcipher_setkey(out->async.s, keyp, keylen);
 	} else {
@@ -106,7 +102,6 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
 		out->blocksize = crypto_aead_blocksize(out->async.as);
 		out->ivsize = crypto_aead_ivsize(out->async.as);
 		out->alignmask = crypto_aead_alignmask(out->async.as);
-		tfm = crypto_aead_tfm(out->async.as);
 
 		ret = crypto_aead_setkey(out->async.as, keyp, keylen);
 	}
@@ -118,7 +113,6 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
 		goto error;
 	}
 
-
 	out->stream = stream;
 	out->aead = aead;
 
@@ -129,12 +123,6 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
 	}
 
 	memset(out->async.result, 0, sizeof(*out->async.result));
-
-	if (tfm != NULL && 
-		(strcmp(crypto_tfm_alg_driver_name(tfm), "mv-ecb-aes") == 0 ||
-		    strcmp(crypto_tfm_alg_driver_name(tfm), "mv-cbc-aes") == 0))
-		out->async.result->wait = 50;
-
 	init_completion(&out->async.result->completion);
 
 	if (aead == 0) {
@@ -213,12 +201,13 @@ static inline int waitfor(struct cryptodev_result *cr, ssize_t ret)
 		 * This is important because otherwise hardware or driver
 		 * might try to access memory which will be freed or reused for
 		 * another request. */
+
 		if (unlikely(cr->err)) {
 			dprintk(0, KERN_ERR, "error from async request: %d\n",
 				cr->err);
 			return cr->err;
 		}
-		msleep(cr->wait);
+
 		break;
 	default:
 		return ret;
@@ -278,7 +267,6 @@ int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name,
 			int hmac_mode, void *mackey, size_t mackeylen)
 {
 	int ret;
-	struct crypto_tfm *tfm;
 
 	hdata->async.s = crypto_alloc_ahash(alg_name, 0, 0);
 	if (unlikely(IS_ERR(hdata->async.s))) {
@@ -298,8 +286,6 @@ int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name,
 			goto error;
 		}
 	}
-	tfm = crypto_ahash_tfm(hdata->async.s);
-
 
 	hdata->digestsize = crypto_ahash_digestsize(hdata->async.s);
 	hdata->alignmask = crypto_ahash_alignmask(hdata->async.s);
@@ -311,12 +297,6 @@ int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name,
 	}
 
 	memset(hdata->async.result, 0, sizeof(*hdata->async.result));
-
-	if (tfm != NULL && 
-		    (strcmp(crypto_tfm_alg_driver_name(tfm), "mv-sha1") == 0 ||
-		    strcmp(crypto_tfm_alg_driver_name(tfm), "mv-hmac-sha1") == 0))
-		hdata->async.result->wait = 50;
-
 	init_completion(&hdata->async.result->completion);
 
 	hdata->async.request = ahash_request_alloc(hdata->async.s, GFP_KERNEL);
-- 
2.1.0

