Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpiolib: acpi: Add acpi_gpio_update_gpiod_lookup_flags() helper

This helper consolidates all settings of GPIO descriptor lookup flags and
quirks in the future if any.

No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Andy Shevchenko and committed by
Linus Walleij
606be344 24a49543

+19 -6
+10 -3
drivers/gpio/gpiolib-acpi.c
··· 525 525 return ret; 526 526 } 527 527 528 + int acpi_gpio_update_gpiod_lookup_flags(unsigned long *lookupflags, 529 + struct acpi_gpio_info *info) 530 + { 531 + if (info->polarity == GPIO_ACTIVE_LOW) 532 + *lookupflags |= GPIO_ACTIVE_LOW; 533 + 534 + return 0; 535 + } 536 + 528 537 struct acpi_gpio_lookup { 529 538 struct acpi_gpio_info info; 530 539 int index; ··· 754 745 return ERR_PTR(-ENOENT); 755 746 } 756 747 757 - if (info.polarity == GPIO_ACTIVE_LOW) 758 - *lookupflags |= GPIO_ACTIVE_LOW; 759 - 760 748 acpi_gpio_update_gpiod_flags(dflags, &info); 749 + acpi_gpio_update_gpiod_lookup_flags(lookupflags, &info); 761 750 return desc; 762 751 } 763 752
+1 -3
drivers/gpio/gpiolib.c
··· 4350 4350 return desc; 4351 4351 4352 4352 acpi_gpio_update_gpiod_flags(&dflags, &info); 4353 - 4354 - if (info.polarity == GPIO_ACTIVE_LOW) 4355 - lflags |= GPIO_ACTIVE_LOW; 4353 + acpi_gpio_update_gpiod_lookup_flags(&lflags, &info); 4356 4354 } 4357 4355 4358 4356 /* Currently only ACPI takes this path */
+8
drivers/gpio/gpiolib.h
··· 125 125 126 126 int acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, 127 127 struct acpi_gpio_info *info); 128 + int acpi_gpio_update_gpiod_lookup_flags(unsigned long *lookupflags, 129 + struct acpi_gpio_info *info); 128 130 129 131 struct gpio_desc *acpi_find_gpio(struct device *dev, 130 132 const char *con_id, ··· 152 150 153 151 static inline int 154 152 acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, struct acpi_gpio_info *info) 153 + { 154 + return 0; 155 + } 156 + static inline int 157 + acpi_gpio_update_gpiod_lookup_flags(unsigned long *lookupflags, 158 + struct acpi_gpio_info *info) 155 159 { 156 160 return 0; 157 161 }