]> www.infradead.org Git - users/jedix/linux-maple.git/commit
gpiolib: acpi: Deduplicate some code in __acpi_find_gpio()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 3 Apr 2025 15:59:17 +0000 (18:59 +0300)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 7 Apr 2025 06:38:39 +0000 (09:38 +0300)
commit8b4f52ef7a412dd8e0b390ad4815bd74323f6f99
tree275c605f2053379a0de8e1afabc267afc3630c2c
parentbd0df44795053e53a25c521016d083311a05fae0
gpiolib: acpi: Deduplicate some code in __acpi_find_gpio()

__acpi_find_gpio() calls two functions depending on the supplied con_id
and possibility to fallback to _CRS lookup. Those functions have the same
pieces of code that can be done only in one place. Do it so.

This gives an impressive shrink of the generated code for x86_64:

add/remove: 0/2 grow/shrink: 0/4 up/down: 0/-1204 (-1204)
Function                                     old     new   delta
acpi_find_gpio.__UNIQUE_ID_ddebug478          56       -     -56
acpi_dev_gpio_irq_wake_get_by.__UNIQUE_ID_ddebug480      56       -     -56
acpi_find_gpio                               354     216    -138
acpi_get_gpiod_by_index                      456     307    -149
__acpi_find_gpio                             877     638    -239
acpi_dev_gpio_irq_wake_get_by                695     129    -566
Total: Before=15358, After=14154, chg -7.84%

Acked-by: Mika Westerberg <westeri@kernel.org>
Link: https://lore.kernel.org/r/20250403160034.2680485-7-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/gpio/gpiolib-acpi.c