This commit replaces PutUInt32 macro in favour of inline function
renaming it to put_uint32.

Signed-off-by: Sergio Paracuellos <sergio.paracuel...@gmail.com>
---
 drivers/staging/ks7010/michael_mic.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/ks7010/michael_mic.c 
b/drivers/staging/ks7010/michael_mic.c
index 82ac122..9de31b4 100644
--- a/drivers/staging/ks7010/michael_mic.c
+++ b/drivers/staging/ks7010/michael_mic.c
@@ -19,13 +19,13 @@
                + (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)
+static inline void put_uint32(u8 *dst, u8 pos, u32 orig)
+{
+       dst[pos] = (u8)(orig & 0xff);
+       dst[pos + 1] = (u8)((orig >> 8) & 0xff);
+       dst[pos + 2] = (u8)((orig >> 16) & 0xff);
+       dst[pos + 3] = (u8)((orig >> 24) & 0xff);
+}
 
 // Reset the state to the empty message.
 static inline void michael_clear(struct michael_mic_t *mic)
@@ -113,8 +113,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_uint32(dst, 0, mic->l);
+       put_uint32(dst, 4, mic->r);
 
        // Reset to the empty message.
        michael_clear(mic);
-- 
2.7.4

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to