diff options
Diffstat (limited to 'drivers/gpio/gpiolib-acpi.c')
-rw-r--r-- | drivers/gpio/gpiolib-acpi.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index ae0ffdce8bd5..716ee9843110 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c | |||
@@ -12,11 +12,13 @@ | |||
12 | 12 | ||
13 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
14 | #include <linux/gpio/consumer.h> | 14 | #include <linux/gpio/consumer.h> |
15 | #include <linux/gpio/driver.h> | ||
15 | #include <linux/export.h> | 16 | #include <linux/export.h> |
16 | #include <linux/acpi_gpio.h> | ||
17 | #include <linux/acpi.h> | 17 | #include <linux/acpi.h> |
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | 19 | ||
20 | #include "gpiolib.h" | ||
21 | |||
20 | struct acpi_gpio_evt_pin { | 22 | struct acpi_gpio_evt_pin { |
21 | struct list_head node; | 23 | struct list_head node; |
22 | acpi_handle *evt_handle; | 24 | acpi_handle *evt_handle; |
@@ -94,7 +96,7 @@ static void acpi_gpio_evt_dh(acpi_handle handle, void *data) | |||
94 | * gpio pins have acpi event methods and assigns interrupt handlers that calls | 96 | * gpio pins have acpi event methods and assigns interrupt handlers that calls |
95 | * the acpi event methods for those pins. | 97 | * the acpi event methods for those pins. |
96 | */ | 98 | */ |
97 | void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) | 99 | static void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) |
98 | { | 100 | { |
99 | struct acpi_buffer buf = {ACPI_ALLOCATE_BUFFER, NULL}; | 101 | struct acpi_buffer buf = {ACPI_ALLOCATE_BUFFER, NULL}; |
100 | struct acpi_resource *res; | 102 | struct acpi_resource *res; |
@@ -192,7 +194,6 @@ void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) | |||
192 | irq); | 194 | irq); |
193 | } | 195 | } |
194 | } | 196 | } |
195 | EXPORT_SYMBOL(acpi_gpiochip_request_interrupts); | ||
196 | 197 | ||
197 | /** | 198 | /** |
198 | * acpi_gpiochip_free_interrupts() - Free GPIO _EVT ACPI event interrupts. | 199 | * acpi_gpiochip_free_interrupts() - Free GPIO _EVT ACPI event interrupts. |
@@ -203,7 +204,7 @@ EXPORT_SYMBOL(acpi_gpiochip_request_interrupts); | |||
203 | * The remaining ACPI event interrupts associated with the chip are freed | 204 | * The remaining ACPI event interrupts associated with the chip are freed |
204 | * automatically. | 205 | * automatically. |
205 | */ | 206 | */ |
206 | void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) | 207 | static void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) |
207 | { | 208 | { |
208 | acpi_handle handle; | 209 | acpi_handle handle; |
209 | acpi_status status; | 210 | acpi_status status; |
@@ -230,7 +231,6 @@ void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) | |||
230 | acpi_detach_data(handle, acpi_gpio_evt_dh); | 231 | acpi_detach_data(handle, acpi_gpio_evt_dh); |
231 | kfree(evt_pins); | 232 | kfree(evt_pins); |
232 | } | 233 | } |
233 | EXPORT_SYMBOL(acpi_gpiochip_free_interrupts); | ||
234 | 234 | ||
235 | struct acpi_gpio_lookup { | 235 | struct acpi_gpio_lookup { |
236 | struct acpi_gpio_info info; | 236 | struct acpi_gpio_info info; |
@@ -307,6 +307,15 @@ struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index, | |||
307 | if (lookup.desc && info) | 307 | if (lookup.desc && info) |
308 | *info = lookup.info; | 308 | *info = lookup.info; |
309 | 309 | ||
310 | return lookup.desc ? lookup.desc : ERR_PTR(-ENODEV); | 310 | return lookup.desc ? lookup.desc : ERR_PTR(-ENOENT); |
311 | } | ||
312 | |||
313 | void acpi_gpiochip_add(struct gpio_chip *chip) | ||
314 | { | ||
315 | acpi_gpiochip_request_interrupts(chip); | ||
316 | } | ||
317 | |||
318 | void acpi_gpiochip_remove(struct gpio_chip *chip) | ||
319 | { | ||
320 | acpi_gpiochip_free_interrupts(chip); | ||
311 | } | 321 | } |
312 | EXPORT_SYMBOL_GPL(acpi_get_gpiod_by_index); | ||