Skip to content

Commit 7c010d4

Browse files
committed
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 <[email protected]> Closes: https://lore.kernel.org/r/[email protected] Fixes: 8b4f52e ("gpiolib: acpi: Deduplicate some code in __acpi_find_gpio()") Acked-by: Mika Westerberg <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
1 parent f89a915 commit 7c010d4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/gpio/gpiolib-acpi.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,8 @@ static int acpi_gpio_update_gpiod_lookup_flags(unsigned long *lookupflags,
743743
}
744744

745745
struct acpi_gpio_lookup {
746-
struct acpi_gpio_info info;
747746
struct acpi_gpio_params params;
747+
struct acpi_gpio_info *info;
748748
struct gpio_desc *desc;
749749
int n;
750750
};
@@ -753,7 +753,7 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)
753753
{
754754
struct acpi_gpio_lookup *lookup = data;
755755
struct acpi_gpio_params *params = &lookup->params;
756-
struct acpi_gpio_info *info = &lookup->info;
756+
struct acpi_gpio_info *info = lookup->info;
757757

758758
if (ares->type != ACPI_RESOURCE_TYPE_GPIO)
759759
return 1;
@@ -807,7 +807,7 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)
807807

808808
static int acpi_gpio_resource_lookup(struct acpi_gpio_lookup *lookup)
809809
{
810-
struct acpi_gpio_info *info = &lookup->info;
810+
struct acpi_gpio_info *info = lookup->info;
811811
struct acpi_device *adev = info->adev;
812812
struct list_head res_list;
813813
int ret;
@@ -833,7 +833,7 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode, const char *p
833833
{
834834
struct fwnode_reference_args args;
835835
struct acpi_gpio_params *params = &lookup->params;
836-
struct acpi_gpio_info *info = &lookup->info;
836+
struct acpi_gpio_info *info = lookup->info;
837837
unsigned int index = params->crs_entry_index;
838838
unsigned int quirks = 0;
839839
int ret;
@@ -894,8 +894,8 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode, const char *p
894894
static int acpi_get_gpiod_by_index(struct acpi_device *adev, const char *propname,
895895
struct acpi_gpio_lookup *lookup)
896896
{
897-
struct acpi_gpio_info *info = &lookup->info;
898897
struct acpi_gpio_params *params = &lookup->params;
898+
struct acpi_gpio_info *info = lookup->info;
899899
int ret;
900900

901901
if (propname) {
@@ -976,6 +976,7 @@ __acpi_find_gpio(struct fwnode_handle *fwnode, const char *con_id, unsigned int
976976

977977
memset(&lookup, 0, sizeof(lookup));
978978
lookup.params.crs_entry_index = idx;
979+
lookup.info = info;
979980

980981
/* Try first from _DSD */
981982
for_each_gpio_property_name(propname, con_id) {

0 commit comments

Comments
 (0)