[PATCH v2 3/6] gpiolib: acpi: Reduce memory footprint for struct acpi_gpio_params
From: Andy Shevchenko
Date: Thu Apr 03 2025 - 12:02:24 EST
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 */
Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
---
include/linux/gpio/consumer.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index 45b651c05b9c..899179972bec 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -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;
};
--
2.47.2