Skip to content

Commit b24fd5b

Browse files
committed
gpiolib: acpi: Switch to use enum in acpi_gpio_in_ignore_list()
Switch to use enum instead of pointers in acpi_gpio_in_ignore_list() which moves towards isolating the GPIO ACPI and quirk APIs. It will helps splitting them completely in the next changes. No functional changes. Reviewed-by: Hans de Goede <[email protected]> Acked-by: Mika Westerberg <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
1 parent 44aa986 commit b24fd5b

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

drivers/gpio/gpiolib-acpi.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,14 +350,25 @@ static struct gpio_desc *acpi_request_own_gpiod(struct gpio_chip *chip,
350350
return desc;
351351
}
352352

353-
static bool acpi_gpio_in_ignore_list(const char *ignore_list, const char *controller_in,
354-
unsigned int pin_in)
353+
bool acpi_gpio_in_ignore_list(enum acpi_gpio_ignore_list list, const char *controller_in,
354+
unsigned int pin_in)
355355
{
356-
const char *controller, *pin_str;
356+
const char *ignore_list, *controller, *pin_str;
357357
unsigned int pin;
358358
char *endp;
359359
int len;
360360

361+
switch (list) {
362+
case ACPI_GPIO_IGNORE_WAKE:
363+
ignore_list = ignore_wake;
364+
break;
365+
case ACPI_GPIO_IGNORE_INTERRUPT:
366+
ignore_list = ignore_interrupt;
367+
break;
368+
default:
369+
return false;
370+
}
371+
361372
controller = ignore_list;
362373
while (controller) {
363374
pin_str = strchr(controller, '@');
@@ -394,7 +405,7 @@ static bool acpi_gpio_irq_is_wake(struct device *parent,
394405
if (agpio->wake_capable != ACPI_WAKE_CAPABLE)
395406
return false;
396407

397-
if (acpi_gpio_in_ignore_list(ignore_wake, dev_name(parent), pin)) {
408+
if (acpi_gpio_in_ignore_list(ACPI_GPIO_IGNORE_WAKE, dev_name(parent), pin)) {
398409
dev_info(parent, "Ignoring wakeup on pin %u\n", pin);
399410
return false;
400411
}
@@ -437,7 +448,7 @@ static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares,
437448
if (!handler)
438449
return AE_OK;
439450

440-
if (acpi_gpio_in_ignore_list(ignore_interrupt, dev_name(chip->parent), pin)) {
451+
if (acpi_gpio_in_ignore_list(ACPI_GPIO_IGNORE_INTERRUPT, dev_name(chip->parent), pin)) {
441452
dev_info(chip->parent, "Ignoring interrupt on pin %u\n", pin);
442453
return AE_OK;
443454
}

drivers/gpio/gpiolib-acpi.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,12 @@ static inline int acpi_gpio_count(const struct fwnode_handle *fwnode,
5858
}
5959
#endif
6060

61+
enum acpi_gpio_ignore_list {
62+
ACPI_GPIO_IGNORE_WAKE,
63+
ACPI_GPIO_IGNORE_INTERRUPT,
64+
};
65+
66+
bool acpi_gpio_in_ignore_list(enum acpi_gpio_ignore_list list,
67+
const char *controller_in, unsigned int pin_in);
68+
6169
#endif /* GPIOLIB_ACPI_H */

0 commit comments

Comments
 (0)