[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230704094208.642-1-youkangren@vivo.com>
Date: Tue, 4 Jul 2023 17:42:07 +0800
From: You Kangren <youkangren@...o.com>
To: Giovanni Cabiddu <giovanni.cabiddu@...el.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>,
Tom Zanussi <tom.zanussi@...ux.intel.com>,
Adam Guerin <adam.guerin@...el.com>,
Damian Muszynski <damian.muszynski@...el.com>,
Srinivas Kerekare <srinivas.kerekare@...el.com>,
"Bruce W. Allan" <bruce.w.allan@...el.com>,
Pingchaox Yang <pingchaox.yang@...el.com>,
Bo Cui <bo.cui@...el.com>, Karen Xiang <karen.xiang@...el.com>,
qat-linux@...el.com (open list:QAT DRIVER),
linux-crypto@...r.kernel.org (open list:CRYPTO API),
linux-kernel@...r.kernel.org (open list)
Cc: opensource.kernel@...o.com, youkangren@...o.com,
luhongfei@...o.com,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: [PATCH v5] crypto: qat - Replace the if statement with min()
Mark UWORD_CPYBUF_SIZE with U suffix to make its type the same with
words_num and replace the if statement with min() in
qat_uclo_wr_uimage_raw_page() to make code shorter.
Fixes: b4b7e67c917f ("crypto: qat - Intel(R) QAT ucode part of fw loader")
Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Signed-off-by: You Kangren <youkangren@...o.com>
---
Changelog:
v4->v5:
- Add the Fixes and Reviewed-by tags of the patch
- Add the version update information of the patch
v3->v4:
- Remove the header file <linux/minmax.h> in v3
v2->v3:
- Add a header file <linux/minmax.h>
- Mark UWORD_CPYBUF_SIZE with U suffix
- Change min_t() to min() in qat_uclo_wr_uimage_raw_page()
v1->v2:
- Change min() to min_t() in qat_uclo_wr_uimage_raw_page()
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
Powered by blists - more mailing lists