diff mbox

[v2,1/3] crypto: sahara - avoid needlessly saving and restoring sahara_ctx

Message ID CAOMZO5D-7xEhKyWhL3QDzF23ECLT+Yt=5-mc+ZRfAazZ=QfHEQ@mail.gmail.com (mailing list archive)
State RFC
Delegated to: Herbert Xu
Headers show

Commit Message

Fabio Estevam Feb. 2, 2016, 5:18 p.m. UTC
On Tue, Feb 2, 2016 at 12:43 PM, Herbert Xu <herbert@gondor.apana.org.au> wrote:

> Preferably you shouldn't include the mutex in the exported state
> at all.

Ok, so would it be safe to completely remove the mutex like this?

Thanks
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Herbert Xu Feb. 3, 2016, 11:22 a.m. UTC | #1
On Tue, Feb 02, 2016 at 03:18:47PM -0200, Fabio Estevam wrote:
> On Tue, Feb 2, 2016 at 12:43 PM, Herbert Xu <herbert@gondor.apana.org.au> wrote:
> 
> > Preferably you shouldn't include the mutex in the exported state
> > at all.
> 
> Ok, so would it be safe to completely remove the mutex like this?

Hmm, indeed the mutex seems to be redundant so let's just kill
it.

Thanks,
diff mbox

Patch

--- a/drivers/crypto/sahara.c
+++ b/drivers/crypto/sahara.c
@@ -182,7 +182,6 @@  struct sahara_sha_reqctx {
        u8                      buf[SAHARA_MAX_SHA_BLOCK_SIZE];
        u8                      rembuf[SAHARA_MAX_SHA_BLOCK_SIZE];
        u8                      context[SHA256_DIGEST_SIZE + 4];
-       struct mutex            mutex;
        unsigned int            mode;
        unsigned int            digest_size;
        unsigned int            context_size;
@@ -1096,7 +1095,6 @@  static int sahara_sha_enqueue(struct ahash_request *req, i
        if (!req->nbytes && !last)
                return 0;

-       mutex_lock(&rctx->mutex);
        rctx->last = last;

        if (!rctx->active) {
@@ -1109,7 +1107,6 @@  static int sahara_sha_enqueue(struct ahash_request *req, i
        mutex_unlock(&dev->queue_mutex);

        wake_up_process(dev->kthread);
-       mutex_unlock(&rctx->mutex);

        return ret;
 }
@@ -1137,8 +1134,6 @@  static int sahara_sha_init(struct ahash_request *req)
        rctx->context_size = rctx->digest_size + 4;
        rctx->active = 0;

-       mutex_init(&rctx->mutex);
-
        return 0;
 }