From: Tadeusz Struk <tadeusz.struk@intel.com>
To: <herbert@gondor.apana.org.au>
Cc: <tadeusz.struk@intel.com>, <davem@davemloft.net>,
<bruce.w.allan@intel.com>, <bo.cui@intel.com>,
<pingchao.yang@intel.com>, <qat-linux@intel.com>,
<linux-crypto@vger.kernel.org>
Subject: [PATCH 09/10] crypto: qat: Cleanup - Use hweight for bit counting
Date: Fri, 25 Jul 2014 15:55:57 -0700 [thread overview]
Message-ID: <20140725225557.24909.556.stgit@gitlad.jf.intel.com> (raw)
In-Reply-To: <20140725225410.24909.56360.stgit@gitlad.jf.intel.com>
Use predefined hweight32 function instead of writing a new one.
Signed-off-by: Pingchao Yang <pingchao.yang@intel.com>
Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
---
drivers/crypto/qat/qat_common/qat_hal.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/drivers/crypto/qat/qat_common/qat_hal.c b/drivers/crypto/qat/qat_common/qat_hal.c
index 8d686a2..9b8a315 100644
--- a/drivers/crypto/qat/qat_common/qat_hal.c
+++ b/drivers/crypto/qat/qat_common/qat_hal.c
@@ -795,17 +795,6 @@ static void qat_hal_get_uwords(struct icp_qat_fw_loader_handle *handle,
qat_hal_wr_ae_csr(handle, ae, USTORE_ADDRESS, ustore_addr);
}
-static int qat_hal_count_bits(unsigned int word)
-{
- int n = 0;
-
- while (word) {
- n++;
- word &= word - 1;
- }
- return n;
-}
-
void qat_hal_wr_umem(struct icp_qat_fw_loader_handle *handle,
unsigned char ae, unsigned int uaddr,
unsigned int words_num, unsigned int *data)
@@ -822,9 +811,9 @@ void qat_hal_wr_umem(struct icp_qat_fw_loader_handle *handle,
((data[i] & 0xff00) << 2) |
(0x3 << 8) | (data[i] & 0xff);
uwrd_hi = (0xf << 4) | ((data[i] & 0xf0000000) >> 28);
- uwrd_hi |= (qat_hal_count_bits(data[i] & 0xffff) & 0x1) << 8;
+ uwrd_hi |= (hweight32(data[i] & 0xffff) & 0x1) << 8;
tmp = ((data[i] >> 0x10) & 0xffff);
- uwrd_hi |= (qat_hal_count_bits(tmp) & 0x1) << 9;
+ uwrd_hi |= (hweight32(tmp) & 0x1) << 9;
qat_hal_wr_ae_csr(handle, ae, USTORE_DATA_LOWER, uwrd_lo);
qat_hal_wr_ae_csr(handle, ae, USTORE_DATA_UPPER, uwrd_hi);
}
next prev parent reply other threads:[~2014-07-25 22:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-25 22:55 [PATCH 00/10] crypto: qat: Checkpatch and other cleanups plus SKU1 Tadeusz Struk
2014-07-25 22:55 ` [PATCH 01/10] crypto: qat: Cleanup - remove unnecessary return codes Tadeusz Struk
2014-07-25 22:55 ` [PATCH 02/10] crypto: qat: Cleanup - checkpatch blank lines Tadeusz Struk
2014-07-25 22:55 ` [PATCH 03/10] crypto: qat: Cleanup - remove unneeded header Tadeusz Struk
2014-07-25 22:55 ` [PATCH 04/10] crypto: qat: Cleanup - remove unnecessary parentheses Tadeusz Struk
2014-07-25 22:55 ` [PATCH 05/10] crypto: qat: Cleanup - use min_t macro Tadeusz Struk
2014-07-25 22:55 ` [PATCH 06/10] crypto: qat: Cleanup - change slice->regions to slice->region Tadeusz Struk
2014-07-25 22:55 ` [PATCH 07/10] crypto: qat: Cleanup - change ae_num to ae_id Tadeusz Struk
2014-07-25 22:55 ` [PATCH 08/10] crypto: qat: Cleanup - Updated print outputs Tadeusz Struk
2014-07-25 22:55 ` Tadeusz Struk [this message]
2014-07-25 22:56 ` [PATCH 10/10] crypto: qat: Fixed SKU1 dev issue Tadeusz Struk
2014-08-01 14:39 ` [PATCH 00/10] crypto: qat: Checkpatch and other cleanups plus SKU1 Herbert Xu
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=20140725225557.24909.556.stgit@gitlad.jf.intel.com \
--to=tadeusz.struk@intel.com \
--cc=bo.cui@intel.com \
--cc=bruce.w.allan@intel.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=pingchao.yang@intel.com \
--cc=qat-linux@intel.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;
as well as URLs for NNTP newsgroup(s).