Skip to content

Commit c4bcc1b

Browse files
andy-shevdtor
authored andcommitted
Input: goodix - switch use of acpi_gpio_get_*_resource() APIs
No need to open code functionality that is provided by the acpi_gpio_get_irq_resource() and acpi_gpio_get_io_resource(). Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent a6a87c3 commit c4bcc1b

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

drivers/input/touchscreen/goodix.c

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -822,22 +822,16 @@ static int goodix_resource(struct acpi_resource *ares, void *data)
822822
struct device *dev = &ts->client->dev;
823823
struct acpi_resource_gpio *gpio;
824824

825-
switch (ares->type) {
826-
case ACPI_RESOURCE_TYPE_GPIO:
827-
gpio = &ares->data.gpio;
828-
if (gpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT) {
829-
if (ts->gpio_int_idx == -1) {
830-
ts->gpio_int_idx = ts->gpio_count;
831-
} else {
832-
dev_err(dev, "More then one GpioInt resource, ignoring ACPI GPIO resources\n");
833-
ts->gpio_int_idx = -2;
834-
}
825+
if (acpi_gpio_get_irq_resource(ares, &gpio)) {
826+
if (ts->gpio_int_idx == -1) {
827+
ts->gpio_int_idx = ts->gpio_count;
828+
} else {
829+
dev_err(dev, "More then one GpioInt resource, ignoring ACPI GPIO resources\n");
830+
ts->gpio_int_idx = -2;
835831
}
836832
ts->gpio_count++;
837-
break;
838-
default:
839-
break;
840-
}
833+
} else if (acpi_gpio_get_io_resource(ares, &gpio))
834+
ts->gpio_count++;
841835

842836
return 0;
843837
}

0 commit comments

Comments
 (0)