All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arc: use swap() to make code cleaner
@ 2021-11-10  3:07 ` Yihao Han
  0 siblings, 0 replies; 4+ messages in thread
From: Yihao Han @ 2021-11-10  3:07 UTC (permalink / raw)
  To: Vineet Gupta, Yihao Han, Jinchao Wang, dean.yang_cp,
	linux-snps-arc, linux-kernel
  Cc: kernel

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

Signed-off-by: Yihao Han <hanyihao@vivo.com>
---
 arch/arc/kernel/unwind.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/arch/arc/kernel/unwind.c b/arch/arc/kernel/unwind.c
index 9e28058cdba8..200270a94558 100644
--- a/arch/arc/kernel/unwind.c
+++ b/arch/arc/kernel/unwind.c
@@ -245,14 +245,9 @@ static void swap_eh_frame_hdr_table_entries(void *p1, void *p2, int size)
 {
 	struct eh_frame_hdr_table_entry *e1 = p1;
 	struct eh_frame_hdr_table_entry *e2 = p2;
-	unsigned long v;
-
-	v = e1->start;
-	e1->start = e2->start;
-	e2->start = v;
-	v = e1->fde;
-	e1->fde = e2->fde;
-	e2->fde = v;
+
+	swap(e1->start, e2->start);
+	swap(e1->fde, e2->fde);
 }
 
 static void init_unwind_hdr(struct unwind_table *table,
-- 
2.17.1


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

* [PATCH] arc: use swap() to make code cleaner
@ 2021-11-10  3:07 ` Yihao Han
  0 siblings, 0 replies; 4+ messages in thread
From: Yihao Han @ 2021-11-10  3:07 UTC (permalink / raw)
  To: Vineet Gupta, Yihao Han, Jinchao Wang, dean.yang_cp,
	linux-snps-arc, linux-kernel
  Cc: kernel

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

Signed-off-by: Yihao Han <hanyihao@vivo.com>
---
 arch/arc/kernel/unwind.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/arch/arc/kernel/unwind.c b/arch/arc/kernel/unwind.c
index 9e28058cdba8..200270a94558 100644
--- a/arch/arc/kernel/unwind.c
+++ b/arch/arc/kernel/unwind.c
@@ -245,14 +245,9 @@ static void swap_eh_frame_hdr_table_entries(void *p1, void *p2, int size)
 {
 	struct eh_frame_hdr_table_entry *e1 = p1;
 	struct eh_frame_hdr_table_entry *e2 = p2;
-	unsigned long v;
-
-	v = e1->start;
-	e1->start = e2->start;
-	e2->start = v;
-	v = e1->fde;
-	e1->fde = e2->fde;
-	e2->fde = v;
+
+	swap(e1->start, e2->start);
+	swap(e1->fde, e2->fde);
 }
 
 static void init_unwind_hdr(struct unwind_table *table,
-- 
2.17.1


_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

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

* Re: [PATCH] arc: use swap() to make code cleaner
  2021-11-10  3:07 ` Yihao Han
@ 2021-12-29  3:50   ` Vineet Gupta
  -1 siblings, 0 replies; 4+ messages in thread
From: Vineet Gupta @ 2021-12-29  3:50 UTC (permalink / raw)
  To: Yihao Han, Vineet Gupta, Jinchao Wang, dean.yang_cp,
	linux-snps-arc, linux-kernel
  Cc: kernel

On 11/9/21 7:07 PM, Yihao Han wrote:
> Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
> opencoding it.
> 
> Signed-off-by: Yihao Han<hanyihao@vivo.com>

Added to ARC tree.

Thx,
-Vineet

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

* Re: [PATCH] arc: use swap() to make code cleaner
@ 2021-12-29  3:50   ` Vineet Gupta
  0 siblings, 0 replies; 4+ messages in thread
From: Vineet Gupta @ 2021-12-29  3:50 UTC (permalink / raw)
  To: Yihao Han, Vineet Gupta, Jinchao Wang, dean.yang_cp,
	linux-snps-arc, linux-kernel
  Cc: kernel

On 11/9/21 7:07 PM, Yihao Han wrote:
> Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
> opencoding it.
> 
> Signed-off-by: Yihao Han<hanyihao@vivo.com>

Added to ARC tree.

Thx,
-Vineet

_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

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

end of thread, other threads:[~2021-12-29  3:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-10  3:07 [PATCH] arc: use swap() to make code cleaner Yihao Han
2021-11-10  3:07 ` Yihao Han
2021-12-29  3:50 ` Vineet Gupta
2021-12-29  3:50   ` Vineet Gupta

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.