]> git.baikalelectronics.ru Git - kernel.git/commit
gpio / ACPI: Rework ACPI GPIO event handling
authorMika Westerberg <mika.westerberg@linux.intel.com>
Mon, 10 Mar 2014 12:54:53 +0000 (14:54 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 13 Mar 2014 14:15:43 +0000 (15:15 +0100)
commit8246f344cb8825f7d0cb9ad3b30aa1480d9104b2
treecf2b99cb722db706eec583fe4df9f88d9dac81da
parentb58ab8b57375c2a13c015e409e539babe07de9a0
gpio / ACPI: Rework ACPI GPIO event handling

The current ACPI GPIO event handling code was never tested against real
hardware with functioning GPIO triggered events (at the time such hardware
wasn't available). Thus it misses certain things like requesting the GPIOs
properly, passing correct flags to the interrupt handler and so on.

This patch reworks ACPI GPIO event handling so that we:

 1) Use struct acpi_gpio_event for all GPIO signaled events.
 2) Switch to use GPIO descriptor API and request GPIOs by calling
    gpiochip_request_own_desc() that we added in a previous patch.
 3) Pass proper flags from ACPI GPIO resource to request_threaded_irq().

Also instead of open-coding the _AEI iteration loop we can use
acpi_walk_resources(). This simplifies the code a bit and fixes memory leak
that was caused by missing kfree() for buffer returned by
acpi_get_event_resources().

Since the remove path now calls gpiochip_free_own_desc() which takes GPIO
spinlock we need to call acpi_gpiochip_remove() outside of that lock
(analogous to acpi_gpiochip_add() path where the lock is released before
those funtions are called).

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib-acpi.c
drivers/gpio/gpiolib.c