blob: c4fb448802e8fd07f9ad0901d78ea9af5979335e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/* Public domain. */
#ifndef _LINUX_ERR_H
#define _LINUX_ERR_H
#include <sys/errno.h>
#include <linux/compiler.h>
#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-ELAST)
static inline void *
ERR_PTR(long error)
{
return (void *) error;
}
static inline long
PTR_ERR(const void *ptr)
{
return (long) ptr;
}
static inline long
IS_ERR(const void *ptr)
{
return IS_ERR_VALUE((unsigned long)ptr);
}
static inline long
IS_ERR_OR_NULL(const void *ptr)
{
return !ptr || IS_ERR_VALUE((unsigned long)ptr);
}
static inline void *
ERR_CAST(const void *ptr)
{
return (void *)ptr;
}
static inline int
PTR_ERR_OR_ZERO(const void *ptr)
{
return IS_ERR(ptr)? PTR_ERR(ptr) : 0;
}
#endif
|