[PATCH v1 1/2] gpiolib: acpi: Use temporary variable for struct acpi_gpio_info

Andy Shevchenko
2025-04-09T13:29:47Z

Use temporary variable to access the struct acpi_gpio_info members.
This will help further changes to be cleaner. No functional change
intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpio/gpiolib-acpi.c | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index bebb74528cfe..5b6344f0d065 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -752,6 +752,7 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)
{
struct acpi_gpio_lookup *lookup = data;
struct acpi_gpio_params *params = &lookup->params;
+ struct acpi_gpio_info *info = &lookup->info;

if (ares->type != ACPI_RESOURCE_TYPE_GPIO)
return 1;
@@ -762,7 +763,7 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)
struct gpio_desc *desc;
u16 pin_index;

- if (lookup->info.quirks & ACPI_GPIO_QUIRK_ONLY_GPIOIO && gpioint)
+ if (info->quirks & ACPI_GPIO_QUIRK_ONLY_GPIOIO && gpioint)
params->crs_entry_index++;

if (lookup->n++ != params->crs_entry_index)
@@ -772,16 +773,16 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)
if (pin_index >= agpio->pin_table_length)
return 1;

- if (lookup->info.quirks & ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER)
+ if (info->quirks & ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER)
desc = gpio_to_desc(agpio->pin_table[pin_index]);
else
desc = acpi_get_gpiod(agpio->resource_source.string_ptr,
agpio->pin_table[pin_index]);
lookup->desc = desc;
- lookup->info.pin_config = agpio->pin_config;
- lookup->info.debounce = agpio->debounce_timeout;
- lookup->info.gpioint = gpioint;
- lookup->info.wake_capable = acpi_gpio_irq_is_wake(&lookup->info.adev->dev, agpio);
+ info->pin_config = agpio->pin_config;
+ info->debounce = agpio->debounce_timeout;
+ info->gpioint = gpioint;
+ info->wake_capable = acpi_gpio_irq_is_wake(&info->adev->dev, agpio);

/*
* Polarity and triggering are only specified for GpioInt
@@ -790,14 +791,14 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)
* - ACPI_ACTIVE_LOW == GPIO_ACTIVE_LOW
* - ACPI_ACTIVE_HIGH == GPIO_ACTIVE_HIGH
*/
- if (lookup->info.gpioint) {
- lookup->info.polarity = agpio->polarity;
- lookup->info.triggering = agpio->triggering;
+ if (info->gpioint) {
+ info->polarity = agpio->polarity;
+ info->triggering = agpio->triggering;
} else {
- lookup->info.polarity = params->active_low;
+ info->polarity = params->active_low;
}

- lookup->info.flags = acpi_gpio_to_gpiod_flags(agpio, lookup->info.polarity);
+ info->flags = acpi_gpio_to_gpiod_flags(agpio, info->polarity);
}

return 1;
@@ -805,7 +806,8 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)

static int acpi_gpio_resource_lookup(struct acpi_gpio_lookup *lookup)
{
- struct acpi_device *adev = lookup->info.adev;
+ struct acpi_gpio_info *info = &lookup->info;
+ struct acpi_device *adev = info->adev;
struct list_head res_list;
int ret;

@@ -830,6 +832,7 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode, const char *p
{
struct fwnode_reference_args args;
struct acpi_gpio_params *params = &lookup->params;
+ struct acpi_gpio_info *info = &lookup->info;
unsigned int index = params->crs_entry_index;
unsigned int quirks = 0;
int ret;
@@ -857,8 +860,8 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode, const char *p
params->line_index = args.args[1];
params->active_low = !!args.args[2];

- lookup->info.adev = to_acpi_device_node(args.fwnode);
- lookup->info.quirks = quirks;
+ info->adev = to_acpi_device_node(args.fwnode);
+ info->quirks = quirks;

return 0;
}
--
2.47.2