summaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2013-10-10 04:01:07 -0400
committerLinus Walleij <linus.walleij@linaro.org>2013-10-11 06:54:23 -0400
commit70b5341138dcb931df318afb51e8fb5310f9f095 (patch)
tree6606ecca87e71a621bcd1512e2b959c592d67482 /drivers/gpio
parent4bbd6f2e4902b18fcf5861d36588729c93ecda40 (diff)
gpiolib / ACPI: move acpi_gpiochip_free_interrupts next to the request function
It makes more sense to have these functions close to each other. No functional changes. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpiolib-acpi.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index f2beb728ed8f..1745ce5983d6 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -194,6 +194,44 @@ void acpi_gpiochip_request_interrupts(struct gpio_chip *chip)
194} 194}
195EXPORT_SYMBOL(acpi_gpiochip_request_interrupts); 195EXPORT_SYMBOL(acpi_gpiochip_request_interrupts);
196 196
197/**
198 * acpi_gpiochip_free_interrupts() - Free GPIO _EVT ACPI event interrupts.
199 * @chip: gpio chip
200 *
201 * Free interrupts associated with the _EVT method for the given GPIO chip.
202 *
203 * The remaining ACPI event interrupts associated with the chip are freed
204 * automatically.
205 */
206void acpi_gpiochip_free_interrupts(struct gpio_chip *chip)
207{
208 acpi_handle handle;
209 acpi_status status;
210 struct list_head *evt_pins;
211 struct acpi_gpio_evt_pin *evt_pin, *ep;
212
213 if (!chip->dev || !chip->to_irq)
214 return;
215
216 handle = ACPI_HANDLE(chip->dev);
217 if (!handle)
218 return;
219
220 status = acpi_get_data(handle, acpi_gpio_evt_dh, (void **)&evt_pins);
221 if (ACPI_FAILURE(status))
222 return;
223
224 list_for_each_entry_safe_reverse(evt_pin, ep, evt_pins, node) {
225 devm_free_irq(chip->dev, evt_pin->irq, evt_pin);
226 list_del(&evt_pin->node);
227 kfree(evt_pin);
228 }
229
230 acpi_detach_data(handle, acpi_gpio_evt_dh);
231 kfree(evt_pins);
232}
233EXPORT_SYMBOL(acpi_gpiochip_free_interrupts);
234
197struct acpi_gpio_lookup { 235struct acpi_gpio_lookup {
198 struct acpi_gpio_info info; 236 struct acpi_gpio_info info;
199 int index; 237 int index;
@@ -271,41 +309,3 @@ int acpi_get_gpio_by_index(struct device *dev, int index,
271 return lookup.gpio; 309 return lookup.gpio;
272} 310}
273EXPORT_SYMBOL_GPL(acpi_get_gpio_by_index); 311EXPORT_SYMBOL_GPL(acpi_get_gpio_by_index);
274
275/**
276 * acpi_gpiochip_free_interrupts() - Free GPIO _EVT ACPI event interrupts.
277 * @chip: gpio chip
278 *
279 * Free interrupts associated with the _EVT method for the given GPIO chip.
280 *
281 * The remaining ACPI event interrupts associated with the chip are freed
282 * automatically.
283 */
284void acpi_gpiochip_free_interrupts(struct gpio_chip *chip)
285{
286 acpi_handle handle;
287 acpi_status status;
288 struct list_head *evt_pins;
289 struct acpi_gpio_evt_pin *evt_pin, *ep;
290
291 if (!chip->dev || !chip->to_irq)
292 return;
293
294 handle = ACPI_HANDLE(chip->dev);
295 if (!handle)
296 return;
297
298 status = acpi_get_data(handle, acpi_gpio_evt_dh, (void **)&evt_pins);
299 if (ACPI_FAILURE(status))
300 return;
301
302 list_for_each_entry_safe_reverse(evt_pin, ep, evt_pins, node) {
303 devm_free_irq(chip->dev, evt_pin->irq, evt_pin);
304 list_del(&evt_pin->node);
305 kfree(evt_pin);
306 }
307
308 acpi_detach_data(handle, acpi_gpio_evt_dh);
309 kfree(evt_pins);
310}
311EXPORT_SYMBOL(acpi_gpiochip_free_interrupts);