linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: use swap() to make code cleaner
@ 2021-11-04  6:17 davidcomponentone
  2021-11-04 10:06 ` Stephen Rothwell
  0 siblings, 1 reply; 7+ messages in thread
From: davidcomponentone @ 2021-11-04  6:17 UTC (permalink / raw)
  To: mpe
  Cc: sfr, sxwjean, Zeal Robot, davidcomponentone, linux-kernel, nathan,
	yang.guang5, paulus, aneesh.kumar, linuxppc-dev

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>
---
 arch/powerpc/kernel/fadump.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index b7ceb041743c..5b40e2d46090 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -1265,7 +1265,6 @@ static void fadump_release_reserved_area(u64 start, u64 end)
 static void sort_and_merge_mem_ranges(struct fadump_mrange_info *mrange_info)
 {
 	struct fadump_memory_range *mem_ranges;
-	struct fadump_memory_range tmp_range;
 	u64 base, size;
 	int i, j, idx;
 
@@ -1281,9 +1280,7 @@ static void sort_and_merge_mem_ranges(struct fadump_mrange_info *mrange_info)
 				idx = j;
 		}
 		if (idx != i) {
-			tmp_range = mem_ranges[idx];
-			mem_ranges[idx] = mem_ranges[i];
-			mem_ranges[i] = tmp_range;
+			swap(mem_ranges[idx], mem_ranges[i]);
 		}
 	}
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH] powerpc: use swap() to make code cleaner
@ 2021-12-18  1:59 davidcomponentone
  2021-12-26 21:52 ` Michael Ellerman
  0 siblings, 1 reply; 7+ messages in thread
From: davidcomponentone @ 2021-12-18  1:59 UTC (permalink / raw)
  To: benh
  Cc: Zeal Robot, davidcomponentone, linux-kernel, yang.guang5, paulus,
	linuxppc-dev

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: David Yang <davidcomponentone@gmail.com>
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
---
 arch/powerpc/platforms/powermac/pic.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
index 4921bccf0376..75d8d7ec53db 100644
--- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -311,11 +311,8 @@ static void __init pmac_pic_probe_oldstyle(void)
 
 		/* Check ordering of master & slave */
 		if (of_device_is_compatible(master, "gatwick")) {
-			struct device_node *tmp;
 			BUG_ON(slave == NULL);
-			tmp = master;
-			master = slave;
-			slave = tmp;
+			swap(master, slave);
 		}
 
 		/* We found a slave */
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH] powerpc: use swap() to make code cleaner
@ 2021-11-04  1:09 davidcomponentone
  0 siblings, 0 replies; 7+ messages in thread
From: davidcomponentone @ 2021-11-04  1:09 UTC (permalink / raw)
  To: benh
  Cc: zealci, davidcomponentone, linux-kernel, yang.guang5, paulus,
	linuxppc-dev

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>
---
 arch/powerpc/platforms/powermac/pic.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
index 4921bccf0376..75d8d7ec53db 100644
--- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -311,11 +311,8 @@ static void __init pmac_pic_probe_oldstyle(void)
 
 		/* Check ordering of master & slave */
 		if (of_device_is_compatible(master, "gatwick")) {
-			struct device_node *tmp;
 			BUG_ON(slave == NULL);
-			tmp = master;
-			master = slave;
-			slave = tmp;
+			swap(master, slave);
 		}
 
 		/* We found a slave */
-- 
2.30.2


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

end of thread, other threads:[~2021-12-26 21:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-04  6:17 [PATCH] powerpc: use swap() to make code cleaner davidcomponentone
2021-11-04 10:06 ` Stephen Rothwell
2021-11-04 11:33   ` Segher Boessenkool
2021-11-04 20:26     ` Stephen Rothwell
  -- strict thread matches above, loose matches on Subject: below --
2021-12-18  1:59 davidcomponentone
2021-12-26 21:52 ` Michael Ellerman
2021-11-04  1:09 davidcomponentone

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).