mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-09 03:21:51 +00:00
linux/kernel.h: add typechecking to roundup macro
This commit replaces roundup macro with the one from Linux Kernel. DEFINE_ALIGN_BUFFER must be fixed because typechecking can not be used in this context. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
This commit is contained in:
parent
48c7ea3966
commit
111396ccb9
2 changed files with 8 additions and 3 deletions
|
@ -967,7 +967,7 @@ static inline phys_addr_t map_to_sysmem(const void *ptr)
|
||||||
* Usage of this macro shall be avoided or used with extreme care!
|
* Usage of this macro shall be avoided or used with extreme care!
|
||||||
*/
|
*/
|
||||||
#define DEFINE_ALIGN_BUFFER(type, name, size, align) \
|
#define DEFINE_ALIGN_BUFFER(type, name, size, align) \
|
||||||
static char __##name[roundup(size * sizeof(type), align)] \
|
static char __##name[ALIGN(size * sizeof(type), align)] \
|
||||||
__aligned(align); \
|
__aligned(align); \
|
||||||
\
|
\
|
||||||
static type *name = (type *)__##name
|
static type *name = (type *)__##name
|
||||||
|
|
|
@ -61,8 +61,13 @@
|
||||||
# define DIV_ROUND_UP_SECTOR_T(ll,d) DIV_ROUND_UP(ll,d)
|
# define DIV_ROUND_UP_SECTOR_T(ll,d) DIV_ROUND_UP(ll,d)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
|
/* The `const' in roundup() prevents gcc-3.3 from calling __divdi3 */
|
||||||
|
#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); \
|
typeof(x) __x = (x); \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue