From d5fc5c504b3c51dcbf65ca90a42b2ed4b5b2c0c3 Mon Sep 17 00:00:00 2001 From: sreekfreak995 Date: Thu, 10 Sep 2020 22:17:58 +0530 Subject: [PATCH] Revert "[TEMP][PATCH] kernel: Fix build all error for tokens introducing statement expression" This reverts commit e62dded9a013414deeb962fd391b8cb67e5da255. --- include/linux/kernel.h | 58 +++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 85b99a463284..f004177bf4b7 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -54,10 +54,12 @@ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) -#define u64_to_user_ptr(x) ({ \ - typecheck(u64, (x)); \ - (void __user *)(uintptr_t)(x); \ -}) +#define u64_to_user_ptr(x) ( \ +{ \ + typecheck(u64, x); \ + (void __user *)(uintptr_t)x; \ +} \ +) /* * This looks more complex than it should be. But we need to @@ -81,50 +83,59 @@ #endif /* The `const' in roundup() prevents gcc-3.3 from calling __divdi3 */ -#define roundup(x, y) ({ \ +#define roundup(x, y) ( \ +{ \ const typeof(y) __y = y; \ (((x) + (__y - 1)) / __y) * __y; \ -}) - -#define rounddown(x, y) ({ \ +} \ +) +#define rounddown(x, y) ( \ +{ \ typeof(x) __x = (x); \ __x - (__x % (y)); \ -}) +} \ +) /* * Divide positive or negative dividend by positive divisor and round * to closest integer. Result is undefined for negative divisors and * for negative dividends if the divisor variable type is unsigned. */ -#define DIV_ROUND_CLOSEST(x, divisor)({ \ +#define DIV_ROUND_CLOSEST(x, divisor)( \ +{ \ typeof(x) __x = x; \ typeof(divisor) __d = divisor; \ (((typeof(x))-1) > 0 || \ ((typeof(divisor))-1) > 0 || (__x) > 0) ? \ (((__x) + ((__d) / 2)) / (__d)) : \ (((__x) - ((__d) / 2)) / (__d)); \ -}) - +} \ +) /* * Same as above but for u64 dividends. divisor must be a 32-bit * number. */ -#define DIV_ROUND_CLOSEST_ULL(x, divisor)({ \ +#define DIV_ROUND_CLOSEST_ULL(x, divisor)( \ +{ \ typeof(divisor) __d = divisor; \ unsigned long long _tmp = (x) + (__d) / 2; \ do_div(_tmp, __d); \ _tmp; \ -}) +} \ +) /* * Multiplies an integer by a fraction, while avoiding unnecessary * overflow or loss of precision. */ -#define mult_frac(x, numer, denom)({ \ +#define mult_frac(x, numer, denom)( \ +{ \ typeof(x) quot = (x) / (denom); \ typeof(x) rem = (x) % (denom); \ (quot * (numer)) + ((rem * (numer)) / (denom)); \ -}) +} \ +) + #define _RET_IP_ (unsigned long)__builtin_return_address(0) #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) @@ -133,13 +144,14 @@ # include # define sector_div(a, b) do_div(a, b) #else -# define sector_div(n, b)({ \ - int _res; \ - _res = (n) % (b); \ - (n) /= (b); \ - _res; \ -}) - +# define sector_div(n, b)( \ +{ \ + int _res; \ + _res = (n) % (b); \ + (n) /= (b); \ + _res; \ +} \ +) #endif /**