Skip to content

Commit 0e6078c

Browse files
Guo Zhengkuirafaeljw
authored andcommitted
ACPI: processor idle: Use swap() instead of open coding it
Address the following coccicheck warning: ./drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c:914:40-41: WARNING opportunity for swap(). by using swap() for the swapping of variable values and drop the tmp variable that is not needed any more. Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com> [ rjw: Subject and changelog rewrite ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 6fd1345 commit 0e6078c

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/acpi/processor_idle.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/tick.h>
2121
#include <linux/cpuidle.h>
2222
#include <linux/cpu.h>
23+
#include <linux/minmax.h>
2324
#include <acpi/processor.h>
2425

2526
/*
@@ -400,13 +401,10 @@ static int acpi_cst_latency_cmp(const void *a, const void *b)
400401
static void acpi_cst_latency_swap(void *a, void *b, int n)
401402
{
402403
struct acpi_processor_cx *x = a, *y = b;
403-
u32 tmp;
404404

405405
if (!(x->valid && y->valid))
406406
return;
407-
tmp = x->latency;
408-
x->latency = y->latency;
409-
y->latency = tmp;
407+
swap(x->latency, y->latency);
410408
}
411409

412410
static int acpi_processor_power_verify(struct acpi_processor *pr)

0 commit comments

Comments
 (0)