linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] ACPICA: Use swap() instead of open coding it
       [not found] <20220704140614.39763-1-tanzhongjun@coolpad.com>
@ 2022-07-04 19:16 ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2022-07-04 19:16 UTC (permalink / raw)
  To: Tan Zhongjun, robert.moore, lenb; +Cc: linux-acpi, devel, linux-kernel

On 7/4/2022 4:06 PM, Tan Zhongjun wrote:
> Use swap() instead of open coding it
>
> Signed-off-by: Tan Zhongjun <tanzhongjun@coolpad.com>

Changes in the ACPICA files need to be routed through the upstream 
ACPICA project at github.

Please submit a pull request in there.


> ---
>   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 dd533c887e3a..3735ba06ea16 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]);
>   			}
>   		}
>   	}



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

* Re: [PATCH] ACPICA: Use swap() instead of open coding it
  2024-02-02  8:14 Jiapeng Chong
@ 2024-02-02 16:04 ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2024-02-02 16:04 UTC (permalink / raw)
  To: Jiapeng Chong
  Cc: robert.moore, rafael.j.wysocki, lenb, linux-acpi, acpica-devel,
	linux-kernel, Abaci Robot

On Fri, Feb 2, 2024 at 9:15 AM Jiapeng Chong
<jiapeng.chong@linux.alibaba.com> wrote:
>
> Swap is a function interface that provides exchange function. To avoid
> code duplication, we can use swap function.
>
> ./drivers/acpi/acpica/nsrepair2.c:896:33-34: WARNING opportunity for swap().

In order to modify the ACPICA code in the Linux kernel, you need to
submit a corresponding pull request to the upstream ACPICA project on
GitHub.  Once that pull request has been merged, please send the Linux
patch with a Link: tag pointing to the upstream ACPICA pull request
corresponding to it.

Thanks!

> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=8168
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.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 1bb7b71f07f1..ccd89a82a4e6 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], elements[j - 1]);
>                         }
>                 }
>         }
> --
> 2.20.1.7.g153144c
>
>

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

* [PATCH] ACPICA: Use swap() instead of open coding it
@ 2024-02-02  8:14 Jiapeng Chong
  2024-02-02 16:04 ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Jiapeng Chong @ 2024-02-02  8:14 UTC (permalink / raw)
  To: robert.moore
  Cc: rafael.j.wysocki, lenb, linux-acpi, acpica-devel, linux-kernel,
	Jiapeng Chong, Abaci Robot

Swap is a function interface that provides exchange function. To avoid
code duplication, we can use swap function.

./drivers/acpi/acpica/nsrepair2.c:896:33-34: WARNING opportunity for swap().

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=8168
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.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 1bb7b71f07f1..ccd89a82a4e6 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], elements[j - 1]);
 			}
 		}
 	}
-- 
2.20.1.7.g153144c


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

end of thread, other threads:[~2024-02-02 16:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20220704140614.39763-1-tanzhongjun@coolpad.com>
2022-07-04 19:16 ` [PATCH] ACPICA: Use swap() instead of open coding it Rafael J. Wysocki
2024-02-02  8:14 Jiapeng Chong
2024-02-02 16:04 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).