From patchwork Tue Feb 2 17:18:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 8191971 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C076EBEEE5 for ; Tue, 2 Feb 2016 17:18:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ED98D20260 for ; Tue, 2 Feb 2016 17:18:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E858B2025A for ; Tue, 2 Feb 2016 17:18:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932649AbcBBRSt (ORCPT ); Tue, 2 Feb 2016 12:18:49 -0500 Received: from mail-ig0-f177.google.com ([209.85.213.177]:37675 "EHLO mail-ig0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753038AbcBBRSs (ORCPT ); Tue, 2 Feb 2016 12:18:48 -0500 Received: by mail-ig0-f177.google.com with SMTP id 5so16320473igt.0 for ; Tue, 02 Feb 2016 09:18:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=aul68iLOvh80s55aNRkmNCdXv+muDnMOvyD/KkjoLSU=; b=WGH7c4h+s0xRw9VvAKvNnh8dEkFRJkFgYs9WLWi6k7UWZBqbkjXRmMF/LwkyiCD2V3 uU+1YPPD2i6esa4bZblODPT1wh3rHB6GjhHi8VkQAHI/30FBl5wMZe/Gwsl3eT5dzFMu uTB61CTasthLjmpCcOp8GzpRRj7EMLxC0FPwE/XLdgHmEUejtu/FhVSNJiGG64xjSfw8 vJVW6puyAhiqGH/qjFRatf8HJ7GTk0Q1Xh6LiuQPA3qtYBDS0ijQeg1SAwJQ+/R6a/od LO1ZeYFmxSJVW95U7IjqnsUKbSbjKQbmR4UfsolydDY6ipzm6bmlqPQmcugAM8ivl9yd tTYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=aul68iLOvh80s55aNRkmNCdXv+muDnMOvyD/KkjoLSU=; b=QDweZ4tftbwzkJ6hOpg/8I4bzHH/9DpH/IJxWvSS7lFAZy5waaJbQWdZnnPB4jWbHx ak9EPppV3ng6hFwLHKkXF+osWPhv2xSIIva5xLPANWKobcGpoBwK0BgsGoStJTCgSXuz uY96thsPwD5mkqMTFekD3CZ9S2xgXdLATfXK9zbeSmuC5N0qm6Hyu8hFXS0sxQ8Ywb4y tjpfvuusFtf0jE/5hLu5lLfwqjDTX2MNJ9pJxj2Zo74CAY9QS+FT2Z1owamrcGtzoD3M UVgo0B6Koct2lFOYrhI2iXLmjqs5HI9OZYz9Bt2RQjVKjut1a4mRBWYn0kpOeK444h+8 0h0A== X-Gm-Message-State: AG10YOQlGJlDOTtMi9FB0aBUpVHaInf7jnEIIf9N2H4gbgEXyp5XvuTsNw0F3DygKTdxFRfiuN3SaYjSnwtv2Q== MIME-Version: 1.0 X-Received: by 10.50.36.35 with SMTP id n3mr17081021igj.73.1454433527779; Tue, 02 Feb 2016 09:18:47 -0800 (PST) Received: by 10.79.67.2 with HTTP; Tue, 2 Feb 2016 09:18:47 -0800 (PST) In-Reply-To: <20160202144309.GA17909@gondor.apana.org.au> References: <1452707524-7695-1-git-send-email-festevam@gmail.com> <20160125140728.GA8414@gondor.apana.org.au> <20160202144309.GA17909@gondor.apana.org.au> Date: Tue, 2 Feb 2016 15:18:47 -0200 Message-ID: Subject: Re: [PATCH v2 1/3] crypto: sahara - avoid needlessly saving and restoring sahara_ctx From: Fabio Estevam To: Herbert Xu Cc: =?UTF-8?B?TWFyZWsgVmHFoXV0?= , Steffen Trumtrar , Tom Lendacky , Russell King , linux-crypto@vger.kernel.org, Fabio Estevam Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Feb 2, 2016 at 12:43 PM, Herbert Xu 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 --- 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; }