[PATCH 3/5] list_bl: remove lock check in hlist_bl_set_first

From: Woody Zhang
Date: Wed Aug 21 2024 - 19:06:39 EST


This allows it to be used in situations when locking is not required,
e.g. in early initialization phase.

Signed-off-by: Woody Zhang <woodyzhang666@xxxxxxxxx>
---
include/linux/list_bl.h | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/include/linux/list_bl.h b/include/linux/list_bl.h
index 7ce411567fe5..d25c659f6635 100644
--- a/include/linux/list_bl.h
+++ b/include/linux/list_bl.h
@@ -63,10 +63,9 @@ static inline struct hlist_bl_node *hlist_bl_first(struct hlist_bl_head *h)
static inline void hlist_bl_set_first(struct hlist_bl_head *h,
struct hlist_bl_node *n)
{
- LIST_BL_BUG_ON((unsigned long)n & LIST_BL_LOCKMASK);
- LIST_BL_BUG_ON(((unsigned long)h->first & LIST_BL_LOCKMASK) !=
- LIST_BL_LOCKMASK);
- h->first = (struct hlist_bl_node *)((unsigned long)n | LIST_BL_LOCKMASK);
+ LIST_BL_BUG_ON((uintptr_t)n & LIST_BL_LOCKMASK);
+ h->first = (struct hlist_bl_node *)
+ ((uintptr_t)n | ((uintptr_t)h->first & LIST_BL_LOCKMASK));
}

static inline bool hlist_bl_empty(const struct hlist_bl_head *h)
--
2.45.2