]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - include/linux/compat.h
nand, atmel: remove udelay in spl_nand_erase_one()
[karo-tx-uboot.git] / include / linux / compat.h
index 7ff6064b187b7b914f27ac8f5e7004a014037130..fbebf910addd994d265d21c4fbaa0a2f48f4ccb1 100644 (file)
@@ -36,10 +36,25 @@ extern struct p_current *current;
 #define KERN_INFO
 #define KERN_DEBUG
 
+#define GFP_ATOMIC ((gfp_t) 0)
+#define GFP_KERNEL ((gfp_t) 0)
+#define GFP_NOFS ((gfp_t) 0)
+#define GFP_USER ((gfp_t) 0)
+#define __GFP_NOWARN ((gfp_t) 0)
+#define __GFP_ZERO     ((__force gfp_t)0x8000u)        /* Return zeroed page on success */
+
 void *kmalloc(size_t size, int flags);
-void *kzalloc(size_t size, int flags);
+
+static inline void *kzalloc(size_t size, gfp_t flags)
+{
+       return kmalloc(size, flags | __GFP_ZERO);
+}
 #define vmalloc(size)  kmalloc(size, 0)
 #define __vmalloc(size, flags, pgsz)   kmalloc(size, flags)
+static inline void *vzalloc(unsigned long size)
+{
+       return kzalloc(size, 0);
+}
 #define kfree(ptr)     free(ptr)
 #define vfree(ptr)     free(ptr)
 
@@ -57,17 +72,6 @@ void *kmem_cache_alloc(struct kmem_cache *obj, int flag);
 
 #define KERNEL_VERSION(a,b,c)  (((a) << 16) + ((b) << 8) + (c))
 
-/*
- * ..and if you can't take the strict
- * types, you can specify one yourself.
- *
- * Or not use min/max at all, of course.
- */
-#define min_t(type,x,y) \
-       ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
-#define max_t(type,x,y) \
-       ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
-
 #ifndef BUG
 #define BUG() do { \
        printf("U-Boot BUG at %s:%d!\n", __FILE__, __LINE__); \
@@ -81,34 +85,9 @@ void *kmem_cache_alloc(struct kmem_cache *obj, int flag);
 
 #define PAGE_SIZE      4096
 
-/**
- * upper_32_bits - return MSB bits 32-63 of a number if little endian, or
- * return MSB bits 0-31 of a number if big endian.
- * @n: the number we're accessing
- *
- * A basic shift-right of a 64- or 32-bit quantity.  Use this to suppress
- * the "right shift count >= width of type" warning when that quantity is
- * 32-bits.
- */
-#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
-
-/**
- * lower_32_bits - return LSB bits 0-31 of a number if little endian, or
- * return LSB bits 32-63 of a number if big endian.
- * @n: the number we're accessing
- */
-#define lower_32_bits(n) ((u32)(n))
-
 /* drivers/char/random.c */
 #define get_random_bytes(...)
 
-/* idr.c */
-#define GFP_ATOMIC ((gfp_t) 0)
-#define GFP_KERNEL ((gfp_t) 0)
-#define GFP_NOFS ((gfp_t) 0)
-#define GFP_USER ((gfp_t) 0)
-#define __GFP_NOWARN ((gfp_t) 0)
-
 /* include/linux/leds.h */
 struct led_trigger {};
 
@@ -152,17 +131,6 @@ typedef unsigned long blkcnt_t;
 
 #define ENOTSUPP       524     /* Operation is not supported */
 
-/* from include/linux/kernel.h */
-/*
- * This looks more complex than it should be. But we need to
- * get the type for the ~ right in round_down (it needs to be
- * as wide as the result!), and we want to evaluate the macro
- * arguments just once each.
- */
-#define __round_mask(x, y) ((__typeof__(x))((y)-1))
-#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
-#define round_down(x, y) ((x) & ~__round_mask(x, y))
-
 /* module */
 #define THIS_MODULE            0
 #define try_module_get(...)    1
@@ -198,18 +166,6 @@ typedef unsigned long blkcnt_t;
 
 #define blocking_notifier_call_chain(...) 0
 
-/*
- * Multiplies an integer by a fraction, while avoiding unnecessary
- * overflow or loss of precision.
- */
-#define mult_frac(x, numer, denom)(                    \
-{                                                      \
-       typeof(x) quot = (x) / (denom);                 \
-       typeof(x) rem  = (x) % (denom);                 \
-       (quot * (numer)) + ((rem * (numer)) / (denom)); \
-}                                                      \
-)
-
 #define __initdata
 #define late_initcall(...)
 
@@ -241,8 +197,6 @@ struct work_struct {};
 unsigned long copy_from_user(void *dest, const void *src,
                             unsigned long count);
 
-void *vzalloc(unsigned long size);
-
 typedef unused_t spinlock_t;
 typedef int    wait_queue_head_t;
 
@@ -267,15 +221,11 @@ typedef int       wait_queue_head_t;
 #define cond_resched()                 do { } while (0)
 #define yield()                                do { } while (0)
 
-#define INT_MAX                                ((int)(~0U>>1))
-
-#define __user
 #define __init
 #define __exit
 #define __devinit
 #define __devinitdata
 #define __devinitconst
-#define __iomem
 
 #define kthread_create(...)    __builtin_return_address(0)
 #define kthread_stop(...)      do { } while (0)
@@ -306,8 +256,6 @@ struct cdev {
 #define cdev_add(...)          0
 #define cdev_del(...)          do { } while (0)
 
-#define MAX_ERRNO              4095
-
 #define prandom_u32(...)       0
 
 typedef struct {
@@ -320,7 +268,6 @@ typedef struct {
 
 /* from include/linux/types.h */
 
-typedef int    atomic_t;
 /**
  * struct callback_head - callback structure for use with RCU and task_work
  * @next: next update requests in a list
@@ -374,8 +321,6 @@ struct notifier_block {};
 
 typedef unsigned long dmaaddr_t;
 
-#define cpu_relax() do {} while (0)
-
 #define pm_runtime_get_sync(dev) do {} while (0)
 #define pm_runtime_put(dev) do {} while (0)
 #define pm_runtime_put_sync(dev) do {} while (0)
@@ -385,6 +330,7 @@ typedef unsigned long dmaaddr_t;
 
 #define IRQ_NONE 0
 #define IRQ_HANDLED 1
+#define IRQ_WAKE_THREAD 2
 
 #define dev_set_drvdata(dev, data) do {} while (0)