All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: testmgr - delete some redundant code
@ 2021-02-23  3:42 Kai Ye
  2021-02-24  6:54 ` Eric Biggers
  2021-03-04  6:44 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Kai Ye @ 2021-02-23  3:42 UTC (permalink / raw)
  To: herbert; +Cc: linux-crypto, linux-kernel

Delete sg_data function, because sg_data function definition same as
sg_virt(), so need to delete it and use sg_virt() replace to sg_data().

Signed-off-by: Kai Ye <yekai13@huawei.com>
---
 crypto/testmgr.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 9335999..e13e73c 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1168,11 +1168,6 @@ static inline int check_shash_op(const char *op, int err,
 	return err;
 }
 
-static inline const void *sg_data(struct scatterlist *sg)
-{
-	return page_address(sg_page(sg)) + sg->offset;
-}
-
 /* Test one hash test vector in one configuration, using the shash API */
 static int test_shash_vec_cfg(const struct hash_testvec *vec,
 			      const char *vec_name,
@@ -1230,7 +1225,7 @@ static int test_shash_vec_cfg(const struct hash_testvec *vec,
 			return 0;
 		if (cfg->nosimd)
 			crypto_disable_simd_for_test();
-		err = crypto_shash_digest(desc, sg_data(&tsgl->sgl[0]),
+		err = crypto_shash_digest(desc, sg_virt(&tsgl->sgl[0]),
 					  tsgl->sgl[0].length, result);
 		if (cfg->nosimd)
 			crypto_reenable_simd_for_test();
@@ -1266,7 +1261,7 @@ static int test_shash_vec_cfg(const struct hash_testvec *vec,
 		    cfg->finalization_type == FINALIZATION_TYPE_FINUP) {
 			if (divs[i]->nosimd)
 				crypto_disable_simd_for_test();
-			err = crypto_shash_finup(desc, sg_data(&tsgl->sgl[i]),
+			err = crypto_shash_finup(desc, sg_virt(&tsgl->sgl[i]),
 						 tsgl->sgl[i].length, result);
 			if (divs[i]->nosimd)
 				crypto_reenable_simd_for_test();
@@ -1278,7 +1273,7 @@ static int test_shash_vec_cfg(const struct hash_testvec *vec,
 		}
 		if (divs[i]->nosimd)
 			crypto_disable_simd_for_test();
-		err = crypto_shash_update(desc, sg_data(&tsgl->sgl[i]),
+		err = crypto_shash_update(desc, sg_virt(&tsgl->sgl[i]),
 					  tsgl->sgl[i].length);
 		if (divs[i]->nosimd)
 			crypto_reenable_simd_for_test();
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] crypto: testmgr - delete some redundant code
  2021-02-23  3:42 [PATCH] crypto: testmgr - delete some redundant code Kai Ye
@ 2021-02-24  6:54 ` Eric Biggers
  2021-03-04  6:44 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Biggers @ 2021-02-24  6:54 UTC (permalink / raw)
  To: Kai Ye; +Cc: herbert, linux-crypto, linux-kernel

On Tue, Feb 23, 2021 at 11:42:04AM +0800, Kai Ye wrote:
> Delete sg_data function, because sg_data function definition same as
> sg_virt(), so need to delete it and use sg_virt() replace to sg_data().
> 
> Signed-off-by: Kai Ye <yekai13@huawei.com>
> ---
>  crypto/testmgr.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/crypto/testmgr.c b/crypto/testmgr.c
> index 9335999..e13e73c 100644
> --- a/crypto/testmgr.c
> +++ b/crypto/testmgr.c
> @@ -1168,11 +1168,6 @@ static inline int check_shash_op(const char *op, int err,
>  	return err;
>  }
>  
> -static inline const void *sg_data(struct scatterlist *sg)
> -{
> -	return page_address(sg_page(sg)) + sg->offset;
> -}
> -
>  /* Test one hash test vector in one configuration, using the shash API */
>  static int test_shash_vec_cfg(const struct hash_testvec *vec,
>  			      const char *vec_name,
> @@ -1230,7 +1225,7 @@ static int test_shash_vec_cfg(const struct hash_testvec *vec,
>  			return 0;
>  		if (cfg->nosimd)
>  			crypto_disable_simd_for_test();
> -		err = crypto_shash_digest(desc, sg_data(&tsgl->sgl[0]),
> +		err = crypto_shash_digest(desc, sg_virt(&tsgl->sgl[0]),
>  					  tsgl->sgl[0].length, result);
>  		if (cfg->nosimd)
>  			crypto_reenable_simd_for_test();
> @@ -1266,7 +1261,7 @@ static int test_shash_vec_cfg(const struct hash_testvec *vec,
>  		    cfg->finalization_type == FINALIZATION_TYPE_FINUP) {
>  			if (divs[i]->nosimd)
>  				crypto_disable_simd_for_test();
> -			err = crypto_shash_finup(desc, sg_data(&tsgl->sgl[i]),
> +			err = crypto_shash_finup(desc, sg_virt(&tsgl->sgl[i]),
>  						 tsgl->sgl[i].length, result);
>  			if (divs[i]->nosimd)
>  				crypto_reenable_simd_for_test();
> @@ -1278,7 +1273,7 @@ static int test_shash_vec_cfg(const struct hash_testvec *vec,
>  		}
>  		if (divs[i]->nosimd)
>  			crypto_disable_simd_for_test();
> -		err = crypto_shash_update(desc, sg_data(&tsgl->sgl[i]),
> +		err = crypto_shash_update(desc, sg_virt(&tsgl->sgl[i]),
>  					  tsgl->sgl[i].length);
>  		if (divs[i]->nosimd)
>  			crypto_reenable_simd_for_test();
> -- 

Looks good,

Reviewed-by: Eric Biggers <ebiggers@google.com>

- Eric

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] crypto: testmgr - delete some redundant code
  2021-02-23  3:42 [PATCH] crypto: testmgr - delete some redundant code Kai Ye
  2021-02-24  6:54 ` Eric Biggers
@ 2021-03-04  6:44 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2021-03-04  6:44 UTC (permalink / raw)
  To: Kai Ye; +Cc: linux-crypto, linux-kernel

On Tue, Feb 23, 2021 at 11:42:04AM +0800, Kai Ye wrote:
> Delete sg_data function, because sg_data function definition same as
> sg_virt(), so need to delete it and use sg_virt() replace to sg_data().
> 
> Signed-off-by: Kai Ye <yekai13@huawei.com>
> ---
>  crypto/testmgr.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-04  6:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-23  3:42 [PATCH] crypto: testmgr - delete some redundant code Kai Ye
2021-02-24  6:54 ` Eric Biggers
2021-03-04  6:44 ` Herbert Xu

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.