diff mbox series

arc: use swap() to make code cleaner

Message ID 20211110030715.21681-1-hanyihao@vivo.com
State New
Headers show
Series arc: use swap() to make code cleaner | expand

Commit Message

Yihao Han Nov. 10, 2021, 3:07 a.m. UTC
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(-)

Comments

Vineet Gupta Dec. 29, 2021, 3:50 a.m. UTC | #1
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
diff mbox series

Patch

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,