Merge tag 'sound-5.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
[muen/linux.git] / drivers / gpio / gpiolib-acpi.c
index 667f472fdbbd2ed8a910bfdd1054d84aec8b94e7..3e8e2d3ce7a8020a8f89cf5d187f32c8d7a539c8 100644 (file)
@@ -530,17 +530,24 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)
        if (ares->type != ACPI_RESOURCE_TYPE_GPIO)
                return 1;
 
-       if (lookup->n++ == lookup->index && !lookup->desc) {
+       if (!lookup->desc) {
                const struct acpi_resource_gpio *agpio = &ares->data.gpio;
-               int pin_index = lookup->pin_index;
+               bool gpioint = agpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT;
+               int pin_index;
 
+               if (lookup->info.quirks & ACPI_GPIO_QUIRK_ONLY_GPIOIO && gpioint)
+                       lookup->index++;
+
+               if (lookup->n++ != lookup->index)
+                       return 1;
+
+               pin_index = lookup->pin_index;
                if (pin_index >= agpio->pin_table_length)
                        return 1;
 
                lookup->desc = acpi_get_gpiod(agpio->resource_source.string_ptr,
                                              agpio->pin_table[pin_index]);
-               lookup->info.gpioint =
-                       agpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT;
+               lookup->info.gpioint = gpioint;
 
                /*
                 * Polarity and triggering are only specified for GpioInt