All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPICA: use swap() to make code cleaner
@ 2022-02-15  0:50 davidcomponentone
  2022-02-21 19:18   ` [Devel] " Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: davidcomponentone @ 2022-02-15  0:50 UTC (permalink / raw)
  To: robert.moore
  Cc: davidcomponentone, rafael.j.wysocki, lenb, linux-acpi, devel,
	linux-kernel, Yang Guang, Zeal Robot

From: Yang Guang <yang.guang5@zte.com.cn>

Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
opencoding it.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
Signed-off-by: David Yang <davidcomponentone@gmail.com>
---
 drivers/acpi/acpica/nsrepair2.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c
index 14b71b41e845..ac6a5397660f 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;
 
@@ -892,9 +891,7 @@ acpi_ns_sort_list(union acpi_operand_object **elements,
 			    || ((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;
+				swap(elements[j - 1], elements[j]);
 			}
 		}
 	}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ACPICA: use swap() to make code cleaner
@ 2022-02-21 19:18   ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2022-02-21 19:18 UTC (permalink / raw)
  To: davidcomponentone
  Cc: Robert Moore, Rafael Wysocki, Len Brown, ACPI Devel Maling List,
	open list:ACPI COMPONENT ARCHITECTURE (ACPICA),
	Linux Kernel Mailing List, Yang Guang, Zeal Robot

On Tue, Feb 15, 2022 at 1:52 AM <davidcomponentone@gmail.com> wrote:
>
> From: Yang Guang <yang.guang5@zte.com.cn>
>
> Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
> opencoding it.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
> Signed-off-by: David Yang <davidcomponentone@gmail.com>
> ---
>  drivers/acpi/acpica/nsrepair2.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c
> index 14b71b41e845..ac6a5397660f 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;
>
> @@ -892,9 +891,7 @@ acpi_ns_sort_list(union acpi_operand_object **elements,
>                             || ((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;
> +                               swap(elements[j - 1], elements[j]);
>                         }
>                 }
>         }
> --

This is an ACPICA change that should be routed through the upstream
project at https://github.com/acpica/acpica, but there is no
counterpart of swap() in the upstream code base.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Devel] Re: [PATCH] ACPICA: use swap() to make code cleaner
@ 2022-02-21 19:18   ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2022-02-21 19:18 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 1766 bytes --]

On Tue, Feb 15, 2022 at 1:52 AM <davidcomponentone(a)gmail.com> wrote:
>
> From: Yang Guang <yang.guang5(a)zte.com.cn>
>
> Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
> opencoding it.
>
> Reported-by: Zeal Robot <zealci(a)zte.com.cn>
> Signed-off-by: Yang Guang <yang.guang5(a)zte.com.cn>
> Signed-off-by: David Yang <davidcomponentone(a)gmail.com>
> ---
>  drivers/acpi/acpica/nsrepair2.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c
> index 14b71b41e845..ac6a5397660f 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;
>
> @@ -892,9 +891,7 @@ acpi_ns_sort_list(union acpi_operand_object **elements,
>                             || ((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;
> +                               swap(elements[j - 1], elements[j]);
>                         }
>                 }
>         }
> --

This is an ACPICA change that should be routed through the upstream
project at https://github.com/acpica/acpica, but there is no
counterpart of swap() in the upstream code base.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-21 19:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-15  0:50 [PATCH] ACPICA: use swap() to make code cleaner davidcomponentone
2022-02-21 19:18 ` Rafael J. Wysocki
2022-02-21 19:18   ` [Devel] " Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.