linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4] crypto: qat - Replace the if statement with min()
@ 2023-07-04  6:56 You Kangren
  2023-07-04  7:15 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: You Kangren @ 2023-07-04  6:56 UTC (permalink / raw)
  To: Giovanni Cabiddu, Herbert Xu, David S. Miller, Damian Muszynski,
	Adam Guerin, Andy Shevchenko, You Kangren, Tom Zanussi,
	Srinivas Kerekare, open list:QAT DRIVER, open list:CRYPTO API,
	open list
  Cc: opensource.kernel, luhongfei

mark UWORD_CPYBUF_SIZE with U suffix to make the type the same with
words_num and replace the if statement with min() in 
qat_uclo_wr_uimage_raw_page() to make code shorter

Signed-off-by: You Kangren <youkangren@vivo.com>
---
 drivers/crypto/intel/qat/qat_common/qat_uclo.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/crypto/intel/qat/qat_common/qat_uclo.c b/drivers/crypto/intel/qat/qat_common/qat_uclo.c
index ce837bcc1cab..4bd150d1441a 100644
--- a/drivers/crypto/intel/qat/qat_common/qat_uclo.c
+++ b/drivers/crypto/intel/qat/qat_common/qat_uclo.c
@@ -11,7 +11,7 @@
 #include "icp_qat_hal.h"
 #include "icp_qat_fw_loader_handle.h"
 
-#define UWORD_CPYBUF_SIZE 1024
+#define UWORD_CPYBUF_SIZE 1024U
 #define INVLD_UWORD 0xffffffffffull
 #define PID_MINOR_REV 0xf
 #define PID_MAJOR_REV (0xf << 4)
@@ -1986,10 +1986,7 @@ static void qat_uclo_wr_uimage_raw_page(struct icp_qat_fw_loader_handle *handle,
 	uw_relative_addr = 0;
 	words_num = encap_page->micro_words_num;
 	while (words_num) {
-		if (words_num < UWORD_CPYBUF_SIZE)
-			cpylen = words_num;
-		else
-			cpylen = UWORD_CPYBUF_SIZE;
+		cpylen = min(words_num, UWORD_CPYBUF_SIZE);
 
 		/* load the buffer */
 		for (i = 0; i < cpylen; i++)
-- 
2.39.0


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

* Re: [PATCH v4] crypto: qat - Replace the if statement with min()
  2023-07-04  6:56 [PATCH v4] crypto: qat - Replace the if statement with min() You Kangren
@ 2023-07-04  7:15 ` Andy Shevchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2023-07-04  7:15 UTC (permalink / raw)
  To: You Kangren
  Cc: Giovanni Cabiddu, Herbert Xu, David S. Miller, Damian Muszynski,
	Adam Guerin, Tom Zanussi, Srinivas Kerekare, open list:QAT DRIVER,
	open list:CRYPTO API, open list, opensource.kernel, luhongfei

On Tue, Jul 04, 2023 at 02:56:39PM +0800, You Kangren wrote:
> mark UWORD_CPYBUF_SIZE with U suffix to make the type the same with

You need to respect English grammar and punctuation.
Here should be

  Mark...

> words_num and replace the if statement with min() in 

(drop trailing space)

> qat_uclo_wr_uimage_raw_page() to make code shorter

...and here the period is missing.

Also, Haven't I given my tag? Why it's not added?

> Signed-off-by: You Kangren <youkangren@vivo.com>
> ---

Where is the changelog from v3? What had been changed so far?

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v4] crypto: qat - Replace the if statement with min()
       [not found] <PUZPR06MB5936BE4F5D5353CF2A08A07BAA2EA@PUZPR06MB5936.apcprd06.prod.outlook.com>
@ 2023-07-04  7:55 ` Andy Shevchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2023-07-04  7:55 UTC (permalink / raw)
  To: 尤康仁
  Cc: Giovanni Cabiddu, Herbert Xu, David S. Miller, Damian Muszynski,
	Adam Guerin, Tom Zanussi, Srinivas Kerekare, open list:QAT DRIVER,
	open list:CRYPTO API, open list, opensource.kernel,
	路红飞

On Tue, Jul 04, 2023 at 07:45:42AM +0000, 尤康仁 wrote:
> Hi Andy,
> 
> Can you tell me what is your tag? I haven't found it in Re: [PATCH v3]
> crypto: qat - Replace the if statement with min()

Please, avoid top-postings.

Tag in this case is the line started with Reviewed-by:.

Please, read this [1] to get familiar with the tags and process.
And be respectful to the reviewers in the future.

[1]: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#using-reported-by-tested-by-reviewed-by-suggested-by-and-fixes

> -----Original email-----
> On Tue, Jul 04, 2023 at 02:56:39PM +0800, You Kangren wrote:
> > mark UWORD_CPYBUF_SIZE with U suffix to make the type the same with
> 
> You need to respect English grammar and punctuation.
> Here should be
> 
>   Mark...
> 
> > words_num and replace the if statement with min() in
> 
> (drop trailing space)
> 
> > qat_uclo_wr_uimage_raw_page() to make code shorter
> 
> ...and here the period is missing.
> 
> Also, Haven't I given my tag? Why it's not added?
> 
> > Signed-off-by: You Kangren <youkangren@vivo.com>
> > ---
> 
> Where is the changelog from v3? What had been changed so far?

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2023-07-04  7:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-04  6:56 [PATCH v4] crypto: qat - Replace the if statement with min() You Kangren
2023-07-04  7:15 ` Andy Shevchenko
     [not found] <PUZPR06MB5936BE4F5D5353CF2A08A07BAA2EA@PUZPR06MB5936.apcprd06.prod.outlook.com>
2023-07-04  7:55 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).