USB: cdc-wdm: updating desc->length must be protected by spin_lock
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / linux / gpio.h
blob17b5a0d80e4239cc10fceb670be29dbf4e49a0f0
1 #ifndef __LINUX_GPIO_H
2 #define __LINUX_GPIO_H
4 /* see Documentation/gpio.txt */
6 /* make these flag values available regardless of GPIO kconfig options */
7 #define GPIOF_DIR_OUT (0 << 0)
8 #define GPIOF_DIR_IN (1 << 0)
10 #define GPIOF_INIT_LOW (0 << 1)
11 #define GPIOF_INIT_HIGH (1 << 1)
13 #define GPIOF_IN (GPIOF_DIR_IN)
14 #define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW)
15 #define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH)
17 #ifdef CONFIG_GENERIC_GPIO
18 #include <asm/gpio.h>
20 #else
22 #include <linux/kernel.h>
23 #include <linux/types.h>
24 #include <linux/errno.h>
26 struct device;
27 struct gpio;
28 struct gpio_chip;
31 * Some platforms don't support the GPIO programming interface.
33 * In case some driver uses it anyway (it should normally have
34 * depended on GENERIC_GPIO), these routines help the compiler
35 * optimize out much GPIO-related code ... or trigger a runtime
36 * warning when something is wrongly called.
39 static inline bool gpio_is_valid(int number)
41 return false;
44 static inline int gpio_request(unsigned gpio, const char *label)
46 return -ENOSYS;
49 static inline int gpio_request_one(unsigned gpio,
50 unsigned long flags, const char *label)
52 return -ENOSYS;
55 static inline int gpio_request_array(const struct gpio *array, size_t num)
57 return -ENOSYS;
60 static inline void gpio_free(unsigned gpio)
62 might_sleep();
64 /* GPIO can never have been requested */
65 WARN_ON(1);
68 static inline void gpio_free_array(const struct gpio *array, size_t num)
70 might_sleep();
72 /* GPIO can never have been requested */
73 WARN_ON(1);
76 static inline int gpio_direction_input(unsigned gpio)
78 return -ENOSYS;
81 static inline int gpio_direction_output(unsigned gpio, int value)
83 return -ENOSYS;
86 static inline int gpio_set_debounce(unsigned gpio, unsigned debounce)
88 return -ENOSYS;
91 static inline int gpio_get_value(unsigned gpio)
93 /* GPIO can never have been requested or set as {in,out}put */
94 WARN_ON(1);
95 return 0;
98 static inline void gpio_set_value(unsigned gpio, int value)
100 /* GPIO can never have been requested or set as output */
101 WARN_ON(1);
104 static inline int gpio_cansleep(unsigned gpio)
106 /* GPIO can never have been requested or set as {in,out}put */
107 WARN_ON(1);
108 return 0;
111 static inline int gpio_get_value_cansleep(unsigned gpio)
113 /* GPIO can never have been requested or set as {in,out}put */
114 WARN_ON(1);
115 return 0;
118 static inline void gpio_set_value_cansleep(unsigned gpio, int value)
120 /* GPIO can never have been requested or set as output */
121 WARN_ON(1);
124 static inline int gpio_export(unsigned gpio, bool direction_may_change)
126 /* GPIO can never have been requested or set as {in,out}put */
127 WARN_ON(1);
128 return -EINVAL;
131 static inline int gpio_export_link(struct device *dev, const char *name,
132 unsigned gpio)
134 /* GPIO can never have been exported */
135 WARN_ON(1);
136 return -EINVAL;
139 static inline int gpio_sysfs_set_active_low(unsigned gpio, int value)
141 /* GPIO can never have been requested */
142 WARN_ON(1);
143 return -EINVAL;
146 static inline void gpio_unexport(unsigned gpio)
148 /* GPIO can never have been exported */
149 WARN_ON(1);
152 static inline int gpio_to_irq(unsigned gpio)
154 /* GPIO can never have been requested or set as input */
155 WARN_ON(1);
156 return -EINVAL;
159 static inline int irq_to_gpio(unsigned irq)
161 /* irq can never have been returned from gpio_to_irq() */
162 WARN_ON(1);
163 return -EINVAL;
166 #endif
168 #endif /* __LINUX_GPIO_H */