]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/kernel.h
Merge branch 'drivers-platform' into release
[linux-2.6-omap-h63xx.git] / include / linux / kernel.h
index ca9ff6411dfa778fed80eae8360b6136529f8f11..343df9ef2412393020e90c1ef5227135b3b5a07f 100644 (file)
@@ -48,6 +48,12 @@ extern const char linux_proc_banner[];
 #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
 #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
 #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
+#define DIV_ROUND_CLOSEST(x, divisor)(                 \
+{                                                      \
+       typeof(divisor) __divisor = divisor;            \
+       (((x) + ((__divisor) / 2)) / (__divisor));      \
+}                                                      \
+)
 
 #define _RET_IP_               (unsigned long)__builtin_return_address(0)
 #define _THIS_IP_  ({ __label__ __here; __here: (unsigned long)&&__here; })
@@ -349,13 +355,13 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
         printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
 
 /* If you are writing a driver, please use dev_dbg instead */
-#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG)
+#if defined(DEBUG)
+#define pr_debug(fmt, ...) \
+       printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#elif defined(CONFIG_DYNAMIC_PRINTK_DEBUG)
 #define pr_debug(fmt, ...) do { \
        dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \
        } while (0)
-#elif defined(DEBUG)
-#define pr_debug(fmt, ...) \
-       printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
 #else
 #define pr_debug(fmt, ...) \
        ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
@@ -470,6 +476,12 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
        __val = __val < __min ? __min: __val;   \
        __val > __max ? __max: __val; })
 
+
+/*
+ * swap - swap value of @a and @b
+ */
+#define swap(a, b) ({ typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; })
+
 /**
  * container_of - cast a member of a structure out to the containing structure
  * @ptr:       the pointer to the member.