Re: Resend: [PATCH] CRYPTO: atmel_sha: remove unused shash fallback instance

2014-12-22 Thread Herbert Xu
On Fri, Dec 05, 2014 at 01:18:57AM +0100, Svenning Sørensen wrote:
 [Sorry about the messed up tabs and line wraps in first post;
 I hope I managed to tame TB this time around]
 
 CRYPTO: atmel_sha: remove unused shash fallback instance.
 
 The fallback is never used, so there is no point in having it.
 
 The cra_exit routine can also be removed, since all it did was releasing
 the fallback, along with the stub around cra_init, which just added an
 unused NULL argument.
 
 Signed-off-by: Svenning Soerensen s...@secomea.com

Patch applied.
-- 
Email: Herbert Xu herb...@gondor.apana.org.au
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Resend: [PATCH] CRYPTO: atmel_sha: remove unused shash fallback instance

2014-12-04 Thread Svenning Sørensen
[Sorry about the messed up tabs and line wraps in first post;
I hope I managed to tame TB this time around]

CRYPTO: atmel_sha: remove unused shash fallback instance.

The fallback is never used, so there is no point in having it.

The cra_exit routine can also be removed, since all it did was releasing
the fallback, along with the stub around cra_init, which just added an
unused NULL argument.

Signed-off-by: Svenning Soerensen s...@secomea.com

diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c
index 9a4f69e..6ed3530 100644
--- a/drivers/crypto/atmel-sha.c
+++ b/drivers/crypto/atmel-sha.c
@@ -102,10 +102,6 @@ struct atmel_sha_ctx {
struct atmel_sha_dev*dd;
 
unsigned long   flags;
-
-   /* fallback stuff */
-   struct crypto_shash *fallback;
-
 };
 
 #define ATMEL_SHA_QUEUE_LENGTH 50
@@ -974,19 +970,8 @@ static int atmel_sha_digest(struct ahash_request *req)
return atmel_sha_init(req) ?: atmel_sha_finup(req);
 }
 
-static int atmel_sha_cra_init_alg(struct crypto_tfm *tfm, const char *alg_base)
+static int atmel_sha_cra_init(struct crypto_tfm *tfm)
 {
-   struct atmel_sha_ctx *tctx = crypto_tfm_ctx(tfm);
-   const char *alg_name = crypto_tfm_alg_name(tfm);
-
-   /* Allocate a fallback and abort if it failed. */
-   tctx-fallback = crypto_alloc_shash(alg_name, 0,
-   CRYPTO_ALG_NEED_FALLBACK);
-   if (IS_ERR(tctx-fallback)) {
-   pr_err(atmel-sha: fallback driver '%s' could not be loaded.\n,
-   alg_name);
-   return PTR_ERR(tctx-fallback);
-   }
crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
 sizeof(struct atmel_sha_reqctx) +
 SHA_BUFFER_LEN + SHA512_BLOCK_SIZE);
@@ -994,19 +979,6 @@ static int atmel_sha_cra_init_alg(struct crypto_tfm *tfm, 
const char *alg_base)
return 0;
 }
 
-static int atmel_sha_cra_init(struct crypto_tfm *tfm)
-{
-   return atmel_sha_cra_init_alg(tfm, NULL);
-}
-
-static void atmel_sha_cra_exit(struct crypto_tfm *tfm)
-{
-   struct atmel_sha_ctx *tctx = crypto_tfm_ctx(tfm);
-
-   crypto_free_shash(tctx-fallback);
-   tctx-fallback = NULL;
-}
-
 static struct ahash_alg sha_1_256_algs[] = {
 {
.init   = atmel_sha_init,
@@ -1020,14 +992,12 @@ static struct ahash_alg sha_1_256_algs[] = {
.cra_name   = sha1,
.cra_driver_name= atmel-sha1,
.cra_priority   = 100,
-   .cra_flags  = CRYPTO_ALG_ASYNC |
-   CRYPTO_ALG_NEED_FALLBACK,
+   .cra_flags  = CRYPTO_ALG_ASYNC,
.cra_blocksize  = SHA1_BLOCK_SIZE,
.cra_ctxsize= sizeof(struct atmel_sha_ctx),
.cra_alignmask  = 0,
.cra_module = THIS_MODULE,
.cra_init   = atmel_sha_cra_init,
-   .cra_exit   = atmel_sha_cra_exit,
}
}
 },
@@ -1043,14 +1013,12 @@ static struct ahash_alg sha_1_256_algs[] = {
.cra_name   = sha256,
.cra_driver_name= atmel-sha256,
.cra_priority   = 100,
-   .cra_flags  = CRYPTO_ALG_ASYNC |
-   CRYPTO_ALG_NEED_FALLBACK,
+   .cra_flags  = CRYPTO_ALG_ASYNC,
.cra_blocksize  = SHA256_BLOCK_SIZE,
.cra_ctxsize= sizeof(struct atmel_sha_ctx),
.cra_alignmask  = 0,
.cra_module = THIS_MODULE,
.cra_init   = atmel_sha_cra_init,
-   .cra_exit   = atmel_sha_cra_exit,
}
}
 },
@@ -1068,14 +1036,12 @@ static struct ahash_alg sha_224_alg = {
.cra_name   = sha224,
.cra_driver_name= atmel-sha224,
.cra_priority   = 100,
-   .cra_flags  = CRYPTO_ALG_ASYNC |
-   CRYPTO_ALG_NEED_FALLBACK,
+   .cra_flags  = CRYPTO_ALG_ASYNC,
.cra_blocksize  = SHA224_BLOCK_SIZE,
.cra_ctxsize= sizeof(struct atmel_sha_ctx),
.cra_alignmask  = 0,
.cra_module = THIS_MODULE,
.cra_init   = atmel_sha_cra_init,
-   .cra_exit   =