]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - include/linux/err.h
mtd: nand: kirkwood: enable BCH ECC and add support for dynamically switching ECC...
[karo-tx-uboot.git] / include / linux / err.h
1 #ifndef _LINUX_ERR_H
2 #define _LINUX_ERR_H
3
4 /* XXX U-BOOT XXX */
5 #if 0
6 #include <linux/compiler.h>
7 #else
8 #include <linux/compat.h>
9 #endif
10
11 #include <asm/errno.h>
12
13
14 /*
15  * Kernel pointers have redundant information, so we can use a
16  * scheme where we can return either an error code or a dentry
17  * pointer with the same return value.
18  *
19  * This should be a per-architecture thing, to allow different
20  * error and pointer decisions.
21  */
22 #define MAX_ERRNO       4095
23
24 #ifndef __ASSEMBLY__
25
26 #define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
27
28 static inline void *ERR_PTR(long error)
29 {
30         return (void *) error;
31 }
32
33 static inline long PTR_ERR(const void *ptr)
34 {
35         return (long) ptr;
36 }
37
38 static inline long IS_ERR(const void *ptr)
39 {
40         return IS_ERR_VALUE((unsigned long)ptr);
41 }
42
43 #endif
44
45 #endif /* _LINUX_ERR_H */