diff mbox series

[1/3] aspeed: Coding Style cleanups on do_hash_operation

Message ID 20210324223846.17407-2-klaus@linux.vnet.ibm.com (mailing list archive)
State New, archived
Headers show
Series aspeed: HACE hash Scatter-Gather support | expand

Commit Message

Klaus Heinrich Kiwi March 24, 2021, 10:38 p.m. UTC
Basically using camelCase for some variables...

Signed-off-by: Klaus Heinrich Kiwi <klaus@linux.vnet.ibm.com>
---
 hw/misc/aspeed_hace.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

Comments

Cédric Le Goater March 24, 2021, 10:57 p.m. UTC | #1
On 3/24/21 11:38 PM, Klaus Heinrich Kiwi wrote:
> Basically using camelCase for some variables...

I don't think CamelCase applies to variables, only types.

  https://qemu.readthedocs.io/en/latest/devel/style.html#variable-naming-conventions

C.

 
> 
> Signed-off-by: Klaus Heinrich Kiwi <klaus@linux.vnet.ibm.com>
> ---
>  hw/misc/aspeed_hace.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/hw/misc/aspeed_hace.c b/hw/misc/aspeed_hace.c
> index 6e5b447a48..93313d2b80 100644
> --- a/hw/misc/aspeed_hace.c
> +++ b/hw/misc/aspeed_hace.c
> @@ -86,24 +86,24 @@ static int hash_algo_lookup(uint32_t mask)
>  
>  static int do_hash_operation(AspeedHACEState *s, int algo)
>  {
> -    hwaddr src, len, dest;
> -    uint8_t *digest_buf = NULL;
> -    size_t digest_len = 0;
> -    char *src_buf;
> +    uint32_t src, len, dest;
> +    uint8_t *digestBuf = NULL;
> +    size_t digestLen = 0;
> +    char *srcBuf;
>      int rc;
>  
>      src = s->regs[R_HASH_SRC];
>      len = s->regs[R_HASH_SRC_LEN];
>      dest = s->regs[R_HASH_DEST];
>  
> -    src_buf = address_space_map(&s->dram_as, src, &len, false,
> -                                MEMTXATTRS_UNSPECIFIED);
> -    if (!src_buf) {
> +    srcBuf = address_space_map(&s->dram_as, src, (hwaddr *) &len,
> +                               false, MEMTXATTRS_UNSPECIFIED);
> +    if (!srcBuf) {
>          qemu_log_mask(LOG_GUEST_ERROR, "%s: failed to map dram\n", __func__);
>          return -EACCES;
>      }
>  
> -    rc = qcrypto_hash_bytes(algo, src_buf, len, &digest_buf, &digest_len,
> +    rc = qcrypto_hash_bytes(algo, srcBuf, len, &digestBuf, &digestLen,
>                              &error_fatal);
>      if (rc < 0) {
>          qemu_log_mask(LOG_GUEST_ERROR, "%s: qcrypto failed\n", __func__);
> @@ -111,14 +111,14 @@ static int do_hash_operation(AspeedHACEState *s, int algo)
>      }
>  
>      rc = address_space_write(&s->dram_as, dest, MEMTXATTRS_UNSPECIFIED,
> -                             digest_buf, digest_len);
> +                             digestBuf, digestLen);
>      if (rc) {
>          qemu_log_mask(LOG_GUEST_ERROR,
>                        "%s: address space write failed\n", __func__);
>      }
> -    g_free(digest_buf);
> +    g_free(digestBuf);
>  
> -    address_space_unmap(&s->dram_as, src_buf, len, false, len);
> +    address_space_unmap(&s->dram_as, srcBuf, len, false, len);
>  
>      /*
>       * Set status bits to indicate completion. Testing shows hardware sets
>
Klaus Heinrich Kiwi March 25, 2021, 12:15 a.m. UTC | #2
Hi Cedric,

On 3/24/2021 7:57 PM, Cédric Le Goater wrote:
> On 3/24/21 11:38 PM, Klaus Heinrich Kiwi wrote:
>> Basically using camelCase for some variables...
> I don't think CamelCase applies to variables, only types.

Thanks, I think I mis-interpreted your comment on this.

Will re-factor the patches with that in mind, but let's see
if there are other comments first.

  -Klaus
diff mbox series

Patch

diff --git a/hw/misc/aspeed_hace.c b/hw/misc/aspeed_hace.c
index 6e5b447a48..93313d2b80 100644
--- a/hw/misc/aspeed_hace.c
+++ b/hw/misc/aspeed_hace.c
@@ -86,24 +86,24 @@  static int hash_algo_lookup(uint32_t mask)
 
 static int do_hash_operation(AspeedHACEState *s, int algo)
 {
-    hwaddr src, len, dest;
-    uint8_t *digest_buf = NULL;
-    size_t digest_len = 0;
-    char *src_buf;
+    uint32_t src, len, dest;
+    uint8_t *digestBuf = NULL;
+    size_t digestLen = 0;
+    char *srcBuf;
     int rc;
 
     src = s->regs[R_HASH_SRC];
     len = s->regs[R_HASH_SRC_LEN];
     dest = s->regs[R_HASH_DEST];
 
-    src_buf = address_space_map(&s->dram_as, src, &len, false,
-                                MEMTXATTRS_UNSPECIFIED);
-    if (!src_buf) {
+    srcBuf = address_space_map(&s->dram_as, src, (hwaddr *) &len,
+                               false, MEMTXATTRS_UNSPECIFIED);
+    if (!srcBuf) {
         qemu_log_mask(LOG_GUEST_ERROR, "%s: failed to map dram\n", __func__);
         return -EACCES;
     }
 
-    rc = qcrypto_hash_bytes(algo, src_buf, len, &digest_buf, &digest_len,
+    rc = qcrypto_hash_bytes(algo, srcBuf, len, &digestBuf, &digestLen,
                             &error_fatal);
     if (rc < 0) {
         qemu_log_mask(LOG_GUEST_ERROR, "%s: qcrypto failed\n", __func__);
@@ -111,14 +111,14 @@  static int do_hash_operation(AspeedHACEState *s, int algo)
     }
 
     rc = address_space_write(&s->dram_as, dest, MEMTXATTRS_UNSPECIFIED,
-                             digest_buf, digest_len);
+                             digestBuf, digestLen);
     if (rc) {
         qemu_log_mask(LOG_GUEST_ERROR,
                       "%s: address space write failed\n", __func__);
     }
-    g_free(digest_buf);
+    g_free(digestBuf);
 
-    address_space_unmap(&s->dram_as, src_buf, len, false, len);
+    address_space_unmap(&s->dram_as, srcBuf, len, false, len);
 
     /*
      * Set status bits to indicate completion. Testing shows hardware sets