Skip to content

Commit

Permalink
ACPICA: Remove some code duplication from acpi_ev_address_space_dispatch
Browse files Browse the repository at this point in the history
ACPICA commit 383f50ff8cb7424ca16a6c0234f103b41d4a783e

The handling of the space_id == ACPI_ADR_SPACE_GSBUS and
space_id == ACPI_ADR_SPACE_GPIO cases is almost identical,
fold the 2 cases into 1 to remove some code duplication.

Link: acpica/acpica@383f50ff
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Erik Kaneda <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
jwrdegoede authored and rafaeljw committed Feb 19, 2021
1 parent c27f3d0 commit 8f6493d
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions drivers/acpi/acpica/evregion.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
* the previous Connection)
* 2) bit_width is the actual bit length of the field (number of pins)
*/
if ((region_obj->region.space_id == ACPI_ADR_SPACE_GSBUS) &&
if ((region_obj->region.space_id == ACPI_ADR_SPACE_GSBUS ||
region_obj->region.space_id == ACPI_ADR_SPACE_GPIO) &&
context && field_obj) {

status =
Expand All @@ -260,25 +261,11 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
context->connection = field_obj->field.resource_buffer;
context->length = field_obj->field.resource_length;
context->access_length = field_obj->field.access_length;
}
if ((region_obj->region.space_id == ACPI_ADR_SPACE_GPIO) &&
context && field_obj) {

status =
acpi_os_acquire_mutex(context_mutex, ACPI_WAIT_FOREVER);
if (ACPI_FAILURE(status)) {
goto re_enter_interpreter;
if (region_obj->region.space_id == ACPI_ADR_SPACE_GPIO) {
address = field_obj->field.pin_number_index;
bit_width = field_obj->field.bit_length;
}

context_locked = TRUE;

/* Get the Connection (resource_template) buffer */

context->connection = field_obj->field.resource_buffer;
context->length = field_obj->field.resource_length;
context->access_length = field_obj->field.access_length;
address = field_obj->field.pin_number_index;
bit_width = field_obj->field.bit_length;
}

/* Call the handler */
Expand Down

0 comments on commit 8f6493d

Please sign in to comment.