Skip to content

Commit

Permalink
Revert "[TEMP][PATCH] kernel: Fix build all error for tokens introduc…
Browse files Browse the repository at this point in the history
…ing statement expression"

This reverts commit e62dded.
  • Loading branch information
SreekanthPalakurthi committed Sep 11, 2020
1 parent ca94002 commit d5fc5c5
Showing 1 changed file with 35 additions and 23 deletions.
58 changes: 35 additions & 23 deletions include/linux/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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; })
Expand All @@ -133,13 +144,14 @@
# include <asm/div64.h>
# 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

/**
Expand Down

0 comments on commit d5fc5c5

Please sign in to comment.