This commit replaces MichaelBlockFunction macro with similar inline function renaming it to michael_block. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@xxxxxxxxx> --- drivers/staging/ks7010/michael_mic.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c index 6829cb5..07913d0 100644 --- a/drivers/staging/ks7010/michael_mic.c +++ b/drivers/staging/ks7010/michael_mic.c @@ -48,17 +48,17 @@ static void michael_init(struct michael_mic_t *mic, uint8_t *key) michael_clear(mic); } -#define MichaelBlockFunction(L, R) \ -do { \ - R ^= rol32(L, 17); \ - L += R; \ - R ^= ((L & 0xff00ff00) >> 8) | ((L & 0x00ff00ff) << 8); \ - L += R; \ - R ^= rol32(L, 3); \ - L += R; \ - R ^= ror32(L, 2); \ - L += R; \ -} while (0) +static inline void michael_block(u32 *l, u32 *r) +{ + *r ^= rol32(*l, 17); + *l += *r; + *r ^= ((*l & 0xff00ff00) >> 8) | ((*l & 0x00ff00ff) << 8); + *l += *r; + *r ^= rol32(*l, 3); + *l += *r; + *r ^= ror32(*l, 2); + *l += *r; +} static void michael_append(struct michael_mic_t *mic, uint8_t *src, int bytes) { @@ -77,13 +77,13 @@ static void michael_append(struct michael_mic_t *mic, uint8_t *src, int bytes) return; mic->l ^= get_uint32(mic->m, 0); - MichaelBlockFunction(mic->l, mic->r); + michael_block(&mic->l, &mic->r); mic->m_bytes = 0; } while (bytes >= 4) { mic->l ^= get_uint32(src, 0); - MichaelBlockFunction(mic->l, mic->r); + michael_block(&mic->l, &mic->r); src += 4; bytes -= 4; } @@ -113,8 +113,8 @@ static void michael_get_mic(struct michael_mic_t *mic, uint8_t *dst) 0x5a000000; break; } - MichaelBlockFunction(mic->l, mic->r); - MichaelBlockFunction(mic->l, mic->r); + michael_block(&mic->l, &mic->r); + michael_block(&mic->l, &mic->r); // The appendByte function has already computed the result. put_uint32(dst, 0, mic->l); put_uint32(dst, 4, mic->r); -- 2.7.4 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel