2021-04-09 09:07:24

by yekai (A)

[permalink] [raw]
Subject: [PATCH v3 0/5] bug fix and clear coding style

Fixup coding style such as delete unneeded variable
initialization. Add a comment for block size initialization.
Add a data cleared operation in sg buf unmap, and other misc fix.

v1 -> v2:
1. fix [PATCH v2] error in v1.
2. v1 use a macro replace of magic number, v2 use a comment
for block size initialization.
v2 -> v3:
fix a sparse warning

Kai Ye (5):
crypto: hisilicon/sgl - add a comment for block size initialization
crypto: hisilicon/sgl - delete unneeded variable initialization
crypto: hisilicon/sgl - add some dfx logs
crypto: hisilicon/sgl - fix the soft sg map to hardware sg
crypto: hisilicon/sgl - fix the sg buf unmap

drivers/crypto/hisilicon/sgl.c | 37 +++++++++++++++++++++++++++++++------
1 file changed, 31 insertions(+), 6 deletions(-)

--
2.8.1


2021-04-09 09:07:43

by yekai (A)

[permalink] [raw]
Subject: [PATCH v3 1/5] crypto: hisilicon/sgl - add a comment for block size initialization

This seems "32" and "31" is obfuscating, It might be better to add a comment,
which explain it.

Signed-off-by: Kai Ye <[email protected]>
---
drivers/crypto/hisilicon/sgl.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/crypto/hisilicon/sgl.c b/drivers/crypto/hisilicon/sgl.c
index 3bff639..cf1629c 100644
--- a/drivers/crypto/hisilicon/sgl.c
+++ b/drivers/crypto/hisilicon/sgl.c
@@ -66,6 +66,11 @@ struct hisi_acc_sgl_pool *hisi_acc_create_sgl_pool(struct device *dev,

sgl_size = sizeof(struct acc_hw_sge) * sge_nr +
sizeof(struct hisi_acc_hw_sgl);
+
+ /*
+ * the pool may allocate a block of memory of size PAGE_SIZE * 2^(MAX_ORDER - 1),
+ * block size may exceed 2^31 on ia64, so the max of block size is 2^31
+ */
block_size = 1 << (PAGE_SHIFT + MAX_ORDER <= 32 ?
PAGE_SHIFT + MAX_ORDER - 1 : 31);
sgl_num_per_block = block_size / sgl_size;
--
2.8.1

2021-04-16 11:44:31

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH v3 0/5] bug fix and clear coding style

On Fri, Apr 09, 2021 at 05:03:59PM +0800, Kai Ye wrote:
> Fixup coding style such as delete unneeded variable
> initialization. Add a comment for block size initialization.
> Add a data cleared operation in sg buf unmap, and other misc fix.
>
> v1 -> v2:
> 1. fix [PATCH v2] error in v1.
> 2. v1 use a macro replace of magic number, v2 use a comment
> for block size initialization.
> v2 -> v3:
> fix a sparse warning
>
> Kai Ye (5):
> crypto: hisilicon/sgl - add a comment for block size initialization
> crypto: hisilicon/sgl - delete unneeded variable initialization
> crypto: hisilicon/sgl - add some dfx logs
> crypto: hisilicon/sgl - fix the soft sg map to hardware sg
> crypto: hisilicon/sgl - fix the sg buf unmap
>
> drivers/crypto/hisilicon/sgl.c | 37 +++++++++++++++++++++++++++++++------
> 1 file changed, 31 insertions(+), 6 deletions(-)

All applied. Thanks.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt