summaryrefslogtreecommitdiffstats
path: root/include/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/common.h')
-rw-r--r--include/common.h87
1 files changed, 1 insertions, 86 deletions
diff --git a/include/common.h b/include/common.h
index c9fe38656e..c1bdaeccaa 100644
--- a/include/common.h
+++ b/include/common.h
@@ -23,6 +23,7 @@ typedef volatile unsigned char vu_char;
#include <linux/stringify.h>
#include <asm/ptrace.h>
#include <stdarg.h>
+#include <linux/kernel.h>
#if defined(CONFIG_PCI) && defined(CONFIG_4xx)
#include <pci.h>
#endif
@@ -168,58 +169,6 @@ typedef void (interrupt_handler_t)(void *);
# endif
#endif
-/*
- * General Purpose Utilities
- */
-#define min(X, Y) \
- ({ typeof(X) __x = (X); \
- typeof(Y) __y = (Y); \
- (__x < __y) ? __x : __y; })
-
-#define max(X, Y) \
- ({ typeof(X) __x = (X); \
- typeof(Y) __y = (Y); \
- (__x > __y) ? __x : __y; })
-
-#define min3(X, Y, Z) \
- ({ typeof(X) __x = (X); \
- typeof(Y) __y = (Y); \
- typeof(Z) __z = (Z); \
- __x < __y ? (__x < __z ? __x : __z) : \
- (__y < __z ? __y : __z); })
-
-#define max3(X, Y, Z) \
- ({ typeof(X) __x = (X); \
- typeof(Y) __y = (Y); \
- typeof(Z) __z = (Z); \
- __x > __y ? (__x > __z ? __x : __z) : \
- (__y > __z ? __y : __z); })
-
-/*
- * Return the absolute value of a number.
- *
- * This handles unsigned and signed longs, ints, shorts and chars. For all
- * input types abs() returns a signed long.
- *
- * For 64-bit types, use abs64()
- */
-#define abs(x) ({ \
- long ret; \
- if (sizeof(x) == sizeof(long)) { \
- long __x = (x); \
- ret = (__x < 0) ? -__x : __x; \
- } else { \
- int __x = (x); \
- ret = (__x < 0) ? -__x : __x; \
- } \
- ret; \
- })
-
-#define abs64(x) ({ \
- s64 __x = (x); \
- (__x < 0) ? -__x : __x; \
- })
-
#if defined(CONFIG_ENV_IS_EMBEDDED)
#define TOTAL_MALLOC_LEN CONFIG_SYS_MALLOC_LEN
#elif ( ((CONFIG_ENV_ADDR+CONFIG_ENV_SIZE) < CONFIG_SYS_MONITOR_BASE) || \
@@ -230,17 +179,6 @@ typedef void (interrupt_handler_t)(void *);
#define TOTAL_MALLOC_LEN CONFIG_SYS_MALLOC_LEN
#endif
-/**
- * container_of - cast a member of a structure out to the containing structure
- * @ptr: the pointer to the member.
- * @type: the type of the container struct this is embedded in.
- * @member: the name of the member within the struct.
- *
- */
-#define container_of(ptr, type, member) ({ \
- const typeof( ((type *)0)->member ) *__mptr = (ptr); \
- (type *)( (char *)__mptr - offsetof(type,member) );})
-
/*
* Function Prototypes
*/
@@ -947,30 +885,7 @@ static inline phys_addr_t map_to_sysmem(const void *ptr)
#error Read section CONFIG_SKIP_LOWLEVEL_INIT in README.
#endif
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-
#define ROUND(a,b) (((a) + (b) - 1) & ~((b) - 1))
-#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
-#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (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)( \
-{ \
- 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)); \
-} \
-)
-
-#define ALIGN(x,a) __ALIGN_MASK((x),(typeof(x))(a)-1)
-#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
/*
* ARCH_DMA_MINALIGN is defined in asm/cache.h for each architecture. It
OpenPOWER on IntegriCloud