Skip to contentSkip to conversation

xarray: Clean up xarray.h

PATCH Applied Andy Shevchenko 1 participant 3 messages Apr 23, 2024

Subsystems (2)

v1 of 2 Applied 2/2 Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover xarray: Clean up xarray.h

Main portion of this change is to get rid of kernel.h included into other globally available headers. This decreases a dependency hell degree. The first patch makes it possible to avoid math.h to be included as bitops.h is implied by bitmap.h.

Andy Shevchenko (2):
xarray: Use BITS_PER_LONGS()
xarray: Don't use "proxy" headers

 include/linux/xarray.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
#1 lore raw

PATCH 1/2 xarray: Use BITS_PER_LONGS()

Use BITS_PER_LONGS() instead of open coded variant.

---
 include/linux/xarray.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/xarray.h +1 -1
index d9d479334c9e..d54a1e98b0ca 100644
@@ -1146,7 +1146,7 @@ static inline void xa_release(struct xarray *xa, unsigned long index)
 #define XA_CHUNK_SIZE		(1UL << XA_CHUNK_SHIFT)
 #define XA_CHUNK_MASK		(XA_CHUNK_SIZE - 1)
 #define XA_MAX_MARKS		3
-#define XA_MARK_LONGS		DIV_ROUND_UP(XA_CHUNK_SIZE, BITS_PER_LONG)
+#define XA_MARK_LONGS		BITS_TO_LONGS(XA_CHUNK_SIZE)
 
 /*
  * @count is the count of every non-NULL element in the ->slots array
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
#2 lore raw

PATCH 2/2 xarray: Don't use "proxy" headers

In reply to Andy Shevchenko

Update header inclusions to follow IWYU (Include What You Use) principle.

---
 include/linux/xarray.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
include/linux/xarray.h +5 -1
index d54a1e98b0ca..d2e4d3624689 100644
@@ -12,14 +12,18 @@
 #include <linux/bitmap.h>
 #include <linux/bug.h>
 #include <linux/compiler.h>
+#include <linux/err.h>
 #include <linux/gfp.h>
 #include <linux/kconfig.h>
-#include <linux/kernel.h>
+#include <linux/limits.h>
+#include <linux/lockdep.h>
 #include <linux/rcupdate.h>
 #include <linux/sched/mm.h>
 #include <linux/spinlock.h>
 #include <linux/types.h>
 
+struct list_lru;
+
 /*
  * The bottom two bits of the entry determine how the XArray interprets
  * the contents:
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac