[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230118154450.73842-4-andrzej.hajda@intel.com>
Date: Wed, 18 Jan 2023 16:44:47 +0100
From: Andrzej Hajda <andrzej.hajda@...el.com>
To: linux-alpha@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-snps-arc@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org,
linux-hexagon@...r.kernel.org, linux-ia64@...r.kernel.org,
loongarch@...ts.linux.dev, linux-m68k@...ts.linux-m68k.org,
linux-mips@...r.kernel.org, openrisc@...ts.librecores.org,
linux-parisc@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
linux-riscv@...ts.infradead.org, linux-s390@...r.kernel.org,
linux-sh@...r.kernel.org, sparclinux@...r.kernel.org,
linux-xtensa@...ux-xtensa.org, intel-gfx@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org
Cc: Andrzej Hajda <andrzej.hajda@...el.com>,
Arnd Bergmann <arnd@...db.de>,
Rodrigo Vivi <rodrigo.vivi@...el.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Boqun Feng <boqun.feng@...il.com>,
Mark Rutland <mark.rutland@....com>
Subject: [PATCH v5 4/7] llist: simplify __llist_del_all
llist_del_all uses xchg, let's use __xchg here.
Signed-off-by: Andrzej Hajda <andrzej.hajda@...el.com>
---
include/linux/llist.h | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/include/linux/llist.h b/include/linux/llist.h
index 85bda2d02d65be..4dc1d185ea98ab 100644
--- a/include/linux/llist.h
+++ b/include/linux/llist.h
@@ -50,6 +50,7 @@
#include <linux/atomic.h>
#include <linux/container_of.h>
+#include <linux/non-atomic/xchg.h>
#include <linux/stddef.h>
#include <linux/types.h>
@@ -241,10 +242,7 @@ static inline struct llist_node *llist_del_all(struct llist_head *head)
static inline struct llist_node *__llist_del_all(struct llist_head *head)
{
- struct llist_node *first = head->first;
-
- head->first = NULL;
- return first;
+ return __xchg(&head->first, NULL);
}
extern struct llist_node *llist_del_first(struct llist_head *head);
--
2.34.1
Powered by blists - more mailing lists