diff options
author | Sergio Paracuellos <sergio.paracuellos@gmail.com> | 2018-03-28 17:24:22 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-03-29 11:49:12 +0200 |
commit | 8da5b3e7f794cce95eb420bf42b65c14886cc85c (patch) | |
tree | 7b5928706d859f6c4acecf4eea0a564e933541da /drivers/staging/ks7010/michael_mic.c | |
parent | 9018154f1bac0a3c30ea9b174d5e7f5e4fd3570c (diff) |
staging: ks7010: replace PutUInt32 macro with put_unaligned_le32()
This commit replaces PutUInt32 custom macro with put_unaligned_le32
function included in the linux kernel.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/ks7010/michael_mic.c')
-rw-r--r-- | drivers/staging/ks7010/michael_mic.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c index 82ac1229001b..79efaf31eefc 100644 --- a/drivers/staging/ks7010/michael_mic.c +++ b/drivers/staging/ks7010/michael_mic.c @@ -12,21 +12,13 @@ #include <linux/types.h> #include <linux/string.h> #include <linux/bitops.h> +#include <asm/unaligned.h> #include "michael_mic.h" // Convert from Byte[] to UInt32 in a portable way #define getUInt32(A, B) ((uint32_t)(A[B + 0] << 0) \ + (A[B + 1] << 8) + (A[B + 2] << 16) + (A[B + 3] << 24)) -// Convert from UInt32 to Byte[] in a portable way -#define putUInt32(A, B, C) \ -do { \ - A[B + 0] = (uint8_t)(C & 0xff); \ - A[B + 1] = (uint8_t)((C >> 8) & 0xff); \ - A[B + 2] = (uint8_t)((C >> 16) & 0xff); \ - A[B + 3] = (uint8_t)((C >> 24) & 0xff); \ -} while (0) - // Reset the state to the empty message. static inline void michael_clear(struct michael_mic_t *mic) { @@ -113,8 +105,8 @@ static void michael_get_mic(struct michael_mic_t *mic, uint8_t *dst) MichaelBlockFunction(mic->l, mic->r); MichaelBlockFunction(mic->l, mic->r); // The appendByte function has already computed the result. - putUInt32(dst, 0, mic->l); - putUInt32(dst, 4, mic->r); + put_unaligned_le32(mic->l, dst); + put_unaligned_le32(mic->r, dst + 4); // Reset to the empty message. michael_clear(mic); |