This commit replaces GetUInt32 with inline function renaming
it to get_uint32.

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

diff --git a/drivers/staging/ks7010/michael_mic.c 
b/drivers/staging/ks7010/michael_mic.c
index 9de31b4..6829cb5 100644
--- a/drivers/staging/ks7010/michael_mic.c
+++ b/drivers/staging/ks7010/michael_mic.c
@@ -15,8 +15,11 @@
 #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))
+static inline u32 get_uint32(const u8 *buf, u8 pos)
+{
+       return (u32)((buf[pos] << 0) + (buf[pos + 1] << 8) +
+                    (buf[pos + 2] << 16) + (buf[pos + 3] << 24));
+}
 
 // Convert from UInt32 to Byte[] in a portable way
 static inline void put_uint32(u8 *dst, u8 pos, u32 orig)
@@ -38,8 +41,8 @@ static inline void michael_clear(struct michael_mic_t *mic)
 static void michael_init(struct michael_mic_t *mic, uint8_t *key)
 {
        // Set the key
-       mic->k0 = getUInt32(key, 0);
-       mic->k1 = getUInt32(key, 4);
+       mic->k0 = get_uint32(key, 0);
+       mic->k1 = get_uint32(key, 4);
 
        //clear();
        michael_clear(mic);
@@ -73,13 +76,13 @@ static void michael_append(struct michael_mic_t *mic, 
uint8_t *src, int bytes)
                if (mic->m_bytes < 4)
                        return;
 
-               mic->l ^= getUInt32(mic->m, 0);
+               mic->l ^= get_uint32(mic->m, 0);
                MichaelBlockFunction(mic->l, mic->r);
                mic->m_bytes = 0;
        }
 
        while (bytes >= 4) {
-               mic->l ^= getUInt32(src, 0);
+               mic->l ^= get_uint32(src, 0);
                MichaelBlockFunction(mic->l, mic->r);
                src += 4;
                bytes -= 4;
-- 
2.7.4

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

Reply via email to