diff options
Diffstat (limited to 'include/asm-generic')
-rw-r--r-- | include/asm-generic/bug.h | 25 | ||||
-rw-r--r-- | include/asm-generic/gpio.h | 35 | ||||
-rw-r--r-- | include/asm-generic/int-ll64.h | 2 |
3 files changed, 58 insertions, 4 deletions
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 2632328d8646..a3f738cffdb6 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h | |||
@@ -34,9 +34,14 @@ struct bug_entry { | |||
34 | #ifndef __WARN | 34 | #ifndef __WARN |
35 | #ifndef __ASSEMBLY__ | 35 | #ifndef __ASSEMBLY__ |
36 | extern void warn_on_slowpath(const char *file, const int line); | 36 | extern void warn_on_slowpath(const char *file, const int line); |
37 | extern void warn_slowpath(const char *file, const int line, | ||
38 | const char *fmt, ...) __attribute__((format(printf, 3, 4))); | ||
37 | #define WANT_WARN_ON_SLOWPATH | 39 | #define WANT_WARN_ON_SLOWPATH |
38 | #endif | 40 | #endif |
39 | #define __WARN() warn_on_slowpath(__FILE__, __LINE__) | 41 | #define __WARN() warn_on_slowpath(__FILE__, __LINE__) |
42 | #define __WARN_printf(arg...) warn_slowpath(__FILE__, __LINE__, arg) | ||
43 | #else | ||
44 | #define __WARN_printf(arg...) __WARN() | ||
40 | #endif | 45 | #endif |
41 | 46 | ||
42 | #ifndef WARN_ON | 47 | #ifndef WARN_ON |
@@ -48,6 +53,15 @@ extern void warn_on_slowpath(const char *file, const int line); | |||
48 | }) | 53 | }) |
49 | #endif | 54 | #endif |
50 | 55 | ||
56 | #ifndef WARN | ||
57 | #define WARN(condition, format...) ({ \ | ||
58 | int __ret_warn_on = !!(condition); \ | ||
59 | if (unlikely(__ret_warn_on)) \ | ||
60 | __WARN_printf(format); \ | ||
61 | unlikely(__ret_warn_on); \ | ||
62 | }) | ||
63 | #endif | ||
64 | |||
51 | #else /* !CONFIG_BUG */ | 65 | #else /* !CONFIG_BUG */ |
52 | #ifndef HAVE_ARCH_BUG | 66 | #ifndef HAVE_ARCH_BUG |
53 | #define BUG() | 67 | #define BUG() |
@@ -63,6 +77,14 @@ extern void warn_on_slowpath(const char *file, const int line); | |||
63 | unlikely(__ret_warn_on); \ | 77 | unlikely(__ret_warn_on); \ |
64 | }) | 78 | }) |
65 | #endif | 79 | #endif |
80 | |||
81 | #ifndef WARN | ||
82 | #define WARN(condition, format...) ({ \ | ||
83 | int __ret_warn_on = !!(condition); \ | ||
84 | unlikely(__ret_warn_on); \ | ||
85 | }) | ||
86 | #endif | ||
87 | |||
66 | #endif | 88 | #endif |
67 | 89 | ||
68 | #define WARN_ON_ONCE(condition) ({ \ | 90 | #define WARN_ON_ONCE(condition) ({ \ |
@@ -75,6 +97,9 @@ extern void warn_on_slowpath(const char *file, const int line); | |||
75 | unlikely(__ret_warn_once); \ | 97 | unlikely(__ret_warn_once); \ |
76 | }) | 98 | }) |
77 | 99 | ||
100 | #define WARN_ON_RATELIMIT(condition, state) \ | ||
101 | WARN_ON((condition) && __ratelimit(state)) | ||
102 | |||
78 | #ifdef CONFIG_SMP | 103 | #ifdef CONFIG_SMP |
79 | # define WARN_ON_SMP(x) WARN_ON(x) | 104 | # define WARN_ON_SMP(x) WARN_ON(x) |
80 | #else | 105 | #else |
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 6be061d09da9..a3034d20ebd5 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | 5 | ||
6 | #ifdef CONFIG_HAVE_GPIO_LIB | 6 | #ifdef CONFIG_GPIOLIB |
7 | 7 | ||
8 | #include <linux/compiler.h> | 8 | #include <linux/compiler.h> |
9 | 9 | ||
@@ -32,6 +32,8 @@ struct module; | |||
32 | /** | 32 | /** |
33 | * struct gpio_chip - abstract a GPIO controller | 33 | * struct gpio_chip - abstract a GPIO controller |
34 | * @label: for diagnostics | 34 | * @label: for diagnostics |
35 | * @dev: optional device providing the GPIOs | ||
36 | * @owner: helps prevent removal of modules exporting active GPIOs | ||
35 | * @direction_input: configures signal "offset" as input, or returns error | 37 | * @direction_input: configures signal "offset" as input, or returns error |
36 | * @get: returns value for signal "offset"; for output signals this | 38 | * @get: returns value for signal "offset"; for output signals this |
37 | * returns either the value actually sensed, or zero | 39 | * returns either the value actually sensed, or zero |
@@ -59,6 +61,7 @@ struct module; | |||
59 | */ | 61 | */ |
60 | struct gpio_chip { | 62 | struct gpio_chip { |
61 | char *label; | 63 | char *label; |
64 | struct device *dev; | ||
62 | struct module *owner; | 65 | struct module *owner; |
63 | 66 | ||
64 | int (*direction_input)(struct gpio_chip *chip, | 67 | int (*direction_input)(struct gpio_chip *chip, |
@@ -74,6 +77,7 @@ struct gpio_chip { | |||
74 | int base; | 77 | int base; |
75 | u16 ngpio; | 78 | u16 ngpio; |
76 | unsigned can_sleep:1; | 79 | unsigned can_sleep:1; |
80 | unsigned exported:1; | ||
77 | }; | 81 | }; |
78 | 82 | ||
79 | extern const char *gpiochip_is_requested(struct gpio_chip *chip, | 83 | extern const char *gpiochip_is_requested(struct gpio_chip *chip, |
@@ -108,7 +112,18 @@ extern void __gpio_set_value(unsigned gpio, int value); | |||
108 | extern int __gpio_cansleep(unsigned gpio); | 112 | extern int __gpio_cansleep(unsigned gpio); |
109 | 113 | ||
110 | 114 | ||
111 | #else | 115 | #ifdef CONFIG_GPIO_SYSFS |
116 | |||
117 | /* | ||
118 | * A sysfs interface can be exported by individual drivers if they want, | ||
119 | * but more typically is configured entirely from userspace. | ||
120 | */ | ||
121 | extern int gpio_export(unsigned gpio, bool direction_may_change); | ||
122 | extern void gpio_unexport(unsigned gpio); | ||
123 | |||
124 | #endif /* CONFIG_GPIO_SYSFS */ | ||
125 | |||
126 | #else /* !CONFIG_HAVE_GPIO_LIB */ | ||
112 | 127 | ||
113 | static inline int gpio_is_valid(int number) | 128 | static inline int gpio_is_valid(int number) |
114 | { | 129 | { |
@@ -137,6 +152,20 @@ static inline void gpio_set_value_cansleep(unsigned gpio, int value) | |||
137 | gpio_set_value(gpio, value); | 152 | gpio_set_value(gpio, value); |
138 | } | 153 | } |
139 | 154 | ||
140 | #endif | 155 | #endif /* !CONFIG_HAVE_GPIO_LIB */ |
156 | |||
157 | #ifndef CONFIG_GPIO_SYSFS | ||
158 | |||
159 | /* sysfs support is only available with gpiolib, where it's optional */ | ||
160 | |||
161 | static inline int gpio_export(unsigned gpio, bool direction_may_change) | ||
162 | { | ||
163 | return -ENOSYS; | ||
164 | } | ||
165 | |||
166 | static inline void gpio_unexport(unsigned gpio) | ||
167 | { | ||
168 | } | ||
169 | #endif /* CONFIG_GPIO_SYSFS */ | ||
141 | 170 | ||
142 | #endif /* _ASM_GENERIC_GPIO_H */ | 171 | #endif /* _ASM_GENERIC_GPIO_H */ |
diff --git a/include/asm-generic/int-ll64.h b/include/asm-generic/int-ll64.h index 260948905e4e..f9bc9ac29b36 100644 --- a/include/asm-generic/int-ll64.h +++ b/include/asm-generic/int-ll64.h | |||
@@ -26,7 +26,7 @@ typedef unsigned int __u32; | |||
26 | #ifdef __GNUC__ | 26 | #ifdef __GNUC__ |
27 | __extension__ typedef __signed__ long long __s64; | 27 | __extension__ typedef __signed__ long long __s64; |
28 | __extension__ typedef unsigned long long __u64; | 28 | __extension__ typedef unsigned long long __u64; |
29 | #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L | 29 | #else |
30 | typedef __signed__ long long __s64; | 30 | typedef __signed__ long long __s64; |
31 | typedef unsigned long long __u64; | 31 | typedef unsigned long long __u64; |
32 | #endif | 32 | #endif |