diff options
author | Tadeusz Struk <tadeusz.struk@intel.com> | 2014-07-25 18:55:57 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2014-08-01 10:36:08 -0400 |
commit | d9a44abf3aede89c3dbb6dfa8a95c856b9ae8da3 (patch) | |
tree | 000c06fc0a7213825a2ab0b3f3a39bc26618e30b /drivers/crypto | |
parent | 689917211cb9d4ca6f90765eeb228ac2727f5dbc (diff) |
crypto: qat - Use hweight for bit counting
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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/qat/qat_common/qat_hal.c | 15 |
1 files 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 8d686a2edde6..9b8a31521ff3 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, | |||
795 | qat_hal_wr_ae_csr(handle, ae, USTORE_ADDRESS, ustore_addr); | 795 | qat_hal_wr_ae_csr(handle, ae, USTORE_ADDRESS, ustore_addr); |
796 | } | 796 | } |
797 | 797 | ||
798 | static int qat_hal_count_bits(unsigned int word) | ||
799 | { | ||
800 | int n = 0; | ||
801 | |||
802 | while (word) { | ||
803 | n++; | ||
804 | word &= word - 1; | ||
805 | } | ||
806 | return n; | ||
807 | } | ||
808 | |||
809 | void qat_hal_wr_umem(struct icp_qat_fw_loader_handle *handle, | 798 | void qat_hal_wr_umem(struct icp_qat_fw_loader_handle *handle, |
810 | unsigned char ae, unsigned int uaddr, | 799 | unsigned char ae, unsigned int uaddr, |
811 | unsigned int words_num, unsigned int *data) | 800 | unsigned int words_num, unsigned int *data) |
@@ -822,9 +811,9 @@ void qat_hal_wr_umem(struct icp_qat_fw_loader_handle *handle, | |||
822 | ((data[i] & 0xff00) << 2) | | 811 | ((data[i] & 0xff00) << 2) | |
823 | (0x3 << 8) | (data[i] & 0xff); | 812 | (0x3 << 8) | (data[i] & 0xff); |
824 | uwrd_hi = (0xf << 4) | ((data[i] & 0xf0000000) >> 28); | 813 | uwrd_hi = (0xf << 4) | ((data[i] & 0xf0000000) >> 28); |
825 | uwrd_hi |= (qat_hal_count_bits(data[i] & 0xffff) & 0x1) << 8; | 814 | uwrd_hi |= (hweight32(data[i] & 0xffff) & 0x1) << 8; |
826 | tmp = ((data[i] >> 0x10) & 0xffff); | 815 | tmp = ((data[i] >> 0x10) & 0xffff); |
827 | uwrd_hi |= (qat_hal_count_bits(tmp) & 0x1) << 9; | 816 | uwrd_hi |= (hweight32(tmp) & 0x1) << 9; |
828 | qat_hal_wr_ae_csr(handle, ae, USTORE_DATA_LOWER, uwrd_lo); | 817 | qat_hal_wr_ae_csr(handle, ae, USTORE_DATA_LOWER, uwrd_lo); |
829 | qat_hal_wr_ae_csr(handle, ae, USTORE_DATA_UPPER, uwrd_hi); | 818 | qat_hal_wr_ae_csr(handle, ae, USTORE_DATA_UPPER, uwrd_hi); |
830 | } | 819 | } |