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

Woody Zhang posted 5 patches 1 year, 5 months ago
[PATCH 3/5] list_bl: remove lock check in hlist_bl_set_first
Posted by Woody Zhang 1 year, 5 months ago
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@gmail.com>
---
 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