All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: linux-crypto@vger.kernel.org,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S . Miller" <davem@davemloft.net>
Cc: phone-devel@vger.kernel.org, Stefan Hansson <newbyte@disroot.org>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH 07/15 v2] crypto: ux500/hash: Rename and switch type of member
Date: Mon, 25 Jul 2022 16:04:56 +0200	[thread overview]
Message-ID: <20220725140504.2398965-8-linus.walleij@linaro.org> (raw)
In-Reply-To: <20220725140504.2398965-1-linus.walleij@linaro.org>

The "updated" member of the context is very confusing, it
actually means "hw_intialized" so rename it to this and
switch it to a bool so it is clear how this is used.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v1->v2:
- No changes
---
 drivers/crypto/ux500/hash/hash_alg.h  |  4 ++--
 drivers/crypto/ux500/hash/hash_core.c | 14 +++++++-------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/crypto/ux500/hash/hash_alg.h b/drivers/crypto/ux500/hash/hash_alg.h
index 00730c0090ae..d124fd17519f 100644
--- a/drivers/crypto/ux500/hash/hash_alg.h
+++ b/drivers/crypto/ux500/hash/hash_alg.h
@@ -336,12 +336,12 @@ struct hash_ctx {
  * @state:	The state of the current calculations.
  * @dma_mode:	Used in special cases (workaround), e.g. need to change to
  *		cpu mode, if not supported/working in dma mode.
- * @updated:	Indicates if hardware is initialized for new operations.
+ * @hw_initialized: Indicates if hardware is initialized for new operations.
  */
 struct hash_req_ctx {
 	struct hash_state	state;
 	bool			dma_mode;
-	u8			updated;
+	bool			hw_initialized;
 };
 
 /**
diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c
index c9ceaa0b1778..b3649e00184f 100644
--- a/drivers/crypto/ux500/hash/hash_core.c
+++ b/drivers/crypto/ux500/hash/hash_core.c
@@ -449,7 +449,7 @@ static int ux500_hash_init(struct ahash_request *req)
 		ctx->keylen = 0;
 
 	memset(&req_ctx->state, 0, sizeof(struct hash_state));
-	req_ctx->updated = 0;
+	req_ctx->hw_initialized = false;
 	if (hash_mode == HASH_MODE_DMA) {
 		if (req->nbytes < HASH_DMA_ALIGN_SIZE) {
 			req_ctx->dma_mode = false; /* Don't use DMA */
@@ -674,7 +674,7 @@ static int hash_process_data(struct hash_device_data *device_data,
 			break;
 		}
 
-		if (req_ctx->updated) {
+		if (req_ctx->hw_initialized) {
 			ret = hash_resume_state(device_data,
 						&device_data->state);
 			memmove(req_ctx->state.buffer,
@@ -694,7 +694,7 @@ static int hash_process_data(struct hash_device_data *device_data,
 					__func__);
 				goto out;
 			}
-			req_ctx->updated = 1;
+			req_ctx->hw_initialized = true;
 		}
 		/*
 		 * If 'data_buffer' is four byte aligned and
@@ -759,7 +759,7 @@ static int hash_dma_final(struct ahash_request *req)
 	dev_dbg(device_data->dev, "%s: (ctx=0x%lx)!\n", __func__,
 		(unsigned long)ctx);
 
-	if (req_ctx->updated) {
+	if (req_ctx->hw_initialized) {
 		ret = hash_resume_state(device_data, &device_data->state);
 
 		if (ret) {
@@ -794,7 +794,7 @@ static int hash_dma_final(struct ahash_request *req)
 
 		/* Number of bits in last word = (nbytes * 8) % 32 */
 		HASH_SET_NBLW((req->nbytes * 8) % 32);
-		req_ctx->updated = 1;
+		req_ctx->hw_initialized = true;
 	}
 
 	/* Store the nents in the dma struct. */
@@ -857,7 +857,7 @@ static int hash_hw_final(struct ahash_request *req)
 	dev_dbg(device_data->dev, "%s: (ctx=0x%lx)!\n", __func__,
 		(unsigned long)ctx);
 
-	if (req_ctx->updated) {
+	if (req_ctx->hw_initialized) {
 		ret = hash_resume_state(device_data, &device_data->state);
 
 		if (ret) {
@@ -899,7 +899,7 @@ static int hash_hw_final(struct ahash_request *req)
 		goto out;
 	}
 
-	if (!req_ctx->updated) {
+	if (!req_ctx->hw_initialized) {
 		ret = init_hash_hw(device_data, ctx);
 		if (ret) {
 			dev_err(device_data->dev,
-- 
2.36.1


  parent reply	other threads:[~2022-07-25 14:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-25 14:04 [PATCH 00/15 v2] Ux500 hash cleanup Linus Walleij
2022-07-25 14:04 ` [PATCH 01/15 v2] crypto: ux500/hash: Pass ctx to hash_setconfiguration() Linus Walleij
2022-07-25 14:04 ` [PATCH 02/15 v2] crypto: ux500/hash: Get rid of custom device list Linus Walleij
2022-07-25 14:04 ` [PATCH 03/15 v2] crypto: ux500/hash: Pass context to zero message digest Linus Walleij
2022-07-25 14:04 ` [PATCH 04/15 v2] crypto: ux500/hash: Drop custom state save/restore Linus Walleij
2022-07-25 14:04 ` [PATCH 05/15 v2] crypto: ux500/hash: Drop bit index Linus Walleij
2022-07-25 14:04 ` [PATCH 06/15 v2] crypto: ux500/hash: Break while/do instead of if/else Linus Walleij
2022-07-25 14:04 ` Linus Walleij [this message]
2022-07-25 14:04 ` [PATCH 08/15 v2] crypto: ux500/hash: Stop saving/restoring compulsively Linus Walleij
2022-07-25 14:04 ` [PATCH 09/15 v2] crypto: ux500/hash: Get rid of state from request context Linus Walleij
2022-07-25 14:04 ` [PATCH 10/15 v2] crypto: ux500/hash: Implement .export and .import Linus Walleij
2022-07-25 14:05 ` [PATCH 11/15 v2] crypto: ux500/hash: Drop custom uint64 type Linus Walleij
2022-07-25 14:05 ` [PATCH 12/15 v2] crypto: ux500/hash: Drop regulator handling Linus Walleij
2022-07-25 14:05 ` [PATCH 13/15 v2] crypto: ux500/hash: Convert to regmap MMIO Linus Walleij
2022-07-25 14:05 ` [PATCH 14/15 v2] crypto: ux500/hash: Use AMBA core primecell IDs Linus Walleij
2022-07-25 14:05 ` [PATCH 15/15 v2] crypto: ux500/hash: Implement runtime PM Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220725140504.2398965-8-linus.walleij@linaro.org \
    --to=linus.walleij@linaro.org \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=newbyte@disroot.org \
    --cc=phone-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.