]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
gpiolib: acpi: Reduce memory footprint for struct acpi_gpio_params
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 3 Apr 2025 15:59:14 +0000 (18:59 +0300)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 7 Apr 2025 06:38:39 +0000 (09:38 +0300)
The line_index member in the struct acpi_gpio_params replicates
what is covered in the ACPI GpioIo() or GpioInt() resource.
The value there is limited to 16-bit one, so we don't really need
to have a full 32-bit storage for it. Together with followed
boolean the structure will be smaller.

add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-3 (-3)
Function                                     old     new   delta
acpi_gpio_property_lookup                    417     414      -3
Total: Before=15361, After=15358, chg -0.02%

`pahole` difference before and after:

- /* size: 12, cachelines: 1, members: 3 */
- /* padding: 3 */

+ /* size: 8, cachelines: 1, members: 3 */
+ /* padding: 1 */

Acked-by: Mika Westerberg <westeri@kernel.org>
Link: https://lore.kernel.org/r/20250403160034.2680485-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
include/linux/gpio/consumer.h

index 45b651c05b9c87f577862bfa6cc8d627366a7712..899179972bec6a6900ee9df6871598f42f4ebfa0 100644 (file)
@@ -587,7 +587,7 @@ struct gpio_desc *devm_fwnode_gpiod_get(struct device *dev,
 
 struct acpi_gpio_params {
        unsigned int crs_entry_index;
-       unsigned int line_index;
+       unsigned short line_index;
        bool active_low;
 };