diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2017-05-23 13:03:24 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2017-05-29 05:22:48 -0400 |
commit | 25e3ef894eef419ee239da42edc6c1f8a4f1cfb5 (patch) | |
tree | be2358271afc2732349ca8a6e40c5eac78b87cba /drivers/gpio/gpiolib-acpi.c | |
parent | a31f5c3a68520ee6a2adee7d5f13f2e6ef209875 (diff) |
gpio: acpi: Split out acpi_gpio_get_irq_resource() helper
The helper does retrieve pointer to struct acpi_resource_gpio from
struct acpi_resource if it represents GpioInt() resource.
It will be used by PNP code later on.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpiolib-acpi.c')
-rw-r--r-- | drivers/gpio/gpiolib-acpi.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index e431222edc2b..6bea176b066c 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c | |||
@@ -165,6 +165,23 @@ static void acpi_gpio_chip_dh(acpi_handle handle, void *data) | |||
165 | /* The address of this function is used as a key. */ | 165 | /* The address of this function is used as a key. */ |
166 | } | 166 | } |
167 | 167 | ||
168 | bool acpi_gpio_get_irq_resource(struct acpi_resource *ares, | ||
169 | struct acpi_resource_gpio **agpio) | ||
170 | { | ||
171 | struct acpi_resource_gpio *gpio; | ||
172 | |||
173 | if (ares->type != ACPI_RESOURCE_TYPE_GPIO) | ||
174 | return false; | ||
175 | |||
176 | gpio = &ares->data.gpio; | ||
177 | if (gpio->connection_type != ACPI_RESOURCE_GPIO_TYPE_INT) | ||
178 | return false; | ||
179 | |||
180 | *agpio = gpio; | ||
181 | return true; | ||
182 | } | ||
183 | EXPORT_SYMBOL_GPL(acpi_gpio_get_irq_resource); | ||
184 | |||
168 | static acpi_status acpi_gpiochip_request_interrupt(struct acpi_resource *ares, | 185 | static acpi_status acpi_gpiochip_request_interrupt(struct acpi_resource *ares, |
169 | void *context) | 186 | void *context) |
170 | { | 187 | { |
@@ -178,11 +195,7 @@ static acpi_status acpi_gpiochip_request_interrupt(struct acpi_resource *ares, | |||
178 | unsigned long irqflags; | 195 | unsigned long irqflags; |
179 | int ret, pin, irq; | 196 | int ret, pin, irq; |
180 | 197 | ||
181 | if (ares->type != ACPI_RESOURCE_TYPE_GPIO) | 198 | if (!acpi_gpio_get_irq_resource(ares, &agpio)) |
182 | return AE_OK; | ||
183 | |||
184 | agpio = &ares->data.gpio; | ||
185 | if (agpio->connection_type != ACPI_RESOURCE_GPIO_TYPE_INT) | ||
186 | return AE_OK; | 199 | return AE_OK; |
187 | 200 | ||
188 | handle = ACPI_HANDLE(chip->parent); | 201 | handle = ACPI_HANDLE(chip->parent); |