[PATCH v5 4/7] llist: simplify __llist_del_all
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: linux-alpha@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-snps-arc@xxxxxxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-hexagon@xxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, loongarch@xxxxxxxxxxxxxxx, linux-m68k@xxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, openrisc@xxxxxxxxxxxxxxxxxxxx, linux-parisc@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, linux-riscv@xxxxxxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, linux-sh@xxxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, linux-xtensa@xxxxxxxxxxxxxxxx, intel-gfx@xxxxxxxxxxxxxxxxxxxxx, dri-devel@xxxxxxxxxxxxxxxxxxxxx
- Subject: [PATCH v5 4/7] llist: simplify __llist_del_all
- From: Andrzej Hajda <andrzej.hajda@xxxxxxxxx>
- Date: Wed, 18 Jan 2023 16:44:47 +0100
- Cc: Andrzej Hajda <andrzej.hajda@xxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Boqun Feng <boqun.feng@xxxxxxxxx>, Mark Rutland <mark.rutland@xxxxxxx>
- In-reply-to: <20230118154450.73842-1-andrzej.hajda@intel.com>
- Organization: Intel Technology Poland sp. z o.o. - ul. Slowackiego 173, 80-298 Gdansk - KRS 101882 - NIP 957-07-52-316
- References: <20230118153529.57695-1-andrzej.hajda@intel.com> <20230118154450.73842-1-andrzej.hajda@intel.com>
llist_del_all uses xchg, let's use __xchg here.
Signed-off-by: Andrzej Hajda <andrzej.hajda@xxxxxxxxx>
---
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
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]