FROMLIST: gpio: acpi: Split out acpi_gpio_get_irq_resource() helper [chromiumos/third_party/kernel : chromeos-4.4]

5 views
Skip to first unread message

ChromeOS bot (Gerrit)

unread,
Jun 7, 2017, 6:04:55 AM6/7/17
to Jagadish Krishnamoorthy, ChromeOS Commit Bot, Dmitry Torokhov, Duncan Laurie, Duncan Laurie, Hannah Williams, Freddy Paul, Jeremy Lin

ChromeOS bot merged this change.

View Change

FROMLIST: 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.s...@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.we...@linux.intel.com>
Signed-off-by: Linus Walleij <linus....@linaro.org>

LINK: git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git
BRANCH: for-next

BUG=chromium:704198
TEST=On Cyan, make sure keyboard works fine
after passing gpioint resource in keyboard asl.
cat /proc/interrupts | grep 8042 should have proper irq number.

Change-Id: Id78a0902edc03ccb0a76306b66a02f59bd348442
Signed-off-by: Jagadish Krishnamoorthy <jagadish.kr...@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/522424
Reviewed-by: Dmitry Torokhov <dt...@chromium.org>
---
M drivers/gpio/gpiolib-acpi.c
M include/linux/acpi.h
2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index e4620e1..ea58298 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -164,6 +164,23 @@
/* The address of this function is used as a key. */
}

+bool acpi_gpio_get_irq_resource(struct acpi_resource *ares,
+ struct acpi_resource_gpio **agpio)
+{
+ struct acpi_resource_gpio *gpio;
+
+ if (ares->type != ACPI_RESOURCE_TYPE_GPIO)
+ return false;
+
+ gpio = &ares->data.gpio;
+ if (gpio->connection_type != ACPI_RESOURCE_GPIO_TYPE_INT)
+ return false;
+
+ *agpio = gpio;
+ return true;
+}
+EXPORT_SYMBOL_GPL(acpi_gpio_get_irq_resource);
+
static acpi_status acpi_gpiochip_request_interrupt(struct acpi_resource *ares,
void *context)
{
@@ -177,11 +194,7 @@
unsigned long irqflags;
int ret, pin, irq;

- if (ares->type != ACPI_RESOURCE_TYPE_GPIO)
- return AE_OK;
-
- agpio = &ares->data.gpio;
- if (agpio->connection_type != ACPI_RESOURCE_GPIO_TYPE_INT)
+ if (!acpi_gpio_get_irq_resource(ares, &agpio))
return AE_OK;

handle = ACPI_HANDLE(chip->parent);
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 72b3738..5679e27 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -770,6 +770,8 @@
adev->driver_gpios = NULL;
}

+bool acpi_gpio_get_irq_resource(struct acpi_resource *ares,
+ struct acpi_resource_gpio **agpio);
int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index);
#else
static inline int acpi_dev_add_driver_gpios(struct acpi_device *adev,
@@ -779,6 +781,11 @@
}
static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev) {}

+static inline bool acpi_gpio_get_irq_resource(struct acpi_resource *ares,
+ struct acpi_resource_gpio **agpio)
+{
+ return false;
+}
static inline int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index)
{
return -ENXIO;

To view, visit change 522424. To unsubscribe, visit settings.

Gerrit-Project: chromiumos/third_party/kernel
Gerrit-Branch: chromeos-4.4
Gerrit-MessageType: merged
Gerrit-Change-Id: Id78a0902edc03ccb0a76306b66a02f59bd348442
Gerrit-Change-Number: 522424
Gerrit-PatchSet: 4
Gerrit-Owner: Jagadish Krishnamoorthy <jagadish.kr...@intel.com>
Gerrit-Reviewer: Dmitry Torokhov <dt...@chromium.org>
Gerrit-Reviewer: Duncan Laurie <dla...@chromium.org>
Gerrit-Reviewer: Freddy Paul <fredd...@intel.com>
Gerrit-Reviewer: Hannah Williams <hannah....@intel.com>
Gerrit-Reviewer: Jagadish Krishnamoorthy <jagadish.kr...@intel.com>
Gerrit-CC: ChromeOS Commit Bot <chromeos-...@chromium.org>
Gerrit-CC: Duncan Laurie <dla...@google.com>
Gerrit-CC: Jeremy Lin <jeremy...@intel.com>
Reply all
Reply to author
Forward
0 new messages