Message ID | 20240626135054.1527935-1-prabhakar.pujeri@gmail.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
Series | ACPI: Optimize Namespace List Sorting in nsrepair2.c | expand |
On Wed, Jun 26, 2024 at 3:51 PM Prabhakar Pujeri <prabhakar.pujeri@gmail.com> wrote: > > This patch optimizes the namespace list sorting in acpi_ns_sort_list by > replacing the direct element swap with the swap() helper function. This > approach maintains functionality while improving code clarity and > potentially enhancing performance. > > this patch generated using coccinelle. > > > Signed-off-by: Prabhakar Pujeri <prabhakar.pujeri@gmail.com> > --- > drivers/acpi/acpica/nsrepair2.c | 8 ++------ ACPICA code changes need to be submitted to the upstream ACPICA project on GitHub. Once accepted there, a Linux patch can be submitted with a Link: tag pointing to the corresponding upstream ACPICA commit. > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c > index 1bb7b71f07f1..5d56b2fd9151 100644 > --- a/drivers/acpi/acpica/nsrepair2.c > +++ b/drivers/acpi/acpica/nsrepair2.c > @@ -875,7 +875,6 @@ acpi_ns_sort_list(union acpi_operand_object **elements, > { > union acpi_operand_object *obj_desc1; > union acpi_operand_object *obj_desc2; > - union acpi_operand_object *temp_obj; > u32 i; > u32 j; > > @@ -891,11 +890,8 @@ acpi_ns_sort_list(union acpi_operand_object **elements, > obj_desc2->integer.value)) > || ((sort_direction == ACPI_SORT_DESCENDING) > && (obj_desc1->integer.value < > - obj_desc2->integer.value))) { > - temp_obj = elements[j - 1]; > - elements[j - 1] = elements[j]; > - elements[j] = temp_obj; > - } > + obj_desc2->integer.value))) > + swap(elements[j - 1], elements[j]); > } > } > } > -- > 2.45.2 > >
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c index 1bb7b71f07f1..5d56b2fd9151 100644 --- a/drivers/acpi/acpica/nsrepair2.c +++ b/drivers/acpi/acpica/nsrepair2.c @@ -875,7 +875,6 @@ acpi_ns_sort_list(union acpi_operand_object **elements, { union acpi_operand_object *obj_desc1; union acpi_operand_object *obj_desc2; - union acpi_operand_object *temp_obj; u32 i; u32 j; @@ -891,11 +890,8 @@ acpi_ns_sort_list(union acpi_operand_object **elements, obj_desc2->integer.value)) || ((sort_direction == ACPI_SORT_DESCENDING) && (obj_desc1->integer.value < - obj_desc2->integer.value))) { - temp_obj = elements[j - 1]; - elements[j - 1] = elements[j]; - elements[j] = temp_obj; - } + obj_desc2->integer.value))) + swap(elements[j - 1], elements[j]); } } }
This patch optimizes the namespace list sorting in acpi_ns_sort_list by replacing the direct element swap with the swap() helper function. This approach maintains functionality while improving code clarity and potentially enhancing performance. this patch generated using coccinelle. Signed-off-by: Prabhakar Pujeri <prabhakar.pujeri@gmail.com> --- drivers/acpi/acpica/nsrepair2.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)