diff options
-rw-r--r-- | drivers/gpio/gpiolib.c | 10 | ||||
-rw-r--r-- | include/asm-generic/gpio.h | 6 | ||||
-rw-r--r-- | include/linux/gpio.h | 24 |
3 files changed, 29 insertions, 11 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index f0b07bbfcc9a..1e1a7cabc57e 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -1185,6 +1185,7 @@ struct gpio_chip *gpiochip_find(void *data, | |||
1185 | EXPORT_SYMBOL_GPL(gpiochip_find); | 1185 | EXPORT_SYMBOL_GPL(gpiochip_find); |
1186 | 1186 | ||
1187 | #ifdef CONFIG_PINCTRL | 1187 | #ifdef CONFIG_PINCTRL |
1188 | |||
1188 | void gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, | 1189 | void gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, |
1189 | unsigned int pin_base, unsigned int npins) | 1190 | unsigned int pin_base, unsigned int npins) |
1190 | { | 1191 | { |
@@ -1206,6 +1207,7 @@ void gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, | |||
1206 | 1207 | ||
1207 | list_add_tail(&pin_range->node, &chip->pin_ranges); | 1208 | list_add_tail(&pin_range->node, &chip->pin_ranges); |
1208 | } | 1209 | } |
1210 | EXPORT_SYMBOL_GPL(gpiochip_add_pin_range); | ||
1209 | 1211 | ||
1210 | void gpiochip_remove_pin_ranges(struct gpio_chip *chip) | 1212 | void gpiochip_remove_pin_ranges(struct gpio_chip *chip) |
1211 | { | 1213 | { |
@@ -1217,11 +1219,9 @@ void gpiochip_remove_pin_ranges(struct gpio_chip *chip) | |||
1217 | &pin_range->range); | 1219 | &pin_range->range); |
1218 | } | 1220 | } |
1219 | } | 1221 | } |
1220 | #else | 1222 | EXPORT_SYMBOL_GPL(gpiochip_remove_pin_ranges); |
1221 | void gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, | 1223 | |
1222 | unsigned int pin_base, unsigned int npins) {} | 1224 | #endif /* CONFIG_PINCTRL */ |
1223 | void gpiochip_remove_pin_ranges(struct gpio_chip *chip) {} | ||
1224 | #endif | ||
1225 | 1225 | ||
1226 | /* These "optional" allocation calls help prevent drivers from stomping | 1226 | /* These "optional" allocation calls help prevent drivers from stomping |
1227 | * on each other, and help provide better diagnostics in debugfs. | 1227 | * on each other, and help provide better diagnostics in debugfs. |
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 92e5c432421c..2e60de4265ac 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h | |||
@@ -49,6 +49,7 @@ struct module; | |||
49 | struct device_node; | 49 | struct device_node; |
50 | 50 | ||
51 | #ifdef CONFIG_PINCTRL | 51 | #ifdef CONFIG_PINCTRL |
52 | |||
52 | /** | 53 | /** |
53 | * struct gpio_pin_range - pin range controlled by a gpio chip | 54 | * struct gpio_pin_range - pin range controlled by a gpio chip |
54 | * @head: list for maintaining set of pin ranges, used internally | 55 | * @head: list for maintaining set of pin ranges, used internally |
@@ -61,6 +62,11 @@ struct gpio_pin_range { | |||
61 | struct pinctrl_dev *pctldev; | 62 | struct pinctrl_dev *pctldev; |
62 | struct pinctrl_gpio_range range; | 63 | struct pinctrl_gpio_range range; |
63 | }; | 64 | }; |
65 | |||
66 | void gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, | ||
67 | unsigned int pin_base, unsigned int npins); | ||
68 | void gpiochip_remove_pin_ranges(struct gpio_chip *chip); | ||
69 | |||
64 | #endif | 70 | #endif |
65 | 71 | ||
66 | /** | 72 | /** |
diff --git a/include/linux/gpio.h b/include/linux/gpio.h index a28445992b7f..21d28b930dc7 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h | |||
@@ -72,9 +72,9 @@ static inline int irq_to_gpio(unsigned int irq) | |||
72 | return -EINVAL; | 72 | return -EINVAL; |
73 | } | 73 | } |
74 | 74 | ||
75 | #endif | 75 | #endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */ |
76 | 76 | ||
77 | #else | 77 | #else /* ! CONFIG_GENERIC_GPIO */ |
78 | 78 | ||
79 | #include <linux/kernel.h> | 79 | #include <linux/kernel.h> |
80 | #include <linux/types.h> | 80 | #include <linux/types.h> |
@@ -231,9 +231,21 @@ static inline int irq_to_gpio(unsigned irq) | |||
231 | return -EINVAL; | 231 | return -EINVAL; |
232 | } | 232 | } |
233 | 233 | ||
234 | void gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, | 234 | #ifdef CONFIG_PINCTRL |
235 | unsigned int pin_base, unsigned int npins); | 235 | |
236 | void gpiochip_remove_pin_ranges(struct gpio_chip *chip); | 236 | static inline void |
237 | #endif | 237 | gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, |
238 | unsigned int pin_base, unsigned int npins) | ||
239 | { | ||
240 | } | ||
241 | |||
242 | static inline void | ||
243 | gpiochip_remove_pin_ranges(struct gpio_chip *chip) | ||
244 | { | ||
245 | } | ||
246 | |||
247 | #endif /* CONFIG_PINCTRL */ | ||
248 | |||
249 | #endif /* ! CONFIG_GENERIC_GPIO */ | ||
238 | 250 | ||
239 | #endif /* __LINUX_GPIO_H */ | 251 | #endif /* __LINUX_GPIO_H */ |