From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: You Kangren <youkangren@vivo.com>
Cc: Giovanni Cabiddu <giovanni.cabiddu@intel.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Adam Guerin <adam.guerin@intel.com>,
Srinivas Kerekare <srinivas.kerekare@intel.com>,
Tom Zanussi <tom.zanussi@linux.intel.com>,
Damian Muszynski <damian.muszynski@intel.com>,
"open list:QAT DRIVER" <qat-linux@intel.com>,
"open list:CRYPTO API" <linux-crypto@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
opensource.kernel@vivo.com
Subject: Re: [PATCH v3] crypto: qat - Replace the if statement with min()
Date: Mon, 3 Jul 2023 16:18:00 +0300 [thread overview]
Message-ID: <ZKLKiJKs7NDXeM7V@smile.fi.intel.com> (raw)
In-Reply-To: <20230703123739.28142-1-youkangren@vivo.com>
On Mon, Jul 03, 2023 at 08:37:36PM +0800, You Kangren wrote:
> mark UWORD_CPYBUF_SIZE with U suffix to make the type the same with
> words_num and replace the if statement with min()
Makes code shorter,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: You Kangren <youkangren@vivo.com>
> ---
> drivers/crypto/intel/qat/qat_common/qat_uclo.c | 8 +++-----
> 1 file changed, 3 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..bad65f154777 100644
> --- a/drivers/crypto/intel/qat/qat_common/qat_uclo.c
> +++ b/drivers/crypto/intel/qat/qat_common/qat_uclo.c
> @@ -5,13 +5,14 @@
> #include <linux/kernel.h>
> #include <linux/delay.h>
> #include <linux/pci_ids.h>
> +#include <linux/minmax.h>
> #include "adf_accel_devices.h"
> #include "adf_common_drv.h"
> #include "icp_qat_uclo.h"
> #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 +1987,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
>
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2023-07-03 13:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-03 12:37 You Kangren
2023-07-03 13:18 ` Andy Shevchenko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZKLKiJKs7NDXeM7V@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=adam.guerin@intel.com \
--cc=damian.muszynski@intel.com \
--cc=davem@davemloft.net \
--cc=giovanni.cabiddu@intel.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=opensource.kernel@vivo.com \
--cc=qat-linux@intel.com \
--cc=srinivas.kerekare@intel.com \
--cc=tom.zanussi@linux.intel.com \
--cc=youkangren@vivo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®