]> www.infradead.org Git - users/jedix/linux-maple.git/commit
gpiolib: acpi: Make sure we fill struct acpi_gpio_info
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 9 Apr 2025 13:27:54 +0000 (16:27 +0300)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 21 May 2025 09:25:23 +0000 (12:25 +0300)
commit7c010d463372140006bf96985a306d6cbfc6e118
tree8188110f6597b0dc74a8f72f39755947ae6d45ce
parentf89a915e68de2327d6fd9e69c2aae730d6fe51c6
gpiolib: acpi: Make sure we fill struct acpi_gpio_info

The previous refactoring missed the filling of the struct acpi_gpio_info
and that's how the lot of the code got eliminated. Restore those pieces
by passing the pointer all down in the call stack.

With this, the code grows by ~6%, but in conjunction with the previous
refactoring it still gives -387 bytes

add/remove: 2/0 grow/shrink: 5/1 up/down: 852/-35 (817)
Function                                     old     new   delta
acpi_dev_gpio_irq_wake_get_by                129     695    +566
acpi_find_gpio                               216     354    +138
acpi_find_gpio.__UNIQUE_ID_ddebug504           -      56     +56
acpi_dev_gpio_irq_wake_get_by.__UNIQUE_ID_ddebug506       -      56     +56
acpi_populate_gpio_lookup                    536     548     +12
acpi_gpio_property_lookup                    414     426     +12
acpi_get_gpiod_by_index                      307     319     +12
__acpi_find_gpio                             638     603     -35
Total: Before=14154, After=14971, chg +5.77%

As a positive side effect, it improves memory footprint for
struct acpi_gpio_lookup. `pahole` difference before and after:

-       /* size: 64, cachelines: 1, members: 4 */
-       /* member types with holes: 1, total: 1 */

+       /* size: 32, cachelines: 1, members: 4 */

Reported-by: Kees Bakker <kees@ijzerbout.nl>
Closes: https://lore.kernel.org/r/9715c8dd-38df-48fd-a9d1-7a78163dc989@ijzerbout.nl
Fixes: 8b4f52ef7a41 ("gpiolib: acpi: Deduplicate some code in __acpi_find_gpio()")
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/gpio/gpiolib-acpi.c