Skip to contentSkip to conversation

Fast kernel headers: reduce header dependencies

PATCH In review Max Kellermann 2 participants 37 messages Feb 12, 2024 Page 4 of 4

Subsystems (1506)
lore
Share & tools
lore
#8 lore raw

PATCH v5 8/35 maple_tree.h: move declarations to maple_tree_types.h

In reply to Max Kellermann

By providing declarations in a lean header, we can reduce header dependencies.

---
 include/linux/maple_tree.h       | 323 +----------------------------
 include/linux/maple_tree_types.h | 341 +++++++++++++++++++++++++++++++
 include/linux/mm.h               |   1 +
 include/linux/mm_types.h         |   2 +-
 4 files changed, 345 insertions(+), 322 deletions(-)
 create mode 100644 include/linux/maple_tree_types.h
include/linux/maple_tree.h +2 -321
index b3d63123b945..7f5dd33f4b94 100644
@@ -8,147 +8,13 @@
  *              Matthew Wilcox <[email protected]>
  */
 
+#include <linux/maple_tree_types.h>
+
 #include <linux/kernel.h>
 #include <linux/rcupdate.h>
 #include <linux/spinlock.h>
 /* #define CONFIG_MAPLE_RCU_DISABLED */
 
-/*
- * Allocated nodes are mutable until they have been inserted into the tree,
- * at which time they cannot change their type until they have been removed
- * from the tree and an RCU grace period has passed.
- *
- * Removed nodes have their ->parent set to point to themselves.  RCU readers
- * check ->parent before relying on the value that they loaded from the
- * slots array.  This lets us reuse the slots array for the RCU head.
- *
- * Nodes in the tree point to their parent unless bit 0 is set.
- */
-#if defined(CONFIG_64BIT) || defined(BUILD_VDSO32_64)
-/* 64bit sizes */
-#define MAPLE_NODE_SLOTS	31	/* 256 bytes including ->parent */
-#define MAPLE_RANGE64_SLOTS	16	/* 256 bytes */
-#define MAPLE_ARANGE64_SLOTS	10	/* 240 bytes */
-#define MAPLE_ALLOC_SLOTS	(MAPLE_NODE_SLOTS - 1)
-#else
-/* 32bit sizes */
-#define MAPLE_NODE_SLOTS	63	/* 256 bytes including ->parent */
-#define MAPLE_RANGE64_SLOTS	32	/* 256 bytes */
-#define MAPLE_ARANGE64_SLOTS	21	/* 240 bytes */
-#define MAPLE_ALLOC_SLOTS	(MAPLE_NODE_SLOTS - 2)
-#endif /* defined(CONFIG_64BIT) || defined(BUILD_VDSO32_64) */
-
-#define MAPLE_NODE_MASK		255UL
-
-/*
- * The node->parent of the root node has bit 0 set and the rest of the pointer
- * is a pointer to the tree itself.  No more bits are available in this pointer
- * (on m68k, the data structure may only be 2-byte aligned).
- *
- * Internal non-root nodes can only have maple_range_* nodes as parents.  The
- * parent pointer is 256B aligned like all other tree nodes.  When storing a 32
- * or 64 bit values, the offset can fit into 4 bits.  The 16 bit values need an
- * extra bit to store the offset.  This extra bit comes from a reuse of the last
- * bit in the node type.  This is possible by using bit 1 to indicate if bit 2
- * is part of the type or the slot.
- *
- * Once the type is decided, the decision of an allocation range type or a range
- * type is done by examining the immutable tree flag for the MAPLE_ALLOC_RANGE
- * flag.
- *
- *  Node types:
- *   0x??1 = Root
- *   0x?00 = 16 bit nodes
- *   0x010 = 32 bit nodes
- *   0x110 = 64 bit nodes
- *
- *  Slot size and location in the parent pointer:
- *   type  : slot location
- *   0x??1 : Root
- *   0x?00 : 16 bit values, type in 0-1, slot in 2-6
- *   0x010 : 32 bit values, type in 0-2, slot in 3-6
- *   0x110 : 64 bit values, type in 0-2, slot in 3-6
- */
-
-/*
- * This metadata is used to optimize the gap updating code and in reverse
- * searching for gaps or any other code that needs to find the end of the data.
- */
-struct maple_metadata {
-	unsigned char end;
-	unsigned char gap;
-};
-
-/*
- * Leaf nodes do not store pointers to nodes, they store user data.  Users may
- * store almost any bit pattern.  As noted above, the optimisation of storing an
- * entry at 0 in the root pointer cannot be done for data which have the bottom
- * two bits set to '10'.  We also reserve values with the bottom two bits set to
- * '10' which are below 4096 (ie 2, 6, 10 .. 4094) for internal use.  Some APIs
- * return errnos as a negative errno shifted right by two bits and the bottom
- * two bits set to '10', and while choosing to store these values in the array
- * is not an error, it may lead to confusion if you're testing for an error with
- * mas_is_err().
- *
- * Non-leaf nodes store the type of the node pointed to (enum maple_type in bits
- * 3-6), bit 2 is reserved.  That leaves bits 0-1 unused for now.
- *
- * In regular B-Tree terms, pivots are called keys.  The term pivot is used to
- * indicate that the tree is specifying ranges,  Pivots may appear in the
- * subtree with an entry attached to the value whereas keys are unique to a
- * specific position of a B-tree.  Pivot values are inclusive of the slot with
- * the same index.
- */
-
-struct maple_range_64 {
-	struct maple_pnode *parent;
-	unsigned long pivot[MAPLE_RANGE64_SLOTS - 1];
-	union {
-		void __rcu *slot[MAPLE_RANGE64_SLOTS];
-		struct {
-			void __rcu *pad[MAPLE_RANGE64_SLOTS - 1];
-			struct maple_metadata meta;
-		};
-	};
-};
-
-/*
- * At tree creation time, the user can specify that they're willing to trade off
- * storing fewer entries in a tree in return for storing more information in
- * each node.
- *
- * The maple tree supports recording the largest range of NULL entries available
- * in this node, also called gaps.  This optimises the tree for allocating a
- * range.
- */
-struct maple_arange_64 {
-	struct maple_pnode *parent;
-	unsigned long pivot[MAPLE_ARANGE64_SLOTS - 1];
-	void __rcu *slot[MAPLE_ARANGE64_SLOTS];
-	unsigned long gap[MAPLE_ARANGE64_SLOTS];
-	struct maple_metadata meta;
-};
-
-struct maple_alloc {
-	unsigned long total;
-	unsigned char node_count;
-	unsigned int request_count;
-	struct maple_alloc *slot[MAPLE_ALLOC_SLOTS];
-};
-
-struct maple_topiary {
-	struct maple_pnode *parent;
-	struct maple_enode *next; /* Overlaps the pivot */
-};
-
-enum maple_type {
-	maple_dense,
-	maple_leaf_64,
-	maple_range_64,
-	maple_arange_64,
-};
-
-
 /**
  * DOC: Maple tree flags
  *
@@ -181,7 +47,6 @@ enum maple_type {
 #define MAPLE_RESERVED_RANGE	4096
 
 #ifdef CONFIG_LOCKDEP
-typedef struct lockdep_map *lockdep_map_p;
 #define mt_lock_is_held(mt)                                             \
 	(!(mt)->ma_external_lock || lock_is_held((mt)->ma_external_lock))
 
@@ -194,36 +59,12 @@ typedef struct lockdep_map *lockdep_map_p;
 
 #define mt_on_stack(mt)			(mt).ma_external_lock = NULL
 #else
-typedef struct { /* nothing */ } lockdep_map_p;
 #define mt_lock_is_held(mt)		1
 #define mt_write_lock_is_held(mt)	1
 #define mt_set_external_lock(mt, lock)	do { } while (0)
 #define mt_on_stack(mt)			do { } while (0)
 #endif
 
-/*
- * If the tree contains a single entry at index 0, it is usually stored in
- * tree->ma_root.  To optimise for the page cache, an entry which ends in '00',
- * '01' or '11' is stored in the root, but an entry which ends in '10' will be
- * stored in a node.  Bits 3-6 are used to store enum maple_type.
- *
- * The flags are used both to store some immutable information about this tree
- * (set at tree creation time) and dynamic information set under the spinlock.
- *
- * Another use of flags are to indicate global states of the tree.  This is the
- * case with the MAPLE_USE_RCU flag, which indicates the tree is currently in
- * RCU mode.  This mode was added to allow the tree to reuse nodes instead of
- * re-allocating and RCU freeing nodes when there is a single user.
- */
-struct maple_tree {
-	union {
-		spinlock_t	ma_lock;
-		lockdep_map_p	ma_external_lock;
-	};
-	unsigned int	ma_flags;
-	void __rcu      *ma_root;
-};
-
 /**
  * MTREE_INIT() - Initialize a maple tree
  * @name: The maple tree name
@@ -260,56 +101,6 @@ struct maple_tree {
 		spin_lock_nested((&(mt)->ma_lock), subclass)
 #define mtree_unlock(mt)	spin_unlock((&(mt)->ma_lock))
 
-/*
- * The Maple Tree squeezes various bits in at various points which aren't
- * necessarily obvious.  Usually, this is done by observing that pointers are
- * N-byte aligned and thus the bottom log_2(N) bits are available for use.  We
- * don't use the high bits of pointers to store additional information because
- * we don't know what bits are unused on any given architecture.
- *
- * Nodes are 256 bytes in size and are also aligned to 256 bytes, giving us 8
- * low bits for our own purposes.  Nodes are currently of 4 types:
- * 1. Single pointer (Range is 0-0)
- * 2. Non-leaf Allocation Range nodes
- * 3. Non-leaf Range nodes
- * 4. Leaf Range nodes All nodes consist of a number of node slots,
- *    pivots, and a parent pointer.
- */
-
-struct maple_node {
-	union {
-		struct {
-			struct maple_pnode *parent;
-			void __rcu *slot[MAPLE_NODE_SLOTS];
-		};
-		struct {
-			void *pad;
-			struct rcu_head rcu;
-			struct maple_enode *piv_parent;
-			unsigned char parent_slot;
-			enum maple_type type;
-			unsigned char slot_len;
-			unsigned int ma_flags;
-		};
-		struct maple_range_64 mr64;
-		struct maple_arange_64 ma64;
-		struct maple_alloc alloc;
-	};
-};
-
-/*
- * More complicated stores can cause two nodes to become one or three and
- * potentially alter the height of the tree.  Either half of the tree may need
- * to be rebalanced against the other.  The ma_topiary struct is used to track
- * which nodes have been 'cut' from the tree so that the change can be done
- * safely at a later date.  This is done to support RCU.
- */
-struct ma_topiary {
-	struct maple_enode *head;
-	struct maple_enode *tail;
-	struct maple_tree *mtree;
-};
-
 void *mtree_load(struct maple_tree *mt, unsigned long index);
 
 int mtree_insert(struct maple_tree *mt, unsigned long index,
@@ -349,105 +140,6 @@ static inline bool mtree_empty(const struct maple_tree *mt)
 
 /* Advanced API */
 
-/*
- * Maple State Status
- * ma_active means the maple state is pointing to a node and offset and can
- * continue operating on the tree.
- * ma_start means we have not searched the tree.
- * ma_root means we have searched the tree and the entry we found lives in
- * the root of the tree (ie it has index 0, length 1 and is the only entry in
- * the tree).
- * ma_none means we have searched the tree and there is no node in the
- * tree for this entry.  For example, we searched for index 1 in an empty
- * tree.  Or we have a tree which points to a full leaf node and we
- * searched for an entry which is larger than can be contained in that
- * leaf node.
- * ma_pause means the data within the maple state may be stale, restart the
- * operation
- * ma_overflow means the search has reached the upper limit of the search
- * ma_underflow means the search has reached the lower limit of the search
- * ma_error means there was an error, check the node for the error number.
- */
-enum maple_status {
-	ma_active,
-	ma_start,
-	ma_root,
-	ma_none,
-	ma_pause,
-	ma_overflow,
-	ma_underflow,
-	ma_error,
-};
-
-/*
- * The maple state is defined in the struct ma_state and is used to keep track
- * of information during operations, and even between operations when using the
- * advanced API.
- *
- * If state->node has bit 0 set then it references a tree location which is not
- * a node (eg the root).  If bit 1 is set, the rest of the bits are a negative
- * errno.  Bit 2 (the 'unallocated slots' bit) is clear.  Bits 3-6 indicate the
- * node type.
- *
- * state->alloc either has a request number of nodes or an allocated node.  If
- * stat->alloc has a requested number of nodes, the first bit will be set (0x1)
- * and the remaining bits are the value.  If state->alloc is a node, then the
- * node will be of type maple_alloc.  maple_alloc has MAPLE_NODE_SLOTS - 1 for
- * storing more allocated nodes, a total number of nodes allocated, and the
- * node_count in this node.  node_count is the number of allocated nodes in this
- * node.  The scaling beyond MAPLE_NODE_SLOTS - 1 is handled by storing further
- * nodes into state->alloc->slot[0]'s node.  Nodes are taken from state->alloc
- * by removing a node from the state->alloc node until state->alloc->node_count
- * is 1, when state->alloc is returned and the state->alloc->slot[0] is promoted
- * to state->alloc.  Nodes are pushed onto state->alloc by putting the current
- * state->alloc into the pushed node's slot[0].
- *
- * The state also contains the implied min/max of the state->node, the depth of
- * this search, and the offset. The implied min/max are either from the parent
- * node or are 0-oo for the root node.  The depth is incremented or decremented
- * every time a node is walked down or up.  The offset is the slot/pivot of
- * interest in the node - either for reading or writing.
- *
- * When returning a value the maple state index and last respectively contain
- * the start and end of the range for the entry.  Ranges are inclusive in the
- * Maple Tree.
- *
- * The status of the state is used to determine how the next action should treat
- * the state.  For instance, if the status is ma_start then the next action
- * should start at the root of the tree and walk down.  If the status is
- * ma_pause then the node may be stale data and should be discarded.  If the
- * status is ma_overflow, then the last action hit the upper limit.
- *
- */
-struct ma_state {
-	struct maple_tree *tree;	/* The tree we're operating in */
-	unsigned long index;		/* The index we're operating on - range start */
-	unsigned long last;		/* The last index we're operating on - range end */
-	struct maple_enode *node;	/* The node containing this entry */
-	unsigned long min;		/* The minimum index of this node - implied pivot min */
-	unsigned long max;		/* The maximum index of this node - implied pivot max */
-	struct maple_alloc *alloc;	/* Allocated nodes for this operation */
-	enum maple_status status;	/* The status of the state (active, start, none, etc) */
-	unsigned char depth;		/* depth of tree descent during write */
-	unsigned char offset;
-	unsigned char mas_flags;
-	unsigned char end;		/* The end of the node */
-};
-
-struct ma_wr_state {
-	struct ma_state *mas;
-	struct maple_node *node;	/* Decoded mas->node */
-	unsigned long r_min;		/* range min */
-	unsigned long r_max;		/* range max */
-	enum maple_type type;		/* mas->node type */
-	unsigned char offset_end;	/* The offset where the write ends */
-	unsigned long *pivots;		/* mas->node->pivots pointer */
-	unsigned long end_piv;		/* The pivot at the offset end */
-	void __rcu **slots;		/* mas->node->slots pointer */
-	void *entry;			/* The entry to write */
-	void *content;			/* The existing entry that is being overwritten */
-};
-
 #define mas_lock(mas)           spin_lock(&((mas)->tree->ma_lock))
 #define mas_lock_nested(mas, subclass) \
 		spin_lock_nested(&((mas)->tree->ma_lock), subclass)
@@ -520,17 +212,6 @@ int mas_empty_area(struct ma_state *mas, unsigned long min, unsigned long max,
 int mas_empty_area_rev(struct ma_state *mas, unsigned long min,
 		       unsigned long max, unsigned long size);
 
-static inline void mas_init(struct ma_state *mas, struct maple_tree *tree,
-			    unsigned long addr)
-{
-	memset(mas, 0, sizeof(struct ma_state));
-	mas->tree = tree;
-	mas->index = mas->last = addr;
-	mas->max = ULONG_MAX;
-	mas->status = ma_start;
-	mas->node = NULL;
-}
-
 static inline bool mas_is_active(struct ma_state *mas)
 {
 	return mas->status == ma_active;
include/linux/maple_tree_types.h new file +341 -0

341 lines not on this page · raw message

include/linux/mm.h +1 -0
index 95c29b8f573d..0e6bdce6e4e8 100644
@@ -13,6 +13,7 @@
 #include <linux/debug_locks.h>
 #include <linux/mm_types.h>
 #include <linux/mmap_lock.h>
+#include <linux/maple_tree.h>
 #include <linux/range.h>
 #include <linux/pfn.h>
 #include <linux/bit_spinlock.h>
include/linux/mm_types.h +1 -1
index e44ef7852019..ff5d33ace0f9 100644
@@ -11,7 +11,7 @@
 #include <linux/list.h>
 #include <linux/spinlock_types.h>
 #include <linux/rbtree_types.h>
-#include <linux/maple_tree.h>
+#include <linux/maple_tree_types.h>
 #include <linux/rwsem.h>
 #include <linux/cpumask.h>
 #include <linux/uprobes.h>
Signature · 1 line
2.39.2
#9 lore raw

PATCH v5 9/35 rwsem.h: move declarations to rwsem_types.h

In reply to Max Kellermann

By providing declarations in a lean header, we can reduce header dependencies.

---
 include/linux/backing-dev-defs.h  |  2 +-
 include/linux/comedi/comedidev.h  |  2 +-
 include/linux/gnss.h              |  2 +-
 include/linux/i3c/master.h        |  2 +-
 include/linux/ipc_namespace.h     |  2 +-
 include/linux/leds.h              |  2 +-
 include/linux/mfd/intel-m10-bmc.h |  2 +-
 include/linux/mm_types.h          |  2 +-
 include/linux/nfs_fs.h            |  2 +-
 include/linux/posix-clock.h       |  2 +-
 include/linux/quota.h             |  2 +-
 include/linux/rwsem.h             | 48 +------------------
 include/linux/rwsem_types.h       | 78 +++++++++++++++++++++++++++++++
 include/linux/tty.h               |  2 +-
 include/linux/user_namespace.h    |  2 +-
 include/net/sch_generic.h         |  2 +-
 include/rdma/ib_verbs.h           |  2 +-
 include/sound/core.h              |  2 +-
 18 files changed, 95 insertions(+), 63 deletions(-)
 create mode 100644 include/linux/rwsem_types.h
include/linux/backing-dev-defs.h +1 -1
index 2e041aedc317..ce5bda191ec5 100644
@@ -15,7 +15,7 @@
 #include <linux/kref_types.h>
 
 #ifdef CONFIG_CGROUP_WRITEBACK
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
 #endif
 
 struct page;
include/linux/comedi/comedidev.h +1 -1
index d7a75b15c6f7..a3c2268f7ae5 100644
@@ -13,7 +13,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/mutex_types.h>
 #include <linux/spinlock_types.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
 #include <linux/kref_types.h>
 #include <linux/comedi.h>
 
include/linux/gnss.h +1 -1
index 8fc4bdd38dc6..9f38ff948d78 100644
@@ -12,7 +12,7 @@
 #include <linux/device.h>
 #include <linux/kfifo.h>
 #include <linux/mutex_types.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
 #include <linux/types.h>
 #include <linux/wait.h>
 
include/linux/i3c/master.h +1 -1
index 16cc81e55b12..0e456edeebbf 100644
@@ -14,7 +14,7 @@
 #include <linux/i2c.h>
 #include <linux/i3c/ccc.h>
 #include <linux/i3c/device.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
 #include <linux/workqueue_types.h>
 
 #define I3C_HOT_JOIN_ADDR		0x2
include/linux/ipc_namespace.h +1 -1
index e8240cf2611a..a0011b6cd5d1 100644
@@ -4,7 +4,7 @@
 
 #include <linux/err.h>
 #include <linux/idr.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
 #include <linux/notifier.h>
 #include <linux/nsproxy.h>
 #include <linux/ns_common.h>
include/linux/leds.h +1 -1
index bec1c2fa5b26..6a50c2ea10e2 100644
@@ -11,7 +11,7 @@
 #include <dt-bindings/leds/common.h>
 #include <linux/device.h>
 #include <linux/mutex_types.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
 #include <linux/spinlock_types.h>
 #include <linux/timer_types.h>
 #include <linux/types.h>
include/linux/mfd/intel-m10-bmc.h +1 -1
index ee66c9751003..3500f5fa8057 100644
@@ -11,7 +11,7 @@
 #include <linux/bits.h>
 #include <linux/dev_printk.h>
 #include <linux/regmap.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
 
 #define M10BMC_N3000_LEGACY_BUILD_VER	0x300468
 #define M10BMC_N3000_SYS_BASE		0x300800
include/linux/mm_types.h +1 -1
index ff5d33ace0f9..ed764511bc23 100644
@@ -12,7 +12,7 @@
 #include <linux/spinlock_types.h>
 #include <linux/rbtree_types.h>
 #include <linux/maple_tree_types.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
 #include <linux/cpumask.h>
 #include <linux/uprobes.h>
 #include <linux/rcupdate.h>
include/linux/nfs_fs.h +1 -1
index 4511d8a50e15..8f14fce5d7e2 100644
@@ -24,7 +24,7 @@
 #include <linux/pagemap.h>
 #include <linux/rbtree_types.h>
 #include <linux/refcount_types.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
 
 #include <linux/sunrpc/debug.h>
 #include <linux/sunrpc/auth.h>
include/linux/posix-clock.h +1 -1
index ef8619f48920..f8e0c65d262d 100644
@@ -11,7 +11,7 @@
 #include <linux/fs.h>
 #include <linux/poll.h>
 #include <linux/posix-timers.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
 
 struct posix_clock;
 struct posix_clock_context;
include/linux/quota.h +1 -1
index bf16d9d2866c..956281c84850 100644
@@ -34,7 +34,7 @@
 
 #include <linux/list.h>
 #include <linux/mutex_types.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
 #include <linux/spinlock_types.h>
 #include <linux/percpu_counter.h>
 
include/linux/rwsem.h +1 -47

69 lines not on this page · raw message

include/linux/rwsem_types.h new file +78 -0

78 lines not on this page · raw message

include/linux/tty.h +1 -1
index 5a3815e7d73d..da820609bc77 100644
@@ -13,7 +13,7 @@
 #include <linux/mutex_types.h>
 #include <linux/tty_flags.h>
 #include <uapi/linux/tty.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
 #include <linux/llist.h>
 
 
include/linux/user_namespace.h +1 -1
index 7d0e3418d497..c82e1b50dfcb 100644
@@ -6,7 +6,7 @@
 #include <linux/ns_common.h>
 #include <linux/sched.h>
 #include <linux/workqueue_types.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
 #include <linux/sysctl.h>
 #include <linux/err.h>
 
include/net/sch_generic.h +1 -1
index bab44a435a62..6ec5064156d9 100644
@@ -12,7 +12,7 @@
 #include <linux/list.h>
 #include <linux/refcount.h>
 #include <linux/mutex_types.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
 #include <linux/atomic.h>
 #include <linux/hashtable.h>
 #include <net/gen_stats.h>
include/rdma/ib_verbs.h +1 -1
index 64b62d1388a4..7d6216e85b0e 100644
@@ -18,7 +18,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/kref_types.h>
 #include <linux/list.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
 #include <linux/workqueue_types.h>
 #include <linux/irq_poll.h>
 #include <uapi/linux/if_ether.h>
include/sound/core.h +1 -1
index 0c512acac050..f95f6863986f 100644
@@ -10,7 +10,7 @@
 #include <linux/device.h>
 #include <linux/sched.h>		/* wake_up() */
 #include <linux/mutex_types.h>		/* struct mutex */
-#include <linux/rwsem.h>		/* struct rw_semaphore */
+#include <linux/rwsem_types.h>		/* struct rw_semaphore */
 #include <linux/stringify.h>
 #include <linux/printk.h>
 #include <linux/wait.h>
Signature · 1 line
2.39.2
#10 lore raw

PATCH v5 10/35 uprobes.h: move declarations to uprobes_types.h

In reply to Max Kellermann

By providing declarations in a lean header, we can reduce header dependencies.

---
 arch/arm64/kernel/signal.c    |  1 +
 include/linux/mm_types.h      |  2 +-
 include/linux/uprobes.h       | 10 +---------
 include/linux/uprobes_types.h | 25 +++++++++++++++++++++++++
 kernel/entry/common.c         |  1 +
 kernel/trace/bpf_trace.c      |  1 +
 mm/memory.c                   |  1 +
 7 files changed, 31 insertions(+), 10 deletions(-)
 create mode 100644 include/linux/uprobes_types.h
arch/arm64/kernel/signal.c +1 -0
index 425b1bc17a3f..e54be587723d 100644
@@ -14,6 +14,7 @@
 #include <linux/freezer.h>
 #include <linux/stddef.h>
 #include <linux/uaccess.h>
+#include <linux/uprobes.h>
 #include <linux/sizes.h>
 #include <linux/string.h>
 #include <linux/resume_user_mode.h>
include/linux/mm_types.h +1 -1
index ed764511bc23..54caee378e77 100644
@@ -14,7 +14,7 @@
 #include <linux/maple_tree_types.h>
 #include <linux/rwsem_types.h>
 #include <linux/cpumask.h>
-#include <linux/uprobes.h>
+#include <linux/uprobes_types.h>
 #include <linux/rcupdate.h>
 #include <linux/page-flags-layout.h>
 #include <linux/workqueue_types.h>
include/linux/uprobes.h +1 -9
index a76155cf8ceb..6ab950cce8a9 100644
@@ -11,6 +11,7 @@
  * Copyright (C) 2011-2012 Red Hat, Inc., Peter Zijlstra
  */
 
+#include <linux/uprobes_types.h>
 #include <linux/errno.h>
 #include <linux/types.h>
 
@@ -94,12 +95,6 @@ enum rp_check {
 	RP_CHECK_RET,
 };
 
-struct xol_area;
-
-struct uprobes_state {
-	struct xol_area		*xol_area;
-};
-
 extern void __init uprobes_init(void);
 extern int set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
 extern int set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
@@ -137,9 +132,6 @@ extern bool arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs);
 extern void arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
 					 void *src, unsigned long len);
 #else /* !CONFIG_UPROBES */
-struct uprobes_state {
-};
-
 static inline void uprobes_init(void)
 {
 }
include/linux/uprobes_types.h new file +25 -0
new file mode 100644
index 000000000000..0ce0fe3801ea
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#ifndef _LINUX_UPROBES_TYPES_H
+#define _LINUX_UPROBES_TYPES_H
+/*
+ * User-space Probes (UProbes)
+ *
+ * Copyright (C) IBM Corporation, 2008-2012
+ * Authors:
+ *	Srikar Dronamraju
+ *	Jim Keniston
+ * Copyright (C) 2011-2012 Red Hat, Inc., Peter Zijlstra
+ */
+
+#ifdef CONFIG_UPROBES
+
+struct xol_area;
+
+struct uprobes_state {
+	struct xol_area		*xol_area;
+};
+#else /* !CONFIG_UPROBES */
+struct uprobes_state {
+};
+#endif /* !CONFIG_UPROBES */
+#endif	/* _LINUX_UPROBES_TYPES_H */
kernel/entry/common.c +1 -0
index 88cb3c88aaa5..364ea38c868e 100644
@@ -9,6 +9,7 @@
 #include <linux/livepatch.h>
 #include <linux/audit.h>
 #include <linux/tick.h>
+#include <linux/uprobes.h>
 
 #include "common.h"
 
kernel/trace/bpf_trace.c +1 -0
index 241ddf5e3895..e74430389877 100644
@@ -11,6 +11,7 @@
 #include <linux/btf.h>
 #include <linux/filter.h>
 #include <linux/uaccess.h>
+#include <linux/uprobes.h>
 #include <linux/ctype.h>
 #include <linux/kprobes.h>
 #include <linux/spinlock.h>
mm/memory.c +1 -0
index 7c3ca41a7610..68abe5dccb5b 100644
@@ -70,6 +70,7 @@
 #include <linux/string.h>
 #include <linux/memory-tiers.h>
 #include <linux/debugfs.h>
+#include <linux/uprobes.h>
 #include <linux/userfaultfd_k.h>
 #include <linux/dax.h>
 #include <linux/oom.h>
Signature · 1 line
2.39.2
#11 lore raw

PATCH v5 11/35 percpu_counter.h: move declarations to percpu_counter_types.h

In reply to Max Kellermann

By providing declarations in a lean header, we can reduce header dependencies.

---
 include/linux/backing-dev-defs.h     |  2 +-
 include/linux/flex_proportions.h     |  2 +-
 include/linux/ipc_namespace.h        |  2 +-
 include/linux/mm_types.h             |  3 ++-
 include/linux/percpu_counter.h       | 17 +------------
 include/linux/percpu_counter_types.h | 37 ++++++++++++++++++++++++++++
 include/linux/sched/user.h           |  2 +-
 include/linux/shmem_fs.h             |  2 +-
 kernel/user.c                        |  1 +
 lib/flex_proportions.c               |  1 +
 10 files changed, 47 insertions(+), 22 deletions(-)
 create mode 100644 include/linux/percpu_counter_types.h
include/linux/backing-dev-defs.h +1 -1
index ce5bda191ec5..9f2ef799cff4 100644
@@ -6,7 +6,7 @@
 #include <linux/radix-tree.h>
 #include <linux/rbtree_types.h>
 #include <linux/spinlock_types.h>
-#include <linux/percpu_counter.h>
+#include <linux/percpu_counter_types.h>
 #include <linux/percpu-refcount.h>
 #include <linux/flex_proportions.h>
 #include <linux/timer_types.h>
include/linux/flex_proportions.h +1 -1
index 35204b64addf..df9017a61046 100644
@@ -8,7 +8,7 @@
 #ifndef _LINUX_FLEX_PROPORTIONS_H
 #define _LINUX_FLEX_PROPORTIONS_H
 
-#include <linux/percpu_counter.h>
+#include <linux/percpu_counter_types.h>
 #include <linux/spinlock_types.h>
 #include <linux/seqlock_types.h>
 #include <linux/gfp_types.h>
include/linux/ipc_namespace.h +1 -1
index a0011b6cd5d1..7c758ab565fe 100644
@@ -11,7 +11,7 @@
 #include <linux/refcount.h>
 #include <linux/rhashtable-types.h>
 #include <linux/sysctl.h>
-#include <linux/percpu_counter.h>
+#include <linux/percpu_counter_types.h>
 
 struct user_namespace;
 
include/linux/mm_types.h +2 -1
index 54caee378e77..a88219770c82 100644
@@ -19,7 +19,8 @@
 #include <linux/page-flags-layout.h>
 #include <linux/workqueue_types.h>
 #include <linux/seqlock_types.h>
-#include <linux/percpu_counter.h>
+#include <linux/percpu_counter_types.h>
+#include <linux/percpu.h>
 
 #include <asm/mmu.h>
 
include/linux/percpu_counter.h +1 -16
index 91e3a527ceef..84f58b8b7856 100644
@@ -7,26 +7,15 @@
  * WARNING: these things are HUGE.  4 kbytes per counter on 32-way P4.
  */
 
-#include <linux/spinlock_types.h>
-#include <linux/list.h>
+#include <linux/percpu_counter_types.h>
 #include <linux/threads.h>
 #include <linux/percpu.h>
-#include <linux/types.h>
 
 /* percpu_counter batch for local add or sub */
 #define PERCPU_COUNTER_LOCAL_BATCH	INT_MAX
 
 #ifdef CONFIG_SMP
 
-struct percpu_counter {
-	raw_spinlock_t lock;
-	s64 count;
-#ifdef CONFIG_HOTPLUG_CPU
-	struct list_head list;	/* All percpu_counters are on a list */
-#endif
-	s32 __percpu *counters;
-};
-
 extern int percpu_counter_batch;
 
 int __percpu_counter_init_many(struct percpu_counter *fbc, s64 amount,
@@ -133,10 +122,6 @@ static inline bool percpu_counter_initialized(struct percpu_counter *fbc)
 
 #include <linux/irqflags.h> // for local_irq_save()
 
-struct percpu_counter {
-	s64 count;
-};
-
 static inline int percpu_counter_init_many(struct percpu_counter *fbc,
 					   s64 amount, gfp_t gfp,
 					   u32 nr_counters)
include/linux/percpu_counter_types.h new file +37 -0
new file mode 100644
index 000000000000..faccd9869a5a
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_PERCPU_COUNTER_TYPES_H
+#define _LINUX_PERCPU_COUNTER_TYPES_H
+/*
+ * A simple "approximate counter" for use in ext2 and ext3 superblocks.
+ *
+ * WARNING: these things are HUGE.  4 kbytes per counter on 32-way P4.
+ */
+
+#include <linux/types.h>
+
+#ifdef CONFIG_SMP
+
+#include <linux/spinlock_types.h>
+
+#ifdef CONFIG_HOTPLUG_CPU
+#include <linux/list.h>
+#endif
+
+struct percpu_counter {
+	raw_spinlock_t lock;
+	s64 count;
+#ifdef CONFIG_HOTPLUG_CPU
+	struct list_head list;	/* All percpu_counters are on a list */
+#endif
+	s32 __percpu *counters;
+};
+
+#else /* !CONFIG_SMP */
+
+struct percpu_counter {
+	s64 count;
+};
+
+#endif	/* CONFIG_SMP */
+
+#endif /* _LINUX_PERCPU_COUNTER_TYPES_H */
include/linux/sched/user.h +1 -1
index 671ecee08d23..913da0aba05c 100644
@@ -4,7 +4,7 @@
 
 #include <linux/uidgid_types.h>
 #include <linux/atomic.h>
-#include <linux/percpu_counter.h>
+#include <linux/percpu_counter_types.h>
 #include <linux/refcount.h>
 #include <linux/ratelimit_types.h>
 
include/linux/shmem_fs.h +1 -1
index 66828dfc6e74..56b11f1f82c5 100644
@@ -6,7 +6,7 @@
 #include <linux/swap.h>
 #include <linux/mempolicy.h>
 #include <linux/pagemap.h>
-#include <linux/percpu_counter.h>
+#include <linux/percpu_counter_types.h>
 #include <linux/xattr.h>
 #include <linux/fs_parser.h>
 #include <linux/userfaultfd_k.h>
kernel/user.c +1 -0
index 28da71ea1e74..6c8b818419f8 100644
@@ -22,6 +22,7 @@
 #include <linux/proc_ns.h>
 #include <linux/ratelimit.h>
 #include <linux/uidgid.h>
+#include <linux/percpu_counter.h>
 
 #if IS_ENABLED(CONFIG_BINFMT_MISC)
 struct binfmt_misc init_binfmt_misc = {
lib/flex_proportions.c +1 -0
index 7749a48428e5..1d5e1e0bdbbe 100644
@@ -36,6 +36,7 @@
 #include <linux/flex_proportions.h>
 #include <linux/log2.h>
 #include <linux/math64.h>
+#include <linux/percpu_counter.h>
 #include <linux/seqlock.h>
 
 int fprop_global_init(struct fprop_global *p, gfp_t gfp)
Signature · 1 line
2.39.2
#12 lore raw

PATCH v5 12/35 bvec.h: move declarations to bvec_types.h

In reply to Max Kellermann

By providing declarations in a lean header, we can reduce header dependencies.

---
 include/linux/blk_types.h  |  2 +-
 include/linux/bvec.h       | 84 +--------------------------------
 include/linux/bvec_types.h | 95 ++++++++++++++++++++++++++++++++++++++
 include/linux/iov_iter.h   |  2 +-
 include/linux/skbuff.h     |  2 +-
 5 files changed, 99 insertions(+), 86 deletions(-)
 create mode 100644 include/linux/bvec_types.h
include/linux/blk_types.h +1 -1
index 1c07848dea7e..9d2d8a8328a6 100644
@@ -7,7 +7,7 @@
 #define __LINUX_BLK_TYPES_H
 
 #include <linux/types.h>
-#include <linux/bvec.h>
+#include <linux/bvec_types.h>
 #include <linux/device.h>
 #include <linux/ktime.h>
 
include/linux/bvec.h +1 -83

102 lines not on this page · raw message

include/linux/bvec_types.h new file +95 -0

95 lines not on this page · raw message

include/linux/iov_iter.h +1 -1
index c3adba9ff389..060626682481 100644
@@ -9,7 +9,7 @@
 #define _LINUX_IOV_ITER_H
 
 #include <linux/uio.h>
-#include <linux/bvec.h>
+#include <linux/bvec_types.h>
 #include <linux/highmem.h> // for kmap_local_page()
 
 typedef size_t (*iov_step_f)(void *iter_base, size_t progress, size_t len,
include/linux/skbuff.h +1 -1
index 2dde34c29203..8ee67e49699b 100644
@@ -14,7 +14,7 @@
 #include <linux/compiler.h>
 #include <linux/time.h>
 #include <linux/bug.h>
-#include <linux/bvec.h>
+#include <linux/bvec_types.h>
 #include <linux/cache.h>
 #include <linux/rbtree.h>
 #include <linux/socket.h>
Signature · 1 line
2.39.2
#13 lore raw

PATCH v5 13/35 wait.h: move declarations to wait_types.h

In reply to Max Kellermann

By providing declarations in a lean header, we can reduce header dependencies.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h |  2 +-
 include/drm/gpu_scheduler.h            |  2 +-
 include/linux/backing-dev-defs.h       |  2 +-
 include/linux/blkdev.h                 |  2 +-
 include/linux/buffer_head.h            |  2 +-
 include/linux/ceph/libceph.h           |  2 +-
 include/linux/cgroup-defs.h            |  2 +-
 include/linux/console_struct.h         |  2 +-
 include/linux/counter.h                |  2 +-
 include/linux/dcache.h                 |  2 +-
 include/linux/dma-buf.h                |  2 +-
 include/linux/eventfd.h                |  2 +-
 include/linux/gnss.h                   |  2 +-
 include/linux/libps2.h                 |  2 +-
 include/linux/lp.h                     |  2 +-
 include/linux/mempool.h                |  2 +-
 include/linux/mhi.h                    |  2 +-
 include/linux/mmzone.h                 |  2 +-
 include/linux/mtd/flashchip.h          |  2 +-
 include/linux/net.h                    |  2 +-
 include/linux/nfs_fs_sb.h              |  2 +-
 include/linux/parport.h                |  2 +-
 include/linux/pid.h                    |  2 +-
 include/linux/pm.h                     |  2 +-
 include/linux/poll.h                   |  2 +-
 include/linux/psi_types.h              |  2 +-
 include/linux/relay.h                  |  2 +-
 include/linux/rtnetlink.h              |  2 +-
 include/linux/sbitmap.h                |  2 +-
 include/linux/sunrpc/rpc_pipe_fs.h     |  2 +-
 include/linux/syslog.h                 |  2 +-
 include/linux/tty_port.h               |  2 +-
 include/linux/wait.h                   | 23 +------------------
 include/linux/wait_bit.h               |  2 +-
 include/linux/wait_types.h             | 31 ++++++++++++++++++++++++++
 include/media/dvb_ringbuffer.h         |  2 +-
 include/net/smc.h                      |  2 +-
 include/net/sock.h                     |  2 +-
 include/scsi/libiscsi.h                |  2 +-
 include/sound/control.h                |  2 +-
 include/sound/rawmidi.h                |  2 +-
 41 files changed, 71 insertions(+), 61 deletions(-)
 create mode 100644 include/linux/wait_types.h
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h +1 -1
index 59a5bc9b1120..6e01527b2be5 100644
@@ -25,7 +25,7 @@
 #define __AMDGPU_IH_H__
 
 #include <linux/types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 
 /* Maximum number of IVs processed at once */
 #define AMDGPU_IH_MAX_NUM_IVS	32
include/drm/gpu_scheduler.h +1 -1
index 4edd7ac64b62..05591cc987c2 100644
@@ -28,7 +28,7 @@
 #include <linux/dma-fence.h>
 #include <linux/completion.h>
 #include <linux/xarray.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <linux/workqueue_types.h>
 
 #define MAX_WAIT_SCHED_ENTITY_Q_EMPTY msecs_to_jiffies(1000)
include/linux/backing-dev-defs.h +1 -1
index 9f2ef799cff4..068fc9f3e883 100644
@@ -10,7 +10,7 @@
 #include <linux/percpu-refcount.h>
 #include <linux/flex_proportions.h>
 #include <linux/timer_types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <linux/workqueue_types.h>
 #include <linux/kref_types.h>
 
include/linux/blkdev.h +1 -1
index 26344147adec..2a8df9c0e87b 100644
@@ -13,7 +13,7 @@
 #include <linux/minmax.h>
 #include <linux/timer_types.h>
 #include <linux/workqueue_types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <linux/bio.h>
 #include <linux/gfp_types.h>
 #include <linux/kdev_t.h>
include/linux/buffer_head.h +1 -1
index d78454a4dd1f..15dffb5374fb 100644
@@ -13,7 +13,7 @@
 #include <linux/fs.h>
 #include <linux/linkage.h>
 #include <linux/pagemap.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <linux/atomic.h>
 
 enum bh_state_bits {
include/linux/ceph/libceph.h +1 -1
index d01be9103e56..12eb9c9f6620 100644
@@ -11,7 +11,7 @@
 #include <linux/fs.h>
 #include <linux/mempool.h>
 #include <linux/pagemap.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <linux/writeback.h>
 #include <linux/slab.h>
 #include <linux/refcount_types.h>
include/linux/cgroup-defs.h +1 -1
index 380a59b31624..99e24f3034df 100644
@@ -11,7 +11,7 @@
 #include <linux/limits.h>
 #include <linux/list.h>
 #include <linux/idr.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <linux/mutex_types.h>
 #include <linux/rcupdate.h>
 #include <linux/refcount_types.h>
include/linux/console_struct.h +1 -1
index a0142b93eaf9..8babdd50a4ca 100644
@@ -13,7 +13,7 @@
 #ifndef _LINUX_CONSOLE_STRUCT_H
 #define _LINUX_CONSOLE_STRUCT_H
 
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <linux/vt.h>
 #include <linux/workqueue_types.h>
 
include/linux/counter.h +1 -1
index 846b94517c5b..638ebb5b4d27 100644
@@ -13,7 +13,7 @@
 #include <linux/mutex_types.h>
 #include <linux/spinlock_types.h>
 #include <linux/types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <uapi/linux/counter.h>
 
 struct counter_device;
include/linux/dcache.h +1 -1
index 04ab9e67046c..560ca5e16f1e 100644
@@ -13,7 +13,7 @@
 #include <linux/rcupdate.h>
 #include <linux/lockref.h>
 #include <linux/stringhash.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 
 struct path;
 struct file;
include/linux/dma-buf.h +1 -1
index 8ff4add71f88..ab67e5a4b0ec 100644
@@ -21,7 +21,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/fs.h>
 #include <linux/dma-fence.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 
 struct device;
 struct dma_buf;
include/linux/eventfd.h +1 -1
index 7199c5039561..5f41551db2f1 100644
@@ -9,7 +9,7 @@
 #ifndef _LINUX_EVENTFD_H
 #define _LINUX_EVENTFD_H
 
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <linux/err.h>
 #include <linux/sched.h>
 #include <uapi/linux/eventfd.h>
include/linux/gnss.h +1 -1
index 9f38ff948d78..3c24e934b732 100644
@@ -14,7 +14,7 @@
 #include <linux/mutex_types.h>
 #include <linux/rwsem_types.h>
 #include <linux/types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 
 struct gnss_device;
 
include/linux/libps2.h +1 -1
index 006c38667e75..c2f438730ae1 100644
@@ -11,7 +11,7 @@
 #include <linux/interrupt.h>
 #include <linux/mutex_types.h>
 #include <linux/types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 
 struct ps2dev;
 
include/linux/lp.h +1 -1
index 337573412852..d700bf3255b1 100644
@@ -9,7 +9,7 @@
 #define _LINUX_LP_H
 
 
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <linux/mutex_types.h>
 #include <uapi/linux/lp.h>
 
include/linux/mempool.h +1 -1
index 16c5cc807ff6..d3df002ac3b7 100644
@@ -5,7 +5,7 @@
 #ifndef _LINUX_MEMPOOL_H
 #define _LINUX_MEMPOOL_H
 
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <linux/compiler.h>
 
 struct kmem_cache;
include/linux/mhi.h +1 -1
index bd99f47726dc..243bfae1a94c 100644
@@ -12,7 +12,7 @@
 #include <linux/skbuff.h>
 #include <linux/slab.h>
 #include <linux/spinlock_types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <linux/workqueue_types.h>
 
 #define MHI_MAX_OEM_PK_HASH_SEGMENTS 16
include/linux/mmzone.h +1 -1
index ce11c2dab2bc..fa41c34f16da 100644
@@ -8,7 +8,7 @@
 #include <linux/spinlock_types.h>
 #include <linux/list.h>
 #include <linux/list_nulls.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <linux/bitops.h>
 #include <linux/cache.h>
 #include <linux/threads.h>
include/linux/mtd/flashchip.h +1 -1
index e856c0dcba27..58ffb6515741 100644
@@ -13,7 +13,7 @@
  */
 #include <linux/sched.h>
 #include <linux/mutex_types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 
 typedef enum {
 	FL_READY,
include/linux/net.h +1 -1
index c9b4a63791a4..139a936fb772 100644
@@ -16,7 +16,7 @@
 
 #include <linux/stringify.h>
 #include <linux/random.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <linux/fcntl.h>	/* For O_CLOEXEC and O_NONBLOCK */
 #include <linux/rcupdate.h>
 #include <linux/once.h>
include/linux/nfs_fs_sb.h +1 -1
index 08860ceda787..1c9a1e28b13e 100644
@@ -5,7 +5,7 @@
 #include <linux/list.h>
 #include <linux/backing-dev.h>
 #include <linux/idr.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <linux/nfs_xdr.h>
 #include <linux/sunrpc/xprt.h>
 
include/linux/parport.h +1 -1
index c8e3b71a3b49..783835d05d9b 100644
@@ -10,7 +10,7 @@
 #include <linux/jiffies.h>
 #include <linux/proc_fs.h>
 #include <linux/spinlock_types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <linux/irqreturn.h>
 #include <linux/semaphore.h>
 #include <linux/device.h>
include/linux/pid.h +1 -1
index 8124d57752b9..fd9d9c054585 100644
@@ -7,7 +7,7 @@
 #include <linux/rcupdate.h>
 #include <linux/refcount.h>
 #include <linux/sched.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 
 /*
  * What is struct pid?
include/linux/pm.h +1 -1
index 303a143c4e04..c1533ce86893 100644
@@ -13,7 +13,7 @@
 #include <linux/list.h>
 #include <linux/workqueue_types.h>
 #include <linux/spinlock_types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <linux/hrtimer_types.h>
 #include <linux/completion.h>
 
include/linux/poll.h +1 -1
index a9e0e1c2d1f2..043aa684b09c 100644
@@ -5,7 +5,7 @@
 
 #include <linux/compiler.h>
 #include <linux/ktime.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <linux/string.h>
 #include <linux/fs.h>
 #include <linux/uaccess.h>
include/linux/psi_types.h +1 -1
index 8af6452b36e2..de72dcc6e0bf 100644
@@ -5,7 +5,7 @@
 #include <linux/kthread.h>
 #include <linux/seqlock_types.h>
 #include <linux/types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 
 #ifdef CONFIG_PSI
 
include/linux/relay.h +1 -1
index d33735edc3cb..79ecc446ed48 100644
@@ -13,7 +13,7 @@
 
 #include <linux/types.h>
 #include <linux/sched.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <linux/list.h>
 #include <linux/irq_work.h>
 #include <linux/bug.h>
include/linux/rtnetlink.h +1 -1
index d1c42219429c..4b1f01916825 100644
@@ -3,7 +3,7 @@
 #define __LINUX_RTNETLINK_H
 
 #include <linux/netdevice.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <linux/refcount.h>
 #include <uapi/linux/rtnetlink.h>
 
include/linux/sbitmap.h +1 -1
index d7d3fba174f8..f7279f7632fe 100644
@@ -18,7 +18,7 @@
 #include <linux/percpu.h>
 #include <linux/slab.h>
 #include <linux/types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 
 struct seq_file;
 
include/linux/sunrpc/rpc_pipe_fs.h +1 -1
index c26733d8fde7..3f4d6fc0a8a3 100644
@@ -4,7 +4,7 @@
 
 #include <linux/list.h>
 #include <linux/spinlock_types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 
 struct rpc_pipe_dir_head {
 	struct list_head pdh_entries;
include/linux/syslog.h +1 -1
index 955f80e34d4f..2a4c9199d718 100644
@@ -8,7 +8,7 @@
 #ifndef _LINUX_SYSLOG_H
 #define _LINUX_SYSLOG_H
 
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 
 /* Close the log.  Currently a NOP. */
 #define SYSLOG_ACTION_CLOSE          0
include/linux/tty_port.h +1 -1
index a76a5b6a5cf2..8622638452cb 100644
@@ -6,7 +6,7 @@
 #include <linux/kref.h>
 #include <linux/mutex_types.h>
 #include <linux/tty_buffer.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 
 struct attribute_group;
 struct tty_driver;
include/linux/wait.h +1 -22
index 8aa3372f21a0..b36000bb012c 100644
@@ -4,17 +4,12 @@
 /*
  * Linux wait queue related types and methods
  */
-#include <linux/list.h>
+#include <linux/wait_types.h>
 #include <linux/stddef.h>
 #include <linux/spinlock.h>
 
 #include <asm/current.h>
 
-typedef struct wait_queue_entry wait_queue_entry_t;
-
-typedef int (*wait_queue_func_t)(struct wait_queue_entry *wq_entry, unsigned mode, int flags, void *key);
-int default_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int flags, void *key);
-
 /* wait_queue_entry::flags */
 #define WQ_FLAG_EXCLUSIVE	0x01
 #define WQ_FLAG_WOKEN		0x02
@@ -22,22 +17,6 @@ int default_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int
 #define WQ_FLAG_DONE		0x08
 #define WQ_FLAG_PRIORITY	0x10
 
-/*
- * A single wait-queue entry structure:
- */
-struct wait_queue_entry {
-	unsigned int		flags;
-	void			*private;
-	wait_queue_func_t	func;
-	struct list_head	entry;
-};
-
-struct wait_queue_head {
-	spinlock_t		lock;
-	struct list_head	head;
-};
-typedef struct wait_queue_head wait_queue_head_t;
-
 struct task_struct;
 
 /*
include/linux/wait_bit.h +1 -1
index 96c90fbcf652..514f68eff79d 100644
@@ -8,7 +8,7 @@
 #include <linux/bitops.h>
 #include <linux/init.h> // for __init
 #include <linux/kernel.h> // for might_sleep()
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 
 struct wait_bit_key {
 	void			*flags;
include/linux/wait_types.h new file +31 -0
new file mode 100644
index 000000000000..4b43e7bc6dac
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_WAIT_TYPES_H
+#define _LINUX_WAIT_TYPES_H
+/*
+ * Linux wait queue related types and methods
+ */
+#include <linux/list.h>
+#include <linux/spinlock_types.h>
+
+typedef struct wait_queue_entry wait_queue_entry_t;
+
+typedef int (*wait_queue_func_t)(struct wait_queue_entry *wq_entry, unsigned mode, int flags, void *key);
+int default_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int flags, void *key);
+
+/*
+ * A single wait-queue entry structure:
+ */
+struct wait_queue_entry {
+	unsigned int		flags;
+	void			*private;
+	wait_queue_func_t	func;
+	struct list_head	entry;
+};
+
+struct wait_queue_head {
+	spinlock_t		lock;
+	struct list_head	head;
+};
+typedef struct wait_queue_head wait_queue_head_t;
+
+#endif /* _LINUX_WAIT_TYPES_H */
include/media/dvb_ringbuffer.h +1 -1
index 131997d1f131..22da81bff624 100644
@@ -24,7 +24,7 @@
 #define _DVB_RINGBUFFER_H_
 
 #include <linux/spinlock_types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 
 /**
  * struct dvb_ringbuffer - Describes a ring buffer used at DVB framework
include/net/smc.h +1 -1
index 44a01bd3da10..92611a9cf0e9 100644
@@ -13,7 +13,7 @@
 
 #include <linux/spinlock_types.h>
 #include <linux/types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include "linux/ism.h"
 
 struct device;
include/net/sock.h +1 -1
index bebdc45cf622..008a6c5a3bfc 100644
@@ -53,7 +53,7 @@
 #include <linux/memcontrol.h>
 #include <linux/static_key.h>
 #include <linux/sched.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <linux/cgroup-defs.h>
 #include <linux/rbtree_types.h>
 #include <linux/rculist_nulls.h>
include/scsi/libiscsi.h +1 -1
index 01f13729ad24..d30e65c5f137 100644
@@ -11,7 +11,7 @@
 #define LIBISCSI_H
 
 #include <linux/types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <linux/mutex_types.h>
 #include <linux/timer_types.h>
 #include <linux/workqueue_types.h>
include/sound/control.h +1 -1
index 486017d25181..04ad6c42029d 100644
@@ -7,7 +7,7 @@
  *  Copyright (c) by Jaroslav Kysela <[email protected]>
  */
 
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <linux/nospec.h>
 #include <linux/string.h> // for strscpy()
 #include <sound/asound.h>
include/sound/rawmidi.h +1 -1
index 46678a38dbb9..6c380196bff4 100644
@@ -10,7 +10,7 @@
 #include <sound/asound.h>
 #include <linux/interrupt.h>
 #include <linux/spinlock_types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
 #include <linux/mutex_types.h>
 #include <linux/workqueue_types.h>
 #include <linux/device.h>
Signature · 1 line
2.39.2
#14 lore raw

PATCH v5 14/35 swait.h: move declarations to swait_types.h

In reply to Max Kellermann

By providing declarations in a lean header, we can reduce header dependencies.

---
 include/linux/swait.h       | 13 +------------
 include/linux/swait_types.h | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 12 deletions(-)
 create mode 100644 include/linux/swait_types.h
include/linux/swait.h +1 -12
index 68c2e30edb1c..4a4a240b337e 100644
@@ -2,6 +2,7 @@
 #ifndef _LINUX_SWAIT_H
 #define _LINUX_SWAIT_H
 
+#include <linux/swait_types.h>
 #include <linux/list.h>
 #include <linux/stddef.h>
 #include <linux/spinlock_types.h>
@@ -38,18 +39,6 @@
  * wait queues in most cases.
  */
 
-struct task_struct;
-
-struct swait_queue_head {
-	raw_spinlock_t		lock;
-	struct list_head	task_list;
-};
-
-struct swait_queue {
-	struct task_struct	*task;
-	struct list_head	task_list;
-};
-
 #define __SWAITQUEUE_INITIALIZER(name) {				\
 	.task		= current,					\
 	.task_list	= LIST_HEAD_INIT((name).task_list),		\
include/linux/swait_types.h new file +20 -0
new file mode 100644
index 000000000000..316038879a37
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_SWAIT_TYPES_H
+#define _LINUX_SWAIT_TYPES_H
+
+#include <linux/list.h>
+#include <linux/spinlock_types.h>
+
+struct task_struct;
+
+struct swait_queue_head {
+	raw_spinlock_t		lock;
+	struct list_head	task_list;
+};
+
+struct swait_queue {
+	struct task_struct	*task;
+	struct list_head	task_list;
+};
+
+#endif /* _LINUX_SWAIT_TYPES_H */
Signature · 1 line
2.39.2
#15 lore raw

PATCH v5 15/35 completion.h: move declarations to completion_types.h

In reply to Max Kellermann

By providing declarations in a lean header, we can reduce header dependencies.

---
 drivers/target/target_core_xcopy.c |  1 +
 include/drm/drm_audio_component.h  |  2 +-
 include/drm/gpu_scheduler.h        |  2 +-
 include/linux/ceph/osd_client.h    |  2 +-
 include/linux/completion.h         | 18 +----------------
 include/linux/completion_types.h   | 31 ++++++++++++++++++++++++++++++
 include/linux/cpufreq.h            |  2 +-
 include/linux/edac.h               |  2 +-
 include/linux/firewire.h           |  2 +-
 include/linux/greybus/operation.h  |  2 +-
 include/linux/hw_random.h          |  2 +-
 include/linux/hyperv.h             |  2 +-
 include/linux/livepatch.h          |  2 +-
 include/linux/mailbox_controller.h |  2 +-
 include/linux/memremap.h           |  2 +-
 include/linux/mfd/cs42l43.h        |  2 +-
 include/linux/mfd/da9052/da9052.h  |  2 +-
 include/linux/mfd/wm8350/core.h    |  2 +-
 include/linux/mlx4/device.h        |  2 +-
 include/linux/mlx5/cq.h            |  1 +
 include/linux/mlx5/driver.h        |  2 +-
 include/linux/mmc/core.h           |  2 +-
 include/linux/mtd/onenand.h        |  2 +-
 include/linux/mtd/sh_flctl.h       |  2 +-
 include/linux/ntb.h                |  2 +-
 include/linux/pm.h                 |  2 +-
 include/linux/rcupdate_wait.h      |  2 +-
 include/linux/sched/signal.h       |  2 +-
 include/linux/soc/qcom/qmi.h       |  2 +-
 include/linux/spi/spi.h            |  2 +-
 include/linux/srcutree.h           |  2 +-
 include/linux/usb.h                |  2 +-
 include/net/inet_frag.h            |  2 +-
 include/rdma/ib_sa.h               |  2 +-
 include/rdma/restrack.h            |  2 +-
 include/target/target_core_base.h  |  2 +-
 include/xen/xenbus.h               |  2 +-
 37 files changed, 67 insertions(+), 50 deletions(-)
 create mode 100644 include/linux/completion_types.h
drivers/target/target_core_xcopy.c +1 -0
index fafa738f0f7e..df06ec0f75fe 100644
@@ -16,6 +16,7 @@
 #include <linux/spinlock.h>
 #include <linux/list.h>
 #include <linux/rculist.h>
+#include <linux/completion.h>
 #include <linux/configfs.h>
 #include <linux/ratelimit.h>
 #include <linux/workqueue.h>
include/drm/drm_audio_component.h +1 -1
index 5a4cd1fa8e2a..d4e95bca4d10 100644
@@ -4,7 +4,7 @@
 #ifndef _DRM_AUDIO_COMPONENT_H_
 #define _DRM_AUDIO_COMPONENT_H_
 
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/types.h>
 
 struct drm_audio_component;
include/drm/gpu_scheduler.h +1 -1
index 05591cc987c2..9a89f72a3bac 100644
@@ -26,7 +26,7 @@
 
 #include <drm/spsc_queue.h>
 #include <linux/dma-fence.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/xarray.h>
 #include <linux/wait_types.h>
 #include <linux/workqueue_types.h>
include/linux/ceph/osd_client.h +1 -1
index 289034e8854f..fa926dcdf940 100644
@@ -3,7 +3,7 @@
 #define _FS_CEPH_OSD_CLIENT_H
 
 #include <linux/bitrev.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/kref_types.h>
 #include <linux/mempool.h>
 #include <linux/rbtree_types.h>
include/linux/completion.h +1 -17
index fb2915676574..a57ffe2836b9 100644
@@ -9,25 +9,9 @@
  * See kernel/sched/completion.c for details.
  */
 
+#include <linux/completion_types.h>
 #include <linux/swait.h>
 
-/*
- * struct completion - structure used to maintain state for a "completion"
- *
- * This is the opaque structure used to maintain the state for a "completion".
- * Completions currently use a FIFO to queue threads that have to wait for
- * the "completion" event.
- *
- * See also:  complete(), wait_for_completion() (and friends _timeout,
- * _interruptible, _interruptible_timeout, and _killable), init_completion(),
- * reinit_completion(), and macros DECLARE_COMPLETION(),
- * DECLARE_COMPLETION_ONSTACK().
- */
-struct completion {
-	unsigned int done;
-	struct swait_queue_head wait;
-};
-
 #define init_completion_map(x, m) init_completion(x)
 static inline void complete_acquire(struct completion *x) {}
 static inline void complete_release(struct completion *x) {}
include/linux/completion_types.h new file +31 -0
new file mode 100644
index 000000000000..032192c95462
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __LINUX_COMPLETION_TYPES_H
+#define __LINUX_COMPLETION_TYPES_H
+
+/*
+ * (C) Copyright 2001 Linus Torvalds
+ *
+ * Atomic wait-for-completion handler data structures.
+ * See kernel/sched/completion.c for details.
+ */
+
+#include <linux/swait_types.h>
+
+/*
+ * struct completion - structure used to maintain state for a "completion"
+ *
+ * This is the opaque structure used to maintain the state for a "completion".
+ * Completions currently use a FIFO to queue threads that have to wait for
+ * the "completion" event.
+ *
+ * See also:  complete(), wait_for_completion() (and friends _timeout,
+ * _interruptible, _interruptible_timeout, and _killable), init_completion(),
+ * reinit_completion(), and macros DECLARE_COMPLETION(),
+ * DECLARE_COMPLETION_ONSTACK().
+ */
+struct completion {
+	unsigned int done;
+	struct swait_queue_head wait;
+};
+
+#endif
include/linux/cpufreq.h +1 -1
index a56eae4b0787..1087f325d056 100644
@@ -11,7 +11,7 @@
 #include <linux/clk.h>
 #include <linux/cpu.h>
 #include <linux/cpumask.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/kobject_types.h>
 #include <linux/notifier.h>
 #include <linux/of.h>
include/linux/edac.h +1 -1
index f939d5fad491..7b78403cac40 100644
@@ -14,7 +14,7 @@
 
 #include <linux/atomic.h>
 #include <linux/device.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/workqueue_types.h>
 #include <linux/debugfs.h>
 #include <linux/numa.h>
include/linux/firewire.h +1 -1
index feef7e09b60a..a81e31472530 100644
@@ -2,7 +2,7 @@
 #ifndef _LINUX_FIREWIRE_H
 #define _LINUX_FIREWIRE_H
 
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/device.h>
 #include <linux/dma-mapping.h>
 #include <linux/kernel.h>
include/linux/greybus/operation.h +1 -1
index c49053e5707d..8d849f4ee99f 100644
@@ -9,7 +9,7 @@
 #ifndef __OPERATION_H
 #define __OPERATION_H
 
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/kref_types.h>
 #include <linux/timer_types.h>
 #include <linux/types.h>
include/linux/hw_random.h +1 -1
index 96cad10d0201..69838419f2e7 100644
@@ -12,7 +12,7 @@
 #ifndef LINUX_HWRANDOM_H_
 #define LINUX_HWRANDOM_H_
 
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/types.h>
 #include <linux/list.h>
 #include <linux/kref_types.h>
include/linux/hyperv.h +1 -1
index 249c4eb67f38..60ed23c4ca17 100644
@@ -18,7 +18,7 @@
 #include <linux/types.h>
 #include <linux/scatterlist.h>
 #include <linux/list.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/device.h>
 #include <linux/mod_devicetable.h>
 #include <linux/interrupt.h>
include/linux/livepatch.h +1 -1
index 9b9b38e89563..5277d2a768eb 100644
@@ -11,7 +11,7 @@
 
 #include <linux/module.h>
 #include <linux/ftrace.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/list.h>
 #include <linux/livepatch_sched.h>
 
include/linux/mailbox_controller.h +1 -1
index 2006897fdaf9..c59f13cb5f28 100644
@@ -5,7 +5,7 @@
 
 #include <linux/types.h>
 #include <linux/hrtimer_types.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 
 struct device;
 struct of_phandle_args;
include/linux/memremap.h +1 -1
index eea01060a6b7..767b64ab667b 100644
@@ -2,7 +2,7 @@
 #ifndef _LINUX_MEMREMAP_H_
 #define _LINUX_MEMREMAP_H_
 
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/mmzone.h>
 #include <linux/range.h>
 #include <linux/ioport.h>
include/linux/mfd/cs42l43.h +1 -1
index 00e074b8c41f..e09e95ce1538 100644
@@ -9,7 +9,7 @@
 #ifndef CS42L43_CORE_EXT_H
 #define CS42L43_CORE_EXT_H
 
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/mutex_types.h>
 #include <linux/regmap.h>
 #include <linux/regulator/consumer.h>
include/linux/mfd/da9052/da9052.h +1 -1
index 76feb3a7066d..ade7e7ca0729 100644
@@ -13,7 +13,7 @@
 #include <linux/interrupt.h>
 #include <linux/regmap.h>
 #include <linux/slab.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/list.h>
 #include <linux/mfd/core.h>
 
include/linux/mfd/wm8350/core.h +1 -1
index dc6ff85cb5b0..25379c7f94c4 100644
@@ -11,7 +11,7 @@
 #include <linux/kernel.h>
 #include <linux/mutex_types.h>
 #include <linux/interrupt.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/regmap.h>
 
 #include <linux/mfd/wm8350/audio.h>
include/linux/mlx4/device.h +1 -1
index 27f42f713c89..18d71b808bc2 100644
@@ -36,7 +36,7 @@
 #include <linux/auxiliary_bus.h>
 #include <linux/if_ether.h>
 #include <linux/pci.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/radix-tree.h>
 #include <linux/cpu_rmap.h>
 #include <linux/crash_dump.h>
include/linux/mlx5/cq.h +1 -0
index cb15308b5cb0..7acfefd41950 100644
@@ -35,6 +35,7 @@
 
 #include <linux/mlx5/driver.h>
 #include <linux/refcount.h>
+#include <linux/completion.h>
 
 struct mlx5_core_cq {
 	u32			cqn;
include/linux/mlx5/driver.h +1 -1
index 7d47499ce75a..d9b99aca9e72 100644
@@ -34,7 +34,7 @@
 #define MLX5_DRIVER_H
 
 #include <linux/kernel.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/pci.h>
 #include <linux/irq.h>
 #include <linux/spinlock_types.h>
include/linux/mmc/core.h +1 -1
index 2c7928a50907..54cee0bf305d 100644
@@ -5,7 +5,7 @@
 #ifndef LINUX_MMC_CORE_H
 #define LINUX_MMC_CORE_H
 
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/types.h>
 
 struct mmc_data;
include/linux/mtd/onenand.h +1 -1
index 7ebd8180c617..43e0f8812f52 100644
@@ -10,7 +10,7 @@
 #define __LINUX_MTD_ONENAND_H
 
 #include <linux/spinlock_types.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/mtd/flashchip.h>
 #include <linux/mtd/onenand_regs.h>
 #include <linux/mtd/bbm.h>
include/linux/mtd/sh_flctl.h +1 -1
index 78fc2d4218c8..2f48438bf2a3 100644
@@ -8,7 +8,7 @@
 #ifndef __SH_FLCTL_H__
 #define __SH_FLCTL_H__
 
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/rawnand.h>
 #include <linux/mtd/partitions.h>
include/linux/ntb.h +1 -1
index 191b524e5c0d..b8a8be4052e1 100644
@@ -56,7 +56,7 @@
 #ifndef _NTB_H_
 #define _NTB_H_
 
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/device.h>
 #include <linux/interrupt.h>
 
include/linux/pm.h +1 -1
index c1533ce86893..34cf20dd1ad1 100644
@@ -15,7 +15,7 @@
 #include <linux/spinlock_types.h>
 #include <linux/wait_types.h>
 #include <linux/hrtimer_types.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 
 #ifdef CONFIG_PM_CLK
 #include <linux/mutex_types.h>
include/linux/rcupdate_wait.h +1 -1
index d07f0848802e..a28b4fce69a5 100644
@@ -7,7 +7,7 @@
  */
 
 #include <linux/rcupdate.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/sched.h>
 
 /*
include/linux/sched/signal.h +1 -1
index 17436f950ec2..565d3e13efd3 100644
@@ -7,7 +7,7 @@
 #include <linux/sched.h>
 #include <linux/sched/jobctl.h>
 #include <linux/sched/task.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/refcount.h>
 #include <linux/pid.h>
 #include <linux/posix-timers_types.h>
include/linux/soc/qcom/qmi.h +1 -1
index 900c4b3540cc..d2e725b1864b 100644
@@ -6,7 +6,7 @@
 #ifndef __QMI_HELPERS_H__
 #define __QMI_HELPERS_H__
 
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/idr.h>
 #include <linux/list.h>
 #include <linux/qrtr.h>
include/linux/spi/spi.h +1 -1
index 586a6ac21535..8f3b79a0d5d1 100644
@@ -8,7 +8,7 @@
 
 #include <linux/acpi.h>
 #include <linux/bits.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/device.h>
 #include <linux/gpio/consumer.h>
 #include <linux/kthread.h>
include/linux/srcutree.h +1 -1
index 74edc15cfcf3..8b1747a66608 100644
@@ -12,7 +12,7 @@
 #define _LINUX_SRCU_TREE_H
 
 #include <linux/rcu_node_tree.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/mutex_types.h>
 #include <linux/workqueue.h>
 
include/linux/usb.h +1 -1
index d7e2fa3d888d..a994f8a5edfd 100644
@@ -18,7 +18,7 @@
 #include <linux/kref_types.h>	/* for struct kref */
 #include <linux/device.h>	/* for struct device */
 #include <linux/fs.h>		/* for struct file_operations */
-#include <linux/completion.h>	/* for struct completion */
+#include <linux/completion_types.h>	/* for struct completion */
 #include <linux/sched.h>	/* for current && schedule_timeout */
 #include <linux/mutex_types.h>	/* for struct mutex */
 #include <linux/sprintf.h>
include/net/inet_frag.h +1 -1
index 153960663ce4..eafb78c7cd76 100644
@@ -3,7 +3,7 @@
 #define __NET_FRAG_H__
 
 #include <linux/rhashtable-types.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/in6.h>
 #include <linux/rbtree_types.h>
 #include <linux/refcount.h>
include/rdma/ib_sa.h +1 -1
index b46353fc53bf..fd6f7630e91e 100644
@@ -8,7 +8,7 @@
 #ifndef IB_SA_H
 #define IB_SA_H
 
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/compiler.h>
 
 #include <linux/atomic.h>
include/rdma/restrack.h +1 -1
index f5a4ae56a1d9..48aba5db7544 100644
@@ -9,7 +9,7 @@
 #include <linux/typecheck.h>
 #include <linux/sched.h>
 #include <linux/kref_types.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/sched/task.h>
 #include <uapi/rdma/rdma_netlink.h>
 
include/target/target_core_base.h +1 -1
index 97099a5e3f6c..5b9156adceca 100644
@@ -7,7 +7,7 @@
 #include <linux/sbitmap.h>
 #include <linux/percpu-refcount.h>
 #include <linux/semaphore.h>     /* struct semaphore */
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 
 #define TARGET_CORE_VERSION		"v5.0"
 
include/xen/xenbus.h +1 -1
index d0f2e0a134be..a7326aa58680 100644
@@ -38,7 +38,7 @@
 #include <linux/notifier.h>
 #include <linux/export.h>
 #include <linux/fs.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/semaphore.h>
Signature · 1 line
2.39.2
#16 lore raw

PATCH v5 16/35 device.h: move declarations to device_types.h

In reply to Max Kellermann

By providing declarations in a lean header, we can reduce header dependencies.

---
 block/disk-events.c                           |   1 +
 block/early-lookup.c                          |   1 +
 block/partitions/core.c                       |   1 +
 drivers/counter/counter-chrdev.c              |   1 +
 drivers/cxl/cxl.h                             |   1 +
 drivers/devfreq/devfreq-event.c               |   1 +
 drivers/extcon/extcon.h                       |   2 +-
 drivers/gpu/drm/mcde/mcde_clk_div.c           |   1 +
 .../gpu/drm/renesas/rcar-du/rcar_du_encoder.c |   1 +
 .../drm/renesas/rcar-du/rcar_du_writeback.c   |   2 +
 drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c       |   1 +
 drivers/gpu/drm/tidss/tidss_encoder.c         |   1 +
 drivers/gpu/drm/tidss/tidss_plane.c           |   1 +
 include/linux/acpi.h                          |   2 +-
 include/linux/backlight.h                     |   2 +-
 include/linux/blk_types.h                     |   2 +-
 include/linux/blkdev.h                        |   2 +-
 include/linux/container.h                     |   2 +-
 include/linux/coresight.h                     |   2 +-
 include/linux/counter.h                       |   2 +-
 include/linux/devfreq-event.h                 |   2 +-
 include/linux/devfreq.h                       |   2 +-
 include/linux/device.h                        | 466 +---------------
 include/linux/device_types.h                  | 501 ++++++++++++++++++
 include/linux/dmaengine.h                     |   2 +-
 include/linux/edac.h                          |   2 +-
 include/linux/enclosure.h                     |   2 +-
 include/linux/fpga/fpga-bridge.h              |   2 +-
 include/linux/fpga/fpga-region.h              |   2 +-
 include/linux/framer/framer.h                 |   2 +-
 include/linux/hdmi.h                          |   2 +-
 include/linux/hwmon-sysfs.h                   |   2 +-
 include/linux/iio/iio.h                       |   2 +-
 include/linux/lcd.h                           |   2 +-
 include/linux/node.h                          |   2 +-
 include/linux/peci.h                          |   2 +-
 include/linux/pm_clock.h                      |   2 +-
 include/linux/pm_domain.h                     |   2 +-
 include/linux/pm_qos.h                        |   2 +-
 include/linux/power_supply.h                  |   2 +-
 include/linux/powercap.h                      |   2 +-
 include/linux/rtc.h                           |   2 +-
 include/linux/swiotlb.h                       |   3 +-
 include/linux/thermal.h                       |   2 +-
 include/linux/w1.h                            |   2 +-
 include/media/cec.h                           |   2 +-
 include/media/media-devnode.h                 |   2 +-
 include/net/nfc/nfc.h                         |   2 +-
 include/pcmcia/ss.h                           |   2 +-
 include/scsi/scsi_device.h                    |   1 +
 kernel/trace/blktrace.c                       |   1 +
 51 files changed, 552 insertions(+), 501 deletions(-)
 create mode 100644 include/linux/device_types.h
block/disk-events.c +1 -0
index f9ec09799906..86b3a7b6ccdf 100644
@@ -5,6 +5,7 @@
 #include <linux/export.h>
 #include <linux/moduleparam.h>
 #include <linux/blkdev.h>
+#include <linux/device.h>
 #include <linux/kobject.h>
 #include "blk.h"
 #include <linux/sprintf.h>
block/early-lookup.c +1 -0
index 0862a56c25ac..0bfb6b3fecf5 100644
@@ -5,6 +5,7 @@
  */
 #include <linux/blkdev.h>
 #include <linux/ctype.h>
+#include <linux/device.h>
 #include <linux/kstrtox.h>
 #include <linux/sprintf.h>
 
block/partitions/core.c +1 -0
index b56add574054..576118154d57 100644
@@ -9,6 +9,7 @@
 #include <linux/major.h>
 #include <linux/slab.h>
 #include <linux/ctype.h>
+#include <linux/device.h>
 #include <linux/sprintf.h>
 #include <linux/vmalloc.h>
 #include <linux/raid/detect.h>
drivers/counter/counter-chrdev.c +1 -0
index afc94d0062b1..7d3e44315c8c 100644
@@ -5,6 +5,7 @@
  */
 #include <linux/cdev.h>
 #include <linux/counter.h>
+#include <linux/device.h>
 #include <linux/err.h>
 #include <linux/errno.h>
 #include <linux/export.h>
drivers/cxl/cxl.h +1 -0
index 0f4a9fe037b4..6595107bdf3c 100644
@@ -7,6 +7,7 @@
 #include <linux/libnvdimm.h>
 #include <linux/bitfield.h>
 #include <linux/bitops.h>
+#include <linux/device_types.h>
 #include <linux/device/driver.h>
 #include <linux/log2.h>
 #include <linux/node.h>
drivers/devfreq/devfreq-event.c +1 -0
index 649971baca70..48237648615a 100644
@@ -9,6 +9,7 @@
  */
 
 #include <linux/devfreq-event.h>
+#include <linux/device.h>
 #include <linux/kernel.h>
 #include <linux/err.h>
 #include <linux/init.h>
drivers/extcon/extcon.h +1 -1
index b2e0f715d81c..1b850b2a06ac 100644
@@ -2,7 +2,7 @@
 #ifndef __LINUX_EXTCON_INTERNAL_H__
 #define __LINUX_EXTCON_INTERNAL_H__
 
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/extcon-provider.h>
 
 /**
drivers/gpu/drm/mcde/mcde_clk_div.c +1 -0
index 3056ac566473..ac90497d366a 100644
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/clk-provider.h>
+#include <linux/device.h> // for devm_kzalloc()
 #include <linux/io.h>
 #include <linux/regulator/consumer.h>
 
drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c +1 -0
index 7ecec7b04a8d..18842d466b74 100644
@@ -7,6 +7,7 @@
  * Contact: Laurent Pinchart ([email protected])
  */
 
+#include <linux/device.h> // for dev_dbg()
 #include <linux/export.h>
 #include <linux/of.h>
 
drivers/gpu/drm/renesas/rcar-du/rcar_du_writeback.c +2 -0
index 8cd37d7b8ae2..0fb49db3a5b6 100644
@@ -13,6 +13,8 @@
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_writeback.h>
 
+#include <linux/device.h> // for dev_dbg()
+
 #include "rcar_du_crtc.h"
 #include "rcar_du_drv.h"
 #include "rcar_du_kms.h"
drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c +1 -0
index 03d7de1911cd..e27219f38e80 100644
@@ -7,6 +7,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/device.h> // for devm_kzalloc()
 #include <linux/regmap.h>
 
 #include "sun4i_tcon.h"
drivers/gpu/drm/tidss/tidss_encoder.c +1 -0
index 17a86bed8054..c002c07f262e 100644
@@ -4,6 +4,7 @@
  * Author: Tomi Valkeinen <[email protected]>
  */
 
+#include <linux/device.h> // for dev_dbg()
 #include <linux/export.h>
 
 #include <drm/drm_atomic_helper.h>
drivers/gpu/drm/tidss/tidss_plane.c +1 -0
index 2d9cc2b12cc6..13aac5a6ec21 100644
@@ -11,6 +11,7 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_atomic_helper.h>
+#include <linux/device.h> // for dev_dbg()
 
 #include <linux/device.h> // for dev_dbg()
 #include <linux/slab.h>
include/linux/acpi.h +1 -1
index 3beab76d31d4..9f0a021dfef3 100644
@@ -11,7 +11,7 @@
 #include <linux/errno.h>
 #include <linux/ioport.h>	/* for struct resource */
 #include <linux/resource_ext.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/mod_devicetable.h>
 #include <linux/property.h>
 #include <linux/uuid.h>
include/linux/backlight.h +1 -1
index 614653e07e3a..9164ee5f1c8b 100644
@@ -9,7 +9,7 @@
 #ifndef _LINUX_BACKLIGHT_H
 #define _LINUX_BACKLIGHT_H
 
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/fb.h>
 #include <linux/mutex.h>
 #include <linux/notifier.h>
include/linux/blk_types.h +1 -1
index 9d2d8a8328a6..96a37f399928 100644
@@ -8,7 +8,7 @@
 
 #include <linux/types.h>
 #include <linux/bvec_types.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/ktime.h>
 
 struct bio_set;
include/linux/blkdev.h +1 -1
index 2a8df9c0e87b..7e1fc101a5c3 100644
@@ -8,7 +8,7 @@
 #include <linux/types.h>
 #include <linux/fs.h> // for inode_unhashed()
 #include <linux/blk_types.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/list.h>
 #include <linux/minmax.h>
 #include <linux/timer_types.h>
include/linux/container.h +1 -1
index dd00cc918a92..a90e59f0c65d 100644
@@ -9,7 +9,7 @@
 #ifndef _LINUX_CONTAINER_H
 #define _LINUX_CONTAINER_H
 
-#include <linux/device.h>
+#include <linux/device_types.h>
 
 /* drivers/base/power/container.c */
 extern const struct bus_type container_subsys;
include/linux/coresight.h +1 -1
index a4cb7dd6ca23..fce16528de85 100644
@@ -8,7 +8,7 @@
 
 #include <linux/amba/bus.h>
 #include <linux/clk.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/io.h>
 #include <linux/perf_event.h>
 #include <linux/sched.h>
include/linux/counter.h +1 -1
index 638ebb5b4d27..95e8067f4b78 100644
@@ -7,7 +7,7 @@
 #define _COUNTER_H_
 
 #include <linux/cdev.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/kernel.h>
 #include <linux/kfifo.h>
 #include <linux/mutex_types.h>
include/linux/devfreq-event.h +1 -1
index 4a50a5c71a5f..36f0e6cf7cc5 100644
@@ -9,7 +9,7 @@
 #ifndef __LINUX_DEVFREQ_EVENT_H__
 #define __LINUX_DEVFREQ_EVENT_H__
 
-#include <linux/device.h>
+#include <linux/device_types.h>
 
 /**
  * struct devfreq_event_dev - the devfreq-event device
include/linux/devfreq.h +1 -1
index d312ffbac4dd..bf8d30af9fa2 100644
@@ -10,7 +10,7 @@
 #ifndef __LINUX_DEVFREQ_H__
 #define __LINUX_DEVFREQ_H__
 
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/notifier.h>
 #include <linux/pm_opp.h>
 #include <linux/pm_qos.h>
include/linux/device.h +1 -465

508 lines not on this page · raw message

include/linux/device_types.h new file +501 -0

501 lines not on this page · raw message

include/linux/dmaengine.h +1 -1
index 32c2f49177b1..765f799d49bd 100644
@@ -5,7 +5,7 @@
 #ifndef LINUX_DMAENGINE_H
 #define LINUX_DMAENGINE_H
 
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/err.h>
 #include <linux/idr.h> // for struct ida
 #include <linux/uio.h>
include/linux/edac.h +1 -1
index 7b78403cac40..08ba34f2a43e 100644
@@ -13,7 +13,7 @@
 #define _LINUX_EDAC_H_
 
 #include <linux/atomic.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/completion_types.h>
 #include <linux/workqueue_types.h>
 #include <linux/debugfs.h>
include/linux/enclosure.h +1 -1
index 1c630e2c2756..8fb9f561263f 100644
@@ -12,7 +12,7 @@
 #ifndef _LINUX_ENCLOSURE_H_
 #define _LINUX_ENCLOSURE_H_
 
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/list.h>
 
 /* A few generic types ... taken from ses-2 */
include/linux/fpga/fpga-bridge.h +1 -1
index 223da48a6d18..3a1eeb26bd65 100644
@@ -3,7 +3,7 @@
 #ifndef _LINUX_FPGA_BRIDGE_H
 #define _LINUX_FPGA_BRIDGE_H
 
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/fpga/fpga-mgr.h>
 
 struct fpga_bridge;
include/linux/fpga/fpga-region.h +1 -1
index 9d4d32909340..be1e5033f0d3 100644
@@ -3,7 +3,7 @@
 #ifndef _FPGA_REGION_H
 #define _FPGA_REGION_H
 
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/fpga/fpga-mgr.h>
 #include <linux/fpga/fpga-bridge.h>
 
include/linux/framer/framer.h +1 -1
index 2352a52d7d0f..ebaacd782702 100644
@@ -14,7 +14,7 @@
 #include <linux/mutex_types.h>
 #include <linux/notifier.h>
 #include <linux/of.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/workqueue_types.h>
 
 /**
include/linux/hdmi.h +1 -1
index 3bb87bf6bc65..5803588f86db 100644
@@ -25,7 +25,7 @@
 #define __LINUX_HDMI_H_
 
 #include <linux/types.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
 
 enum hdmi_packet_type {
 	HDMI_PACKET_TYPE_NULL = 0x00,
include/linux/hwmon-sysfs.h +1 -1
index d896713359cd..6b13b3e5a9b5 100644
@@ -7,7 +7,7 @@
 #ifndef _LINUX_HWMON_SYSFS_H
 #define _LINUX_HWMON_SYSFS_H
 
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/kstrtox.h>
 
 struct sensor_device_attribute{
include/linux/iio/iio.h +1 -1
index 6dafef342e91..91d67fdda784 100644
@@ -7,7 +7,7 @@
 #ifndef _INDUSTRIAL_IO_H_
 #define _INDUSTRIAL_IO_H_
 
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/cdev.h>
 #include <linux/device.h>
 #include <linux/slab.h>
include/linux/lcd.h +1 -1
index 238fb1dfed98..a0deeeb3db49 100644
@@ -9,7 +9,7 @@
 #ifndef _LINUX_LCD_H
 #define _LINUX_LCD_H
 
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/mutex.h>
 #include <linux/notifier.h>
 #include <linux/fb.h>
include/linux/node.h +1 -1
index c4c17037c954..791954e0f01b 100644
@@ -15,7 +15,7 @@
 #ifndef _LINUX_NODE_H_
 #define _LINUX_NODE_H_
 
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/cpumask.h>
 #include <linux/list.h>
 #include <linux/mmzone.h> // for enum meminit_context
include/linux/peci.h +1 -1
index ad3ea1371680..39d455231e21 100644
@@ -4,7 +4,7 @@
 #ifndef __LINUX_PECI_H
 #define __LINUX_PECI_H
 
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/kernel.h>
 #include <linux/mutex_types.h>
 #include <linux/types.h>
include/linux/pm_clock.h +1 -1
index 68669ce18720..8b89565c6e6e 100644
@@ -8,7 +8,7 @@
 #ifndef _LINUX_PM_CLOCK_H
 #define _LINUX_PM_CLOCK_H
 
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/notifier.h>
 
 struct pm_clk_notifier_block {
include/linux/pm_domain.h +1 -1
index 5c90e059cdb7..215867204aa9 100644
@@ -8,7 +8,7 @@
 #ifndef _LINUX_PM_DOMAIN_H
 #define _LINUX_PM_DOMAIN_H
 
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/ktime.h>
 #include <linux/mutex_types.h>
 #include <linux/pm.h>
include/linux/pm_qos.h +1 -1
index 4a69d4af3ff8..97234cba44e0 100644
@@ -14,7 +14,7 @@
 
 #include <linux/plist.h>
 #include <linux/notifier.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
 
 enum pm_qos_flags_status {
 	PM_QOS_FLAGS_UNDEFINED = -1,
include/linux/power_supply.h +1 -1
index 2bcf998da2a7..762ffc2c5dc2 100644
@@ -12,7 +12,7 @@
 #ifndef __LINUX_POWER_SUPPLY_H__
 #define __LINUX_POWER_SUPPLY_H__
 
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/workqueue_types.h>
 #include <linux/leds.h>
 #include <linux/spinlock_types.h>
include/linux/powercap.h +1 -1
index 3d557bbcd2c7..da48bd9bcdd7 100644
@@ -7,7 +7,7 @@
 #ifndef __POWERCAP_H__
 #define __POWERCAP_H__
 
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/idr.h>
 
 /*
include/linux/rtc.h +1 -1
index 98401e771e75..82cb7f0fd843 100644
@@ -34,7 +34,7 @@ static inline time64_t rtc_tm_sub(struct rtc_time *lhs, struct rtc_time *rhs)
 	return rtc_tm_to_time64(lhs) - rtc_tm_to_time64(rhs);
 }
 
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/seq_file.h>
 #include <linux/cdev.h>
 #include <linux/poll.h>
include/linux/swiotlb.h +1 -2
index c37473373649..94aa8de02ea7 100644
@@ -2,7 +2,7 @@
 #ifndef __LINUX_SWIOTLB_H
 #define __LINUX_SWIOTLB_H
 
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/dma-direction.h>
 #include <linux/init.h>
 #include <linux/types.h>
@@ -10,7 +10,6 @@
 #include <linux/spinlock_types.h>
 #include <linux/workqueue_types.h>
 
-struct device;
 struct page;
 struct scatterlist;
 
include/linux/thermal.h +1 -1
index 14450673bd8b..ba5d2bd8e007 100644
@@ -11,7 +11,7 @@
 #define __THERMAL_H__
 
 #include <linux/idr.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/sysfs_types.h>
 #include <linux/workqueue_types.h>
 #include <uapi/linux/thermal.h>
include/linux/w1.h +1 -1
index 9a2a0ef39018..3cbc5e0bab9d 100644
@@ -6,7 +6,7 @@
 #ifndef __LINUX_W1_H
 #define __LINUX_W1_H
 
-#include <linux/device.h>
+#include <linux/device_types.h>
 
 /**
  * struct w1_reg_num - broken out slave device id
include/media/cec.h +1 -1
index 4c9daa53ae34..562aad160e2b 100644
@@ -11,7 +11,7 @@
 #include <linux/poll.h>
 #include <linux/fs.h>
 #include <linux/debugfs.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/cdev.h>
 #include <linux/kthread.h>
 #include <linux/cec-funcs.h>
include/media/media-devnode.h +1 -1
index d27c1c646c28..e690f171c67e 100644
@@ -18,7 +18,7 @@
 
 #include <linux/poll.h>
 #include <linux/fs.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/cdev.h>
 
 struct media_device;
include/net/nfc/nfc.h +1 -1
index 5dee575fbe86..9b8991560a3e 100644
@@ -12,7 +12,7 @@
 #define __NET_NFC_H
 
 #include <linux/nfc.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/skbuff.h>
 
 #define nfc_dbg(dev, fmt, ...) dev_dbg((dev), "NFC: " fmt, ##__VA_ARGS__)
include/pcmcia/ss.h +1 -1
index 694e5ae0f245..4bf85a0cfa5e 100644
@@ -12,7 +12,7 @@
 #ifndef _LINUX_SS_H
 #define _LINUX_SS_H
 
-#include <linux/device.h>
+#include <linux/device_types.h>
 #include <linux/sched.h>	/* task_struct, completion */
 #include <linux/mutex_types.h>
 
include/scsi/scsi_device.h +1 -0
index c70aafd415b5..74c9a6d165ac 100644
@@ -2,6 +2,7 @@
 #ifndef _SCSI_SCSI_DEVICE_H
 #define _SCSI_SCSI_DEVICE_H
 
+#include <linux/device.h> // for device_reprobe()
 #include <linux/list.h>
 #include <linux/spinlock_types.h>
 #include <linux/workqueue_types.h>
kernel/trace/blktrace.c +1 -0
index 620ffbd44dbe..76b77496d734 100644
@@ -15,6 +15,7 @@
 #include <linux/mutex.h>
 #include <linux/slab.h>
 #include <linux/debugfs.h>
+#include <linux/device.h>
 #include <linux/export.h>
 #include <linux/sprintf.h>
 #include <linux/time.h>
Signature · 1 line
2.39.2
#17 lore raw

PATCH v5 17/35 xarray.h: move declarations to xarray_types.h

In reply to Max Kellermann

By providing declarations in a lean header, we can reduce header dependencies.

---
 include/drm/gpu_scheduler.h  |  2 +-
 include/linux/blkdev.h       |  2 +-
 include/linux/list_lru.h     |  5 ++-
 include/linux/mlx5/driver.h  |  2 +-
 include/linux/msi.h          |  2 +-
 include/linux/pci.h          |  2 +-
 include/linux/xarray.h       | 56 +----------------------------
 include/linux/xarray_types.h | 70 ++++++++++++++++++++++++++++++++++++
 include/net/net_namespace.h  |  2 +-
 include/net/sch_generic.h    |  2 +-
 include/sound/core.h         |  5 ++-
 11 files changed, 86 insertions(+), 64 deletions(-)
 create mode 100644 include/linux/xarray_types.h
include/drm/gpu_scheduler.h +1 -1
index 9a89f72a3bac..f2fb8931cb17 100644
@@ -27,7 +27,7 @@
 #include <drm/spsc_queue.h>
 #include <linux/dma-fence.h>
 #include <linux/completion_types.h>
-#include <linux/xarray.h>
+#include <linux/xarray_types.h>
 #include <linux/wait_types.h>
 #include <linux/workqueue_types.h>
 
include/linux/blkdev.h +1 -1
index 7e1fc101a5c3..e67298984913 100644
@@ -23,7 +23,7 @@
 #include <linux/sched.h>
 #include <linux/uio.h> // for iov_iter_is_aligned()
 #include <linux/uuid.h>
-#include <linux/xarray.h>
+#include <linux/xarray_types.h>
 
 struct module;
 struct request_queue;
include/linux/list_lru.h +4 -1
index 792b67ceb631..5e8cd106dae4 100644
@@ -11,7 +11,10 @@
 #include <linux/list.h>
 #include <linux/nodemask.h>
 #include <linux/shrinker.h>
-#include <linux/xarray.h>
+
+#ifdef CONFIG_MEMCG_KMEM
+#include <linux/xarray_types.h>
+#endif
 
 struct mem_cgroup;
 
include/linux/mlx5/driver.h +1 -1
index d9b99aca9e72..07956bd2e55b 100644
@@ -41,7 +41,7 @@
 #include <linux/semaphore.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
-#include <linux/xarray.h>
+#include <linux/xarray_types.h>
 #include <linux/workqueue_types.h>
 #include <linux/mempool.h>
 #include <linux/interrupt.h>
include/linux/msi.h +1 -1
index 04fd2c856287..a3969b00a793 100644
@@ -21,7 +21,7 @@
 #include <linux/irqdomain_defs.h>
 #include <linux/cpumask.h>
 #include <linux/msi_api.h>
-#include <linux/xarray.h>
+#include <linux/xarray_types.h>
 #include <linux/mutex_types.h>
 #include <linux/list.h>
 #include <linux/irq.h>
include/linux/pci.h +1 -1
index a0fee72c45a4..f2a5638503a3 100644
@@ -44,7 +44,7 @@
 #include <linux/pci_ids.h>
 
 #ifdef CONFIG_PCI_DOE
-#include <linux/xarray.h>
+#include <linux/xarray_types.h>
 #endif
 
 #ifndef CONFIG_PCI_IOV
include/linux/xarray.h +1 -55

83 lines not on this page · raw message

include/linux/xarray_types.h new file +70 -0

70 lines not on this page · raw message

include/net/net_namespace.h +1 -1
index 7a92421640be..50826b5e7b85 100644
@@ -41,7 +41,7 @@
 #include <linux/idr.h>
 #include <linux/skbuff.h>
 #include <linux/notifier.h>
-#include <linux/xarray.h>
+#include <linux/xarray_types.h>
 
 struct user_namespace;
 struct proc_dir_entry;
include/net/sch_generic.h +1 -1
index 6ec5064156d9..9845ea172382 100644
@@ -18,7 +18,7 @@
 #include <net/gen_stats.h>
 #include <net/rtnetlink.h>
 #include <net/flow_offload.h>
-#include <linux/xarray.h>
+#include <linux/xarray_types.h>
 
 struct Qdisc_ops;
 struct qdisc_walker;
include/sound/core.h +4 -1
index f95f6863986f..7dcba88b2fb7 100644
@@ -14,7 +14,10 @@
 #include <linux/stringify.h>
 #include <linux/printk.h>
 #include <linux/wait.h>
-#include <linux/xarray.h>
+
+#ifdef CONFIG_SND_CTL_FAST_LOOKUP
+#include <linux/xarray_types.h>
+#endif
 
 /* number of supported soundcards */
 #ifdef CONFIG_SND_DYNAMIC_MINORS
Signature · 1 line
2.39.2
#18 lore raw

PATCH v5 18/35 blkdev.h: move blk_op_is_passthrough() to blk_types.h

In reply to Max Kellermann

This is a very low-level function without any additional dependencies, and moving it will allow certain sources to omit the "blkdev.h" dependency.

---
 include/linux/blk_types.h | 6 ++++++
 include/linux/blkdev.h    | 6 ------
 2 files changed, 6 insertions(+), 6 deletions(-)
include/linux/blk_types.h +6 -0
index 96a37f399928..ad48c3f5ddd6 100644
@@ -434,6 +434,12 @@ static inline enum req_op bio_op(const struct bio *bio)
 	return bio->bi_opf & REQ_OP_MASK;
 }
 
+static inline bool blk_op_is_passthrough(blk_opf_t op)
+{
+	op &= REQ_OP_MASK;
+	return op == REQ_OP_DRV_IN || op == REQ_OP_DRV_OUT;
+}
+
 static inline bool op_is_write(blk_opf_t op)
 {
 	return !!(op & (__force blk_opf_t)1);
include/linux/blkdev.h +0 -6
index e67298984913..6bfa4b92bb32 100644
@@ -260,12 +260,6 @@ static inline int blk_validate_block_size(unsigned long bsize)
 	return 0;
 }
 
-static inline bool blk_op_is_passthrough(blk_opf_t op)
-{
-	op &= REQ_OP_MASK;
-	return op == REQ_OP_DRV_IN || op == REQ_OP_DRV_OUT;
-}
-
 /*
  * BLK_BOUNCE_NONE:	never bounce (default)
  * BLK_BOUNCE_HIGH:	bounce all highmem pages
Signature · 1 line
2.39.2
#19 lore raw

PATCH v5 19/35 bio.h: move bio_has_data() and bio_no_advance_iter() to blk_types.h

In reply to Max Kellermann

"struct bio" has nothing to do with "bio.h", the naming is just confusing. This move will allow narrowing other dependencies later.

---
 include/linux/bio.h       | 22 ----------------------
 include/linux/blk_types.h | 23 +++++++++++++++++++++++
 2 files changed, 23 insertions(+), 22 deletions(-)
include/linux/bio.h +0 -22
index afae5a73b7cd..b8562d4b57b2 100644
@@ -49,28 +49,6 @@ static inline unsigned int bio_max_segs(unsigned int nr_segs)
 #define bio_data_dir(bio) \
 	(op_is_write(bio_op(bio)) ? WRITE : READ)
 
-/*
- * Check whether this bio carries any data or not. A NULL bio is allowed.
- */
-static inline bool bio_has_data(struct bio *bio)
-{
-	if (bio &&
-	    bio->bi_iter.bi_size &&
-	    bio_op(bio) != REQ_OP_DISCARD &&
-	    bio_op(bio) != REQ_OP_SECURE_ERASE &&
-	    bio_op(bio) != REQ_OP_WRITE_ZEROES)
-		return true;
-
-	return false;
-}
-
-static inline bool bio_no_advance_iter(const struct bio *bio)
-{
-	return bio_op(bio) == REQ_OP_DISCARD ||
-	       bio_op(bio) == REQ_OP_SECURE_ERASE ||
-	       bio_op(bio) == REQ_OP_WRITE_ZEROES;
-}
-
 static inline void *bio_data(struct bio *bio)
 {
 	if (bio_has_data(bio))
include/linux/blk_types.h +23 -0
index ad48c3f5ddd6..313db4b9b49e 100644
@@ -284,6 +284,7 @@ struct bio {
 #define BIO_RESET_BYTES		offsetof(struct bio, bi_max_vecs)
 #define BIO_MAX_SECTORS		(UINT_MAX >> SECTOR_SHIFT)
 
+
 /*
  * bio flags
  */
@@ -434,6 +435,28 @@ static inline enum req_op bio_op(const struct bio *bio)
 	return bio->bi_opf & REQ_OP_MASK;
 }
 
+/*
+ * Check whether this bio carries any data or not. A NULL bio is allowed.
+ */
+static inline bool bio_has_data(struct bio *bio)
+{
+	if (bio &&
+	    bio->bi_iter.bi_size &&
+	    bio_op(bio) != REQ_OP_DISCARD &&
+	    bio_op(bio) != REQ_OP_SECURE_ERASE &&
+	    bio_op(bio) != REQ_OP_WRITE_ZEROES)
+		return true;
+
+	return false;
+}
+
+static inline bool bio_no_advance_iter(const struct bio *bio)
+{
+	return bio_op(bio) == REQ_OP_DISCARD ||
+	       bio_op(bio) == REQ_OP_SECURE_ERASE ||
+	       bio_op(bio) == REQ_OP_WRITE_ZEROES;
+}
+
 static inline bool blk_op_is_passthrough(blk_opf_t op)
 {
 	op &= REQ_OP_MASK;
Signature · 1 line
2.39.2
#20 lore raw

PATCH v5 20/35 bio.h: move declarations to bio_types.h

In reply to Max Kellermann

By providing declarations in a lean header, we can reduce header dependencies.

---
 include/linux/bio.h       | 74 +---------------------------------
 include/linux/bio_types.h | 84 +++++++++++++++++++++++++++++++++++++++
 include/linux/blkdev.h    |  2 +-
 3 files changed, 86 insertions(+), 74 deletions(-)
 create mode 100644 include/linux/bio_types.h
include/linux/bio.h +1 -73
index b8562d4b57b2..cada670f63d8 100644
@@ -5,6 +5,7 @@
 #ifndef __LINUX_BIO_H
 #define __LINUX_BIO_H
 
+#include <linux/bio_types.h>
 #include <linux/mempool.h>
 /* struct bio, bio_vec and BIO_* flags are defined in blk_types.h */
 #include <linux/blk_types.h>
@@ -20,35 +21,6 @@ static inline unsigned int bio_max_segs(unsigned int nr_segs)
 	return min(nr_segs, BIO_MAX_VECS);
 }
 
-#define bio_prio(bio)			(bio)->bi_ioprio
-#define bio_set_prio(bio, prio)		((bio)->bi_ioprio = prio)
-
-#define bio_iter_iovec(bio, iter)				\
-	bvec_iter_bvec((bio)->bi_io_vec, (iter))
-
-#define bio_iter_page(bio, iter)				\
-	bvec_iter_page((bio)->bi_io_vec, (iter))
-#define bio_iter_len(bio, iter)					\
-	bvec_iter_len((bio)->bi_io_vec, (iter))
-#define bio_iter_offset(bio, iter)				\
-	bvec_iter_offset((bio)->bi_io_vec, (iter))
-
-#define bio_page(bio)		bio_iter_page((bio), (bio)->bi_iter)
-#define bio_offset(bio)		bio_iter_offset((bio), (bio)->bi_iter)
-#define bio_iovec(bio)		bio_iter_iovec((bio), (bio)->bi_iter)
-
-#define bvec_iter_sectors(iter)	((iter).bi_size >> 9)
-#define bvec_iter_end_sector(iter) ((iter).bi_sector + bvec_iter_sectors((iter)))
-
-#define bio_sectors(bio)	bvec_iter_sectors((bio)->bi_iter)
-#define bio_end_sector(bio)	bvec_iter_end_sector((bio)->bi_iter)
-
-/*
- * Return the data direction, READ or WRITE.
- */
-#define bio_data_dir(bio) \
-	(op_is_write(bio_op(bio)) ? WRITE : READ)
-
 static inline void *bio_data(struct bio *bio)
 {
 	if (bio_has_data(bio))
@@ -521,18 +493,6 @@ static inline void bio_set_dev(struct bio *bio, struct block_device *bdev)
 	bio_associate_blkg(bio);
 }
 
-/*
- * BIO list management for use by remapping drivers (e.g. DM or MD) and loop.
- *
- * A bio_list anchors a singly-linked list of bios chained through the bi_next
- * member of the bio.  The bio_list also caches the last list member to allow
- * fast access to the tail.
- */
-struct bio_list {
-	struct bio *head;
-	struct bio *tail;
-};
-
 static inline int bio_list_empty(const struct bio_list *bl)
 {
 	return bl->head == NULL;
@@ -656,38 +616,6 @@ static inline void bio_inc_remaining(struct bio *bio)
  */
 #define BIO_POOL_SIZE 2
 
-struct bio_set {
-	struct kmem_cache *bio_slab;
-	unsigned int front_pad;
-
-	/*
-	 * per-cpu bio alloc cache
-	 */
-	struct bio_alloc_cache __percpu *cache;
-
-	mempool_t bio_pool;
-	mempool_t bvec_pool;
-#if defined(CONFIG_BLK_DEV_INTEGRITY)
-	mempool_t bio_integrity_pool;
-	mempool_t bvec_integrity_pool;
-#endif
-
-	unsigned int back_pad;
-	/*
-	 * Deadlock avoidance for stacking block drivers: see comments in
-	 * bio_alloc_bioset() for details
-	 */
-	spinlock_t		rescue_lock;
-	struct bio_list		rescue_list;
-	struct work_struct	rescue_work;
-	struct workqueue_struct	*rescue_workqueue;
-
-	/*
-	 * Hot un-plug notifier for the per-cpu cache, if used
-	 */
-	struct hlist_node cpuhp_dead;
-};
-
 static inline bool bioset_initialized(struct bio_set *bs)
 {
 	return bs->bio_slab != NULL;
include/linux/bio_types.h new file +84 -0

84 lines not on this page · raw message

include/linux/blkdev.h +1 -1
index 6bfa4b92bb32..6747965c3580 100644
@@ -14,7 +14,7 @@
 #include <linux/timer_types.h>
 #include <linux/workqueue_types.h>
 #include <linux/wait_types.h>
-#include <linux/bio.h>
+#include <linux/bio_types.h>
 #include <linux/gfp_types.h>
 #include <linux/kdev_t.h>
 #include <linux/rcupdate.h>
Signature · 1 line
2.39.2
#21 lore raw

PATCH v5 21/35 percpu-refcount.h: move declarations to percpu-refcount_types.h

In reply to Max Kellermann

By providing declarations in a lean header, we can reduce header dependencies.

---
 drivers/target/target_core_pr.c       |  1 +
 drivers/target/target_core_xcopy.c    |  1 +
 include/linux/blkdev.h                |  2 +-
 include/linux/bpf-cgroup-defs.h       |  2 +-
 include/linux/bpf.h                   |  2 +-
 include/linux/cgroup-defs.h           |  2 +-
 include/linux/cgroup.h                |  1 +
 include/linux/percpu-refcount.h       | 64 +-----------------------
 include/linux/percpu-refcount_types.h | 71 +++++++++++++++++++++++++++
 include/linux/slab.h                  |  1 -
 include/target/target_core_base.h     |  2 +-
 11 files changed, 80 insertions(+), 69 deletions(-)
 create mode 100644 include/linux/percpu-refcount_types.h
drivers/target/target_core_pr.c +1 -0
index 6ed604a164f8..0ee29c16a161 100644
@@ -20,6 +20,7 @@
 #include <linux/fcntl.h>
 #include <linux/fs.h>
 #include <linux/kref.h>
+#include <linux/percpu-refcount.h>
 #include <scsi/scsi_proto.h>
 #include <asm/unaligned.h>
 
drivers/target/target_core_xcopy.c +1 -0
index df06ec0f75fe..37d306570f8a 100644
@@ -18,6 +18,7 @@
 #include <linux/rculist.h>
 #include <linux/completion.h>
 #include <linux/configfs.h>
+#include <linux/percpu-refcount.h>
 #include <linux/ratelimit.h>
 #include <linux/workqueue.h>
 #include <scsi/scsi_proto.h>
include/linux/blkdev.h +1 -1
index 6747965c3580..5cd0edada09d 100644
@@ -18,7 +18,7 @@
 #include <linux/gfp_types.h>
 #include <linux/kdev_t.h>
 #include <linux/rcupdate.h>
-#include <linux/percpu-refcount.h>
+#include <linux/percpu-refcount_types.h>
 #include <linux/blkzoned.h>
 #include <linux/sched.h>
 #include <linux/uio.h> // for iov_iter_is_aligned()
include/linux/bpf-cgroup-defs.h +1 -1
index f3b400858129..70b79fd81fee 100644
@@ -5,7 +5,7 @@
 #ifdef CONFIG_CGROUP_BPF
 
 #include <linux/list.h>
-#include <linux/percpu-refcount.h>
+#include <linux/percpu-refcount_types.h>
 #include <linux/workqueue_types.h>
 
 struct bpf_prog_array;
include/linux/bpf.h +1 -1
index c5c435d04460..e28c74dd67ab 100644
@@ -21,7 +21,7 @@
 #include <linux/capability.h>
 #include <linux/sched/mm.h>
 #include <linux/slab.h>
-#include <linux/percpu-refcount.h>
+#include <linux/percpu-refcount_types.h>
 #include <linux/stddef.h>
 #include <linux/bpfptr.h>
 #include <linux/btf.h>
include/linux/cgroup-defs.h +1 -1
index 99e24f3034df..878deefba0e1 100644
@@ -15,7 +15,7 @@
 #include <linux/mutex_types.h>
 #include <linux/rcupdate.h>
 #include <linux/refcount_types.h>
-#include <linux/percpu-refcount.h>
+#include <linux/percpu-refcount_types.h>
 #include <linux/percpu-rwsem.h>
 #include <linux/u64_stats_sync.h>
 #include <linux/workqueue.h>
include/linux/cgroup.h +1 -0
index 24dcff53bd05..19a5e801f77d 100644
@@ -21,6 +21,7 @@
 #include <linux/ns_common.h>
 #include <linux/nsproxy.h>
 #include <linux/user_namespace.h>
+#include <linux/percpu-refcount.h>
 #include <linux/refcount.h>
 #include <linux/kernel_stat.h>
 
include/linux/percpu-refcount.h +1 -63

75 lines not on this page · raw message

include/linux/percpu-refcount_types.h new file +71 -0

71 lines not on this page · raw message

include/linux/slab.h +0 -1
index a7ee429c0535..df92bb41affb 100644
@@ -17,7 +17,6 @@
 #include <linux/log2.h>
 #include <linux/overflow.h>
 #include <linux/types.h>
-#include <linux/percpu-refcount.h>
 #include <linux/cleanup.h>
 #include <linux/hash.h>
 #include <linux/mmzone.h>
include/target/target_core_base.h +1 -1
index 5b9156adceca..1598a4062398 100644
@@ -5,7 +5,7 @@
 #include <linux/configfs.h>      /* struct config_group */
 #include <linux/dma-direction.h> /* enum dma_data_direction */
 #include <linux/sbitmap.h>
-#include <linux/percpu-refcount.h>
+#include <linux/percpu-refcount_types.h>
 #include <linux/semaphore.h>     /* struct semaphore */
 #include <linux/completion_types.h>
 
Signature · 1 line
2.39.2
#22 lore raw

PATCH v5 22/35 blkdev.h: move declarations to blkdev_types.h

In reply to Max Kellermann

By providing declarations in a lean header, we can reduce header dependencies.

---
 include/linux/blkdev.h         | 444 +------------------------------
 include/linux/blkdev_types.h   | 463 +++++++++++++++++++++++++++++++++
 include/linux/cdrom.h          |   2 +-
 include/linux/io_uring_types.h |   2 +-
 io_uring/io_uring.c            |   1 +
 5 files changed, 467 insertions(+), 445 deletions(-)
 create mode 100644 include/linux/blkdev_types.h
include/linux/blkdev.h +1 -443
index 5cd0edada09d..6a07ced6099f 100644
@@ -5,11 +5,9 @@
 #ifndef _LINUX_BLKDEV_H
 #define _LINUX_BLKDEV_H
 
-#include <linux/types.h>
+#include <linux/blkdev_types.h>
 #include <linux/fs.h> // for inode_unhashed()
 #include <linux/blk_types.h>
-#include <linux/device_types.h>
-#include <linux/list.h>
 #include <linux/minmax.h>
 #include <linux/timer_types.h>
 #include <linux/workqueue_types.h>
@@ -45,173 +43,6 @@ extern const struct device_type disk_type;
 extern const struct device_type part_type;
 extern struct class block_class;
 
-/*
- * Maximum number of blkcg policies allowed to be registered concurrently.
- * Defined here to simplify include dependency.
- */
-#define BLKCG_MAX_POLS		6
-
-#define DISK_MAX_PARTS			256
-#define DISK_NAME_LEN			32
-
-#define PARTITION_META_INFO_VOLNAMELTH	64
-/*
- * Enough for the string representation of any kind of UUID plus NULL.
- * EFI UUID is 36 characters. MSDOS UUID is 11 characters.
- */
-#define PARTITION_META_INFO_UUIDLTH	(UUID_STRING_LEN + 1)
-
-struct partition_meta_info {
-	char uuid[PARTITION_META_INFO_UUIDLTH];
-	u8 volname[PARTITION_META_INFO_VOLNAMELTH];
-};
-
-/**
- * DOC: genhd capability flags
- *
- * ``GENHD_FL_REMOVABLE``: indicates that the block device gives access to
- * removable media.  When set, the device remains present even when media is not
- * inserted.  Shall not be set for devices which are removed entirely when the
- * media is removed.
- *
- * ``GENHD_FL_HIDDEN``: the block device is hidden; it doesn't produce events,
- * doesn't appear in sysfs, and can't be opened from userspace or using
- * blkdev_get*. Used for the underlying components of multipath devices.
- *
- * ``GENHD_FL_NO_PART``: partition support is disabled.  The kernel will not
- * scan for partitions from add_disk, and users can't add partitions manually.
- *
- */
-enum {
-	GENHD_FL_REMOVABLE			= 1 << 0,
-	GENHD_FL_HIDDEN				= 1 << 1,
-	GENHD_FL_NO_PART			= 1 << 2,
-};
-
-enum {
-	DISK_EVENT_MEDIA_CHANGE			= 1 << 0, /* media changed */
-	DISK_EVENT_EJECT_REQUEST		= 1 << 1, /* eject requested */
-};
-
-enum {
-	/* Poll even if events_poll_msecs is unset */
-	DISK_EVENT_FLAG_POLL			= 1 << 0,
-	/* Forward events to udev */
-	DISK_EVENT_FLAG_UEVENT			= 1 << 1,
-	/* Block event polling when open for exclusive write */
-	DISK_EVENT_FLAG_BLOCK_ON_EXCL_WRITE	= 1 << 2,
-};
-
-struct disk_events;
-struct badblocks;
-
-struct blk_integrity {
-	const struct blk_integrity_profile	*profile;
-	unsigned char				flags;
-	unsigned char				tuple_size;
-	unsigned char				interval_exp;
-	unsigned char				tag_size;
-};
-
-typedef unsigned int __bitwise blk_mode_t;
-
-/* open for reading */
-#define BLK_OPEN_READ		((__force blk_mode_t)(1 << 0))
-/* open for writing */
-#define BLK_OPEN_WRITE		((__force blk_mode_t)(1 << 1))
-/* open exclusively (vs other exclusive openers */
-#define BLK_OPEN_EXCL		((__force blk_mode_t)(1 << 2))
-/* opened with O_NDELAY */
-#define BLK_OPEN_NDELAY		((__force blk_mode_t)(1 << 3))
-/* open for "writes" only for ioctls (specialy hack for floppy.c) */
-#define BLK_OPEN_WRITE_IOCTL	((__force blk_mode_t)(1 << 4))
-/* open is exclusive wrt all other BLK_OPEN_WRITE opens to the device */
-#define BLK_OPEN_RESTRICT_WRITES	((__force blk_mode_t)(1 << 5))
-
-struct gendisk {
-	/*
-	 * major/first_minor/minors should not be set by any new driver, the
-	 * block core will take care of allocating them automatically.
-	 */
-	int major;
-	int first_minor;
-	int minors;
-
-	char disk_name[DISK_NAME_LEN];	/* name of major driver */
-
-	unsigned short events;		/* supported events */
-	unsigned short event_flags;	/* flags related to event processing */
-
-	struct xarray part_tbl;
-	struct block_device *part0;
-
-	const struct block_device_operations *fops;
-	struct request_queue *queue;
-	void *private_data;
-
-	struct bio_set bio_split;
-
-	int flags;
-	unsigned long state;
-#define GD_NEED_PART_SCAN		0
-#define GD_READ_ONLY			1
-#define GD_DEAD				2
-#define GD_NATIVE_CAPACITY		3
-#define GD_ADDED			4
-#define GD_SUPPRESS_PART_SCAN		5
-#define GD_OWNS_QUEUE			6
-
-	struct mutex open_mutex;	/* open/close mutex */
-	unsigned open_partitions;	/* number of open partitions */
-
-	struct backing_dev_info	*bdi;
-	struct kobject queue_kobj;	/* the queue/ directory */
-	struct kobject *slave_dir;
-#ifdef CONFIG_BLOCK_HOLDER_DEPRECATED
-	struct list_head slave_bdevs;
-#endif
-	struct timer_rand_state *random;
-	atomic_t sync_io;		/* RAID */
-	struct disk_events *ev;
-
-#ifdef CONFIG_BLK_DEV_ZONED
-	/*
-	 * Zoned block device information for request dispatch control.
-	 * nr_zones is the total number of zones of the device. This is always
-	 * 0 for regular block devices. conv_zones_bitmap is a bitmap of nr_zones
-	 * bits which indicates if a zone is conventional (bit set) or
-	 * sequential (bit clear). seq_zones_wlock is a bitmap of nr_zones
-	 * bits which indicates if a zone is write locked, that is, if a write
-	 * request targeting the zone was dispatched.
-	 *
-	 * Reads of this information must be protected with blk_queue_enter() /
-	 * blk_queue_exit(). Modifying this information is only allowed while
-	 * no requests are being processed. See also blk_mq_freeze_queue() and
-	 * blk_mq_unfreeze_queue().
-	 */
-	unsigned int		nr_zones;
-	unsigned int		max_open_zones;
-	unsigned int		max_active_zones;
-	unsigned long		*conv_zones_bitmap;
-	unsigned long		*seq_zones_wlock;
-#endif /* CONFIG_BLK_DEV_ZONED */
-
-#if IS_ENABLED(CONFIG_CDROM)
-	struct cdrom_device_info *cdi;
-#endif
-	int node_id;
-	struct badblocks *bb;
-	struct lockdep_map lockdep_map;
-	u64 diskseq;
-	blk_mode_t open_mode;
-
-	/*
-	 * Independent sector access ranges. This is always NULL for
-	 * devices that do not have multiple independent access ranges.
-	 */
-	struct blk_independent_access_ranges *ia_ranges;
-};
-
 static inline bool disk_live(struct gendisk *disk)
 {
 	return !inode_unhashed(disk->part0->bd_inode);
@@ -260,57 +91,6 @@ static inline int blk_validate_block_size(unsigned long bsize)
 	return 0;
 }
 
-/*
- * BLK_BOUNCE_NONE:	never bounce (default)
- * BLK_BOUNCE_HIGH:	bounce all highmem pages
- */
-enum blk_bounce {
-	BLK_BOUNCE_NONE,
-	BLK_BOUNCE_HIGH,
-};
-
-struct queue_limits {
-	enum blk_bounce		bounce;
-	unsigned long		seg_boundary_mask;
-	unsigned long		virt_boundary_mask;
-
-	unsigned int		max_hw_sectors;
-	unsigned int		max_dev_sectors;
-	unsigned int		chunk_sectors;
-	unsigned int		max_sectors;
-	unsigned int		max_user_sectors;
-	unsigned int		max_segment_size;
-	unsigned int		physical_block_size;
-	unsigned int		logical_block_size;
-	unsigned int		alignment_offset;
-	unsigned int		io_min;
-	unsigned int		io_opt;
-	unsigned int		max_discard_sectors;
-	unsigned int		max_hw_discard_sectors;
-	unsigned int		max_secure_erase_sectors;
-	unsigned int		max_write_zeroes_sectors;
-	unsigned int		max_zone_append_sectors;
-	unsigned int		discard_granularity;
-	unsigned int		discard_alignment;
-	unsigned int		zone_write_granularity;
-
-	unsigned short		max_segments;
-	unsigned short		max_integrity_segments;
-	unsigned short		max_discard_segments;
-
-	unsigned char		misaligned;
-	unsigned char		discard_misaligned;
-	unsigned char		raid_partial_stripes_expensive;
-	bool			zoned;
-
-	/*
-	 * Drivers that set dma_alignment to less than 511 must be prepared to
-	 * handle individual bvec's that are not a multiple of a SECTOR_SIZE
-	 * due to possible offsets.
-	 */
-	unsigned int		dma_alignment;
-};
-
 typedef int (*report_zones_cb)(struct blk_zone *zone, unsigned int idx,
 			       void *data);
 
@@ -351,194 +131,6 @@ struct blk_independent_access_ranges {
 	struct blk_independent_access_range	ia_range[];
 };
 
-struct request_queue {
-	/*
-	 * The queue owner gets to use this for whatever they like.
-	 * ll_rw_blk doesn't touch it.
-	 */
-	void			*queuedata;
-
-	struct elevator_queue	*elevator;
-
-	const struct blk_mq_ops	*mq_ops;
-
-	/* sw queues */
-	struct blk_mq_ctx __percpu	*queue_ctx;
-
-	/*
-	 * various queue flags, see QUEUE_* below
-	 */
-	unsigned long		queue_flags;
-
-	unsigned int		rq_timeout;
-
-	unsigned int		queue_depth;
-
-	refcount_t		refs;
-
-	/* hw dispatch queues */
-	unsigned int		nr_hw_queues;
-	struct xarray		hctx_table;
-
-	struct percpu_ref	q_usage_counter;
-
-	struct request		*last_merge;
-
-	spinlock_t		queue_lock;
-
-	int			quiesce_depth;
-
-	struct gendisk		*disk;
-
-	/*
-	 * mq queue kobject
-	 */
-	struct kobject *mq_kobj;
-
-	struct queue_limits	limits;
-
-#ifdef  CONFIG_BLK_DEV_INTEGRITY
-	struct blk_integrity integrity;
-#endif	/* CONFIG_BLK_DEV_INTEGRITY */
-
-#ifdef CONFIG_PM
-	struct device		*dev;
-	enum rpm_status		rpm_status;
-#endif
-
-	/*
-	 * Number of contexts that have called blk_set_pm_only(). If this
-	 * counter is above zero then only RQF_PM requests are processed.
-	 */
-	atomic_t		pm_only;
-
-	struct blk_queue_stats	*stats;
-	struct rq_qos		*rq_qos;
-	struct mutex		rq_qos_mutex;
-
-	/*
-	 * ida allocated id for this queue.  Used to index queues from
-	 * ioctx.
-	 */
-	int			id;
-
-	unsigned int		dma_pad_mask;
-
-	/*
-	 * queue settings
-	 */
-	unsigned long		nr_requests;	/* Max # of requests */
-
-#ifdef CONFIG_BLK_INLINE_ENCRYPTION
-	struct blk_crypto_profile *crypto_profile;
-	struct kobject *crypto_kobject;
-#endif
-
-	struct timer_list	timeout;
-	struct work_struct	timeout_work;
-
-	atomic_t		nr_active_requests_shared_tags;
-
-	unsigned int		required_elevator_features;
-
-	struct blk_mq_tags	*sched_shared_tags;
-
-	struct list_head	icq_list;
-#ifdef CONFIG_BLK_CGROUP
-	DECLARE_BITMAP		(blkcg_pols, BLKCG_MAX_POLS);
-	struct blkcg_gq		*root_blkg;
-	struct list_head	blkg_list;
-	struct mutex		blkcg_mutex;
-#endif
-
-	int			node;
-
-	spinlock_t		requeue_lock;
-	struct list_head	requeue_list;
-	struct delayed_work	requeue_work;
-
-#ifdef CONFIG_BLK_DEV_IO_TRACE
-	struct blk_trace __rcu	*blk_trace;
-#endif
-	/*
-	 * for flush operations
-	 */
-	struct blk_flush_queue	*fq;
-	struct list_head	flush_list;
-
-	struct mutex		sysfs_lock;
-	struct mutex		sysfs_dir_lock;
-
-	/*
-	 * for reusing dead hctx instance in case of updating
-	 * nr_hw_queues
-	 */
-	struct list_head	unused_hctx_list;
-	spinlock_t		unused_hctx_lock;
-
-	int			mq_freeze_depth;
-
-#ifdef CONFIG_BLK_DEV_THROTTLING
-	/* Throttle data */
-	struct throtl_data *td;
-#endif
-	struct rcu_head		rcu_head;
-	wait_queue_head_t	mq_freeze_wq;
-	/*
-	 * Protect concurrent access to q_usage_counter by
-	 * percpu_ref_kill() and percpu_ref_reinit().
-	 */
-	struct mutex		mq_freeze_lock;
-
-	struct blk_mq_tag_set	*tag_set;
-	struct list_head	tag_set_list;
-
-	struct dentry		*debugfs_dir;
-	struct dentry		*sched_debugfs_dir;
-	struct dentry		*rqos_debugfs_dir;
-	/*
-	 * Serializes all debugfs metadata operations using the above dentries.
-	 */
-	struct mutex		debugfs_mutex;
-
-	bool			mq_sysfs_init_done;
-};
-
-/* Keep blk_queue_flag_name[] in sync with the definitions below */
-#define QUEUE_FLAG_STOPPED	0	/* queue is stopped */
-#define QUEUE_FLAG_DYING	1	/* queue being torn down */
-#define QUEUE_FLAG_NOMERGES     3	/* disable merge attempts */
-#define QUEUE_FLAG_SAME_COMP	4	/* complete on same CPU-group */
-#define QUEUE_FLAG_FAIL_IO	5	/* fake timeout */
-#define QUEUE_FLAG_NONROT	6	/* non-rotational device (SSD) */
-#define QUEUE_FLAG_VIRT		QUEUE_FLAG_NONROT /* paravirt device */
-#define QUEUE_FLAG_IO_STAT	7	/* do disk/partitions IO accounting */
-#define QUEUE_FLAG_NOXMERGES	9	/* No extended merges */
-#define QUEUE_FLAG_ADD_RANDOM	10	/* Contributes to random pool */
-#define QUEUE_FLAG_SYNCHRONOUS	11	/* always completes in submit context */
-#define QUEUE_FLAG_SAME_FORCE	12	/* force complete on same CPU */
-#define QUEUE_FLAG_HW_WC	13	/* Write back caching supported */
-#define QUEUE_FLAG_INIT_DONE	14	/* queue is initialized */
-#define QUEUE_FLAG_STABLE_WRITES 15	/* don't modify blks until WB is done */
-#define QUEUE_FLAG_POLL		16	/* IO polling enabled if set */
-#define QUEUE_FLAG_WC		17	/* Write back caching */
-#define QUEUE_FLAG_FUA		18	/* device supports FUA writes */
-#define QUEUE_FLAG_DAX		19	/* device supports DAX */
-#define QUEUE_FLAG_STATS	20	/* track IO start and completion times */
-#define QUEUE_FLAG_REGISTERED	22	/* queue has been registered to a disk */
-#define QUEUE_FLAG_QUIESCED	24	/* queue has been quiesced */
-#define QUEUE_FLAG_PCI_P2PDMA	25	/* device supports PCI p2p requests */
-#define QUEUE_FLAG_ZONE_RESETALL 26	/* supports Zone Reset All */
-#define QUEUE_FLAG_RQ_ALLOC_TIME 27	/* record rq->alloc_time_ns */
-#define QUEUE_FLAG_HCTX_ACTIVE	28	/* at least one blk-mq hctx is active */
-#define QUEUE_FLAG_NOWAIT       29	/* device supports NOWAIT */
-#define QUEUE_FLAG_SQ_SCHED     30	/* single queue style io dispatch */
-#define QUEUE_FLAG_SKIP_TAGSET_QUIESCE	31 /* quiesce_tagset skip the queue*/
-
-#define QUEUE_FLAG_MQ_DEFAULT	((1UL << QUEUE_FLAG_IO_STAT) |		\
-				 (1UL << QUEUE_FLAG_SAME_COMP) |	\
-				 (1UL << QUEUE_FLAG_NOWAIT))
-
 void blk_queue_flag_set(unsigned int flag, struct request_queue *q);
 void blk_queue_flag_clear(unsigned int flag, struct request_queue *q);
 bool blk_queue_flag_test_and_set(unsigned int flag, struct request_queue *q);
@@ -921,32 +513,6 @@ extern void blk_put_queue(struct request_queue *);
 void blk_mark_disk_dead(struct gendisk *disk);
 
 #ifdef CONFIG_BLOCK
-/*
- * blk_plug permits building a queue of related requests by holding the I/O
- * fragments for a short period. This allows merging of sequential requests
- * into single larger request. As the requests are moved from a per-task list to
- * the device's request_queue in a batch, this results in improved scalability
- * as the lock contention for request_queue lock is reduced.
- *
- * It is ok not to disable preemption when adding the request to the plug list
- * or when attempting a merge. For details, please see schedule() where
- * blk_flush_plug() is called.
- */
-struct blk_plug {
-	struct request *mq_list; /* blk-mq requests */
-
-	/* if ios_left is > 1, we can batch tag/rq allocations */
-	struct request *cached_rq;
-	u64 cur_ktime;
-	unsigned short nr_ios;
-
-	unsigned short rq_count;
-
-	bool multiple_queues;
-	bool has_elevator;
-
-	struct list_head cb_list; /* md requires an unplug callback */
-};
 
 struct blk_plug_cb;
 typedef void (*blk_plug_cb_fn)(struct blk_plug_cb *, bool);
@@ -983,8 +549,6 @@ static inline void blk_plug_invalidate_ts(struct task_struct *tsk)
 int blkdev_issue_flush(struct block_device *bdev);
 long nr_blockdev_pages(void);
 #else /* CONFIG_BLOCK */
-struct blk_plug {
-};
 
 static inline void blk_start_plug_nr_ios(struct blk_plug *plug,
 					 unsigned short nr_ios)
@@ -1540,12 +1104,6 @@ static inline int early_lookup_bdev(const char *pathname, dev_t *dev)
 int bdev_freeze(struct block_device *bdev);
 int bdev_thaw(struct block_device *bdev);
 
-struct io_comp_batch {
-	struct request *req_list;
-	bool need_ts;
-	void (*complete)(struct io_comp_batch *);
-};
-
 #define DEFINE_IO_COMP_BATCH(name)	struct io_comp_batch name = { }
 
 #endif /* _LINUX_BLKDEV_H */
include/linux/blkdev_types.h new file +463 -0

463 lines not on this page · raw message

include/linux/cdrom.h +1 -1
index 98c6fd0b39b6..d99709e14ecb 100644
@@ -13,7 +13,7 @@
 
 #include <linux/fs.h>		/* not really needed, later.. */
 #include <linux/list.h>
-#include <linux/blkdev.h>
+#include <linux/blkdev_types.h>
 #include <scsi/scsi_common.h>
 #include <uapi/linux/cdrom.h>
 
include/linux/io_uring_types.h +1 -1
index 4fe7af8a4907..8dcf55fe0e09 100644
@@ -1,7 +1,7 @@
 #ifndef IO_URING_TYPES_H
 #define IO_URING_TYPES_H
 
-#include <linux/blkdev.h>
+#include <linux/blkdev_types.h>
 #include <linux/hashtable.h>
 #include <linux/task_work.h>
 #include <linux/bitmap.h>
io_uring/io_uring.c +1 -0
index 4cc333203665..d111784bb406 100644
@@ -47,6 +47,7 @@
 #include <linux/refcount.h>
 #include <linux/uio.h>
 #include <linux/bits.h>
+#include <linux/blkdev.h>
 #include <linux/completion.h>
 
 #include <linux/sched/signal.h>
Signature · 1 line
2.39.2
#23 lore raw

PATCH v5 23/35 sbitmap.h: move declarations to sbitmap_types.h

In reply to Max Kellermann

By providing declarations in a lean header, we can reduce header dependencies.

---
 block/blk-mq.h                |   1 +
 include/linux/blk-mq.h        |   2 +-
 include/linux/sbitmap.h       | 124 +-------------------------------
 include/linux/sbitmap_types.h | 129 ++++++++++++++++++++++++++++++++++
 4 files changed, 132 insertions(+), 124 deletions(-)
 create mode 100644 include/linux/sbitmap_types.h
block/blk-mq.h +1 -0
index f75a9ecfebde..cc8e690171db 100644
@@ -3,6 +3,7 @@
 #define INT_BLK_MQ_H
 
 #include <linux/blk-mq.h>
+#include <linux/sbitmap.h>
 #include "blk-stat.h"
 
 struct blk_mq_tag_set;
include/linux/blk-mq.h +1 -1
index ed3760b04baa..201ee354a3d5 100644
@@ -4,7 +4,7 @@
 
 #include <linux/bio.h>
 #include <linux/blkdev.h>
-#include <linux/sbitmap.h>
+#include <linux/sbitmap_types.h>
 #include <linux/lockdep_types.h>
 #include <linux/scatterlist.h>
 #include <linux/prefetch.h>
include/linux/sbitmap.h +1 -123

143 lines not on this page · raw message

include/linux/sbitmap_types.h new file +129 -0

129 lines not on this page · raw message

Signature · 1 line
2.39.2
#24 lore raw

PATCH v5 24/35 list_lru.h: move declarations to list_lru_types.h

In reply to Max Kellermann

By providing declarations in a lean header, we can reduce header dependencies.

---
 fs/super.c                     |  1 +
 include/linux/fs.h             |  2 +-
 include/linux/list_lru.h       | 36 +----------------------------
 include/linux/list_lru_types.h | 42 ++++++++++++++++++++++++++++++++++
 4 files changed, 45 insertions(+), 36 deletions(-)
 create mode 100644 include/linux/list_lru_types.h
fs/super.c +1 -0
index 2ab97cc49374..6a8cc1c49940 100644
@@ -34,6 +34,7 @@
 #include <linux/rculist_bl.h>
 #include <linux/fscrypt.h>
 #include <linux/fsnotify.h>
+#include <linux/list_lru.h>
 #include <linux/lockdep.h>
 #include <linux/user_namespace.h>
 #include <linux/fs_context.h>
include/linux/fs.h +1 -1
index c5ea7eb41bca..c2e21611496e 100644
@@ -10,7 +10,7 @@
 #include <linux/stat.h>
 #include <linux/cache.h>
 #include <linux/list.h>
-#include <linux/list_lru.h>
+#include <linux/list_lru_types.h>
 #include <linux/llist.h>
 #include <linux/xarray.h>
 #include <linux/rbtree.h>
include/linux/list_lru.h +1 -35
index 5e8cd106dae4..bb348492037f 100644
@@ -8,14 +8,10 @@
 #ifndef _LRU_LIST_H
 #define _LRU_LIST_H
 
-#include <linux/list.h>
+#include <linux/list_lru_types.h>
 #include <linux/nodemask.h>
 #include <linux/shrinker.h>
 
-#ifdef CONFIG_MEMCG_KMEM
-#include <linux/xarray_types.h>
-#endif
-
 struct mem_cgroup;
 
 /* list_lru_walk_cb has to always return one of those */
@@ -31,36 +27,6 @@ enum lru_status {
 				   internally, but has to return locked. */
 };
 
-struct list_lru_one {
-	struct list_head	list;
-	/* may become negative during memcg reparenting */
-	long			nr_items;
-};
-
-struct list_lru_memcg {
-	struct rcu_head		rcu;
-	/* array of per cgroup per node lists, indexed by node id */
-	struct list_lru_one	node[];
-};
-
-struct list_lru_node {
-	/* protects all lists on the node, including per cgroup */
-	spinlock_t		lock;
-	/* global list, used for the root cgroup in cgroup aware lrus */
-	struct list_lru_one	lru;
-	long			nr_items;
-} ____cacheline_aligned_in_smp;
-
-struct list_lru {
-	struct list_lru_node	*node;
-#ifdef CONFIG_MEMCG_KMEM
-	struct list_head	list;
-	int			shrinker_id;
-	bool			memcg_aware;
-	struct xarray		xa;
-#endif
-};
-
 void list_lru_destroy(struct list_lru *lru);
 int __list_lru_init(struct list_lru *lru, bool memcg_aware,
 		    struct lock_class_key *key, struct shrinker *shrinker);
include/linux/list_lru_types.h new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
2.39.2
#25 lore raw

PATCH v5 25/35 list_bl.h: move declarations to list_bl_types.h

In reply to Max Kellermann

By providing declarations in a lean header, we can reduce header dependencies.

---
 include/linux/list_bl.h       | 19 +-----------------
 include/linux/list_bl_types.h | 36 +++++++++++++++++++++++++++++++++++
 include/linux/mbcache.h       |  2 +-
 3 files changed, 38 insertions(+), 19 deletions(-)
 create mode 100644 include/linux/list_bl_types.h
include/linux/list_bl.h +1 -18
index ae1b541446c9..39c14b6bad71 100644
@@ -2,7 +2,7 @@
 #ifndef _LINUX_LIST_BL_H
 #define _LINUX_LIST_BL_H
 
-#include <linux/list.h>
+#include <linux/list_bl_types.h>
 #include <linux/bit_spinlock.h>
 
 /*
@@ -30,23 +30,6 @@
 #define LIST_BL_BUG_ON(x)
 #endif
 
-
-struct hlist_bl_head {
-	struct hlist_bl_node *first;
-};
-
-struct hlist_bl_node {
-	struct hlist_bl_node *next, **pprev;
-};
-#define INIT_HLIST_BL_HEAD(ptr) \
-	((ptr)->first = NULL)
-
-static inline void INIT_HLIST_BL_NODE(struct hlist_bl_node *h)
-{
-	h->next = NULL;
-	h->pprev = NULL;
-}
-
 #define hlist_bl_entry(ptr, type, member) container_of(ptr,type,member)
 
 static inline bool  hlist_bl_unhashed(const struct hlist_bl_node *h)
include/linux/list_bl_types.h new file +36 -0
new file mode 100644
index 000000000000..84229bb7bd02
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_LIST_BL_TYPES_H
+#define _LINUX_LIST_BL_TYPES_H
+
+#include <linux/list.h>
+
+/*
+ * Special version of lists, where head of the list has a lock in the lowest
+ * bit. This is useful for scalable hash tables without increasing memory
+ * footprint overhead.
+ *
+ * For modification operations, the 0 bit of hlist_bl_head->first
+ * pointer must be set.
+ *
+ * With some small modifications, this can easily be adapted to store several
+ * arbitrary bits (not just a single lock bit), if the need arises to store
+ * some fast and compact auxiliary data.
+ */
+
+struct hlist_bl_head {
+	struct hlist_bl_node *first;
+};
+
+struct hlist_bl_node {
+	struct hlist_bl_node *next, **pprev;
+};
+#define INIT_HLIST_BL_HEAD(ptr) \
+	((ptr)->first = NULL)
+
+static inline void INIT_HLIST_BL_NODE(struct hlist_bl_node *h)
+{
+	h->next = NULL;
+	h->pprev = NULL;
+}
+
+#endif
include/linux/mbcache.h +1 -1
index 97e64184767d..32ebbb428053 100644
@@ -3,7 +3,7 @@
 #define _LINUX_MBCACHE_H
 
 #include <linux/hash.h>
-#include <linux/list_bl.h>
+#include <linux/list_bl_types.h>
 #include <linux/list.h>
 #include <linux/atomic.h>
 #include <linux/fs.h>
Signature · 1 line
2.39.2
#26 lore raw

PATCH v5 26/35 percpu-rwsem.h: move declarations to percpu-rwsem_types.h

In reply to Max Kellermann

By providing declarations in a lean header, we can reduce header dependencies.

---
 include/linux/cgroup-defs.h        |  2 +-
 include/linux/percpu-rwsem.h       | 15 +--------------
 include/linux/percpu-rwsem_types.h | 24 ++++++++++++++++++++++++
 3 files changed, 26 insertions(+), 15 deletions(-)
 create mode 100644 include/linux/percpu-rwsem_types.h
include/linux/cgroup-defs.h +1 -1
index 878deefba0e1..691c50aeafae 100644
@@ -16,7 +16,7 @@
 #include <linux/rcupdate.h>
 #include <linux/refcount_types.h>
 #include <linux/percpu-refcount_types.h>
-#include <linux/percpu-rwsem.h>
+#include <linux/percpu-rwsem_types.h>
 #include <linux/u64_stats_sync.h>
 #include <linux/workqueue.h>
 #include <linux/bpf-cgroup-defs.h>
include/linux/percpu-rwsem.h +1 -14
index 36b942b67b7d..0f427bd5217a 100644
@@ -2,24 +2,11 @@
 #ifndef _LINUX_PERCPU_RWSEM_H
 #define _LINUX_PERCPU_RWSEM_H
 
+#include <linux/percpu-rwsem_types.h>
 #include <linux/atomic.h>
 #include <linux/percpu.h>
-#include <linux/rcuwait.h>
-#include <linux/wait.h>
-#include <linux/rcu_sync.h>
 #include <linux/lockdep.h>
 
-struct percpu_rw_semaphore {
-	struct rcu_sync		rss;
-	unsigned int __percpu	*read_count;
-	struct rcuwait		writer;
-	wait_queue_head_t	waiters;
-	atomic_t		block;
-#ifdef CONFIG_DEBUG_LOCK_ALLOC
-	struct lockdep_map	dep_map;
-#endif
-};
-
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 #define __PERCPU_RWSEM_DEP_MAP_INIT(lockname)	.dep_map = { .name = #lockname },
 #else
include/linux/percpu-rwsem_types.h new file +24 -0
new file mode 100644
index 000000000000..0716d08b758b
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_PERCPU_RWSEM_TYPES_H
+#define _LINUX_PERCPU_RWSEM_TYPES_H
+
+#include <linux/rcu_sync.h>
+#include <linux/rcuwait.h>
+#include <linux/types.h>
+#include <linux/wait_types.h>
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+#include <linux/lockdep_types.h>
+#endif
+
+struct percpu_rw_semaphore {
+	struct rcu_sync		rss;
+	unsigned int __percpu	*read_count;
+	struct rcuwait		writer;
+	wait_queue_head_t	waiters;
+	atomic_t		block;
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+	struct lockdep_map	dep_map;
+#endif
+};
+
+#endif
Signature · 1 line
2.39.2
#27 lore raw

PATCH v5 27/35 quota.h: move declarations to quota_types.h

In reply to Max Kellermann

By providing declarations in a lean header, we can reduce header dependencies.

---
 fs/gfs2/incore.h            |  1 +
 fs/xfs/xfs_qm.h             |  1 +
 fs/xfs/xfs_qm_syscalls.c    |  2 ++
 fs/xfs/xfs_quotaops.c       |  1 +
 fs/xfs/xfs_super.c          |  1 +
 fs/xfs/xfs_trans_dquot.c    |  2 ++
 include/linux/fs.h          |  2 +-
 include/linux/quota.h       | 33 +-----------------
 include/linux/quota_types.h | 68 +++++++++++++++++++++++++++++++++++++
 9 files changed, 78 insertions(+), 33 deletions(-)
 create mode 100644 include/linux/quota_types.h
fs/gfs2/incore.h +1 -0
index 95a334d64da2..94f945dc4bdb 100644
@@ -18,6 +18,7 @@
 #include <linux/rbtree.h>
 #include <linux/ktime.h>
 #include <linux/percpu.h>
+#include <linux/quota.h>
 #include <linux/lockref.h>
 #include <linux/rhashtable.h>
 #include <linux/mutex.h>
fs/xfs/xfs_qm.h +1 -0
index d5c9fc4ba591..bb111cbc3567 100644
@@ -9,6 +9,7 @@
 #include "xfs_dquot_item.h"
 #include "xfs_dquot.h"
 
+struct qc_dqblk;
 struct xfs_inode;
 
 extern struct kmem_cache	*xfs_dqtrx_cache;
fs/xfs/xfs_qm_syscalls.c +2 -0
index 392cb39cc10c..1de4443bed40 100644
@@ -19,6 +19,8 @@
 #include "xfs_qm.h"
 #include "xfs_icache.h"
 
+#include <linux/quota.h>
+
 int
 xfs_qm_scall_quotaoff(
 	xfs_mount_t		*mp,
fs/xfs/xfs_quotaops.c +1 -0
index 9c162e69976b..eda56d032734 100644
@@ -15,6 +15,7 @@
 #include "xfs_icache.h"
 #include "xfs_qm.h"
 
+#include <linux/quota.h>
 
 static void
 xfs_qm_fill_state(
fs/xfs/xfs_super.c +1 -0
index 5013d71143c2..615ba5b1bd1c 100644
@@ -49,6 +49,7 @@
 #include <linux/magic.h>
 #include <linux/fs_context.h>
 #include <linux/fs_parser.h>
+#include <linux/quota.h>
 
 static const struct super_operations xfs_super_operations;
 
fs/xfs/xfs_trans_dquot.c +2 -0
index aa00cf67ad72..94214f0baa2b 100644
@@ -18,6 +18,8 @@
 #include "xfs_trace.h"
 #include "xfs_error.h"
 
+#include <linux/quota.h>
+
 STATIC void	xfs_trans_alloc_dqinfo(xfs_trans_t *);
 
 /*
include/linux/fs.h +1 -1
index c2e21611496e..82fcfc08c650 100644
@@ -260,7 +260,7 @@ struct iattr {
 /*
  * Includes for diskquotas.
  */
-#include <linux/quota.h>
+#include <linux/quota_types.h>
 
 /*
  * Maximum number of layers of fs stack.  Needs to be limited to
include/linux/quota.h +1 -32
index 956281c84850..2a3040e61072 100644
@@ -32,9 +32,8 @@
 #ifndef _LINUX_QUOTA_
 #define _LINUX_QUOTA_
 
-#include <linux/list.h>
+#include <linux/quota_types.h>
 #include <linux/mutex_types.h>
-#include <linux/rwsem_types.h>
 #include <linux/spinlock_types.h>
 #include <linux/percpu_counter.h>
 
@@ -45,7 +44,6 @@
 #include <linux/atomic.h>
 #include <linux/uidgid_types.h>
 #include <linux/projid.h>
-#include <uapi/linux/quota.h>
 
 #undef USRQUOTA
 #undef GRPQUOTA
@@ -61,9 +59,6 @@ enum quota_type {
 #define QTYPE_MASK_GRP (1 << GRPQUOTA)
 #define QTYPE_MASK_PRJ (1 << PRJQUOTA)
 
-typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
-typedef long long qsize_t;	/* Type in which we store sizes */
-
 struct kqid {			/* Type in which we store the quota identifier */
 	union {
 		kuid_t uid;
@@ -213,24 +208,6 @@ struct mem_dqblk {
 	time64_t dqb_itime;	/* time limit for excessive inode use */
 };
 
-/*
- * Data for one quotafile kept in memory
- */
-struct quota_format_type;
-
-struct mem_dqinfo {
-	struct quota_format_type *dqi_format;
-	int dqi_fmt_id;		/* Id of the dqi_format - used when turning
-				 * quotas on after remount RW */
-	struct list_head dqi_dirty_list;	/* List of dirty dquots [dq_list_lock] */
-	unsigned long dqi_flags;	/* DFQ_ flags [dq_data_lock] */
-	unsigned int dqi_bgrace;	/* Space grace time [dq_data_lock] */
-	unsigned int dqi_igrace;	/* Inode grace time [dq_data_lock] */
-	qsize_t dqi_max_spc_limit;	/* Maximum space limit [static] */
-	qsize_t dqi_max_ino_limit;	/* Maximum inode limit [static] */
-	void *dqi_priv;
-};
-
 struct super_block;
 
 /* Mask for flags passed to userspace */
@@ -517,14 +494,6 @@ static inline void quota_send_warning(struct kqid qid, dev_t dev,
 }
 #endif /* CONFIG_QUOTA_NETLINK_INTERFACE */
 
-struct quota_info {
-	unsigned int flags;			/* Flags for diskquotas on this device */
-	struct rw_semaphore dqio_sem;		/* Lock quota file while I/O in progress */
-	struct inode *files[MAXQUOTAS];		/* inodes of quotafiles */
-	struct mem_dqinfo info[MAXQUOTAS];	/* Information for each quota type */
-	const struct quota_format_ops *ops[MAXQUOTAS];	/* Operations for each type */
-};
-
 int register_quota_format(struct quota_format_type *fmt);
 void unregister_quota_format(struct quota_format_type *fmt);
 
include/linux/quota_types.h new file +68 -0

68 lines not on this page · raw message

Signature · 1 line
2.39.2
#28 lore raw

PATCH v5 28/35 radix-tree.h: move declarations to radix-tree_types.h

In reply to Max Kellermann

By providing declarations in a lean header, we can reduce header dependencies.

---
 drivers/usb/cdns3/cdnsp-mem.c    |  1 +
 include/linux/backing-dev-defs.h |  2 +-
 include/linux/iocontext.h        |  2 +-
 include/linux/irqdomain.h        |  2 +-
 include/linux/mlx4/device.h      |  2 +-
 include/linux/radix-tree.h       | 44 +---------------------------
 include/linux/radix-tree_types.h | 50 ++++++++++++++++++++++++++++++++
 kernel/dma/debug.c               |  1 +
 kernel/irq/irqdomain.c           |  1 +
 9 files changed, 58 insertions(+), 47 deletions(-)
 create mode 100644 include/linux/radix-tree_types.h
drivers/usb/cdns3/cdnsp-mem.c +1 -0
index 97866bfb2da9..bab13f8a0b62 100644
@@ -12,6 +12,7 @@
 
 #include <linux/dma-mapping.h>
 #include <linux/dmapool.h>
+#include <linux/radix-tree.h>
 #include <linux/slab.h>
 #include <linux/usb.h>
 
include/linux/backing-dev-defs.h +1 -1
index 068fc9f3e883..459ad296f822 100644
@@ -3,7 +3,7 @@
 #define __LINUX_BACKING_DEV_DEFS_H
 
 #include <linux/list.h>
-#include <linux/radix-tree.h>
+#include <linux/radix-tree_types.h>
 #include <linux/rbtree_types.h>
 #include <linux/spinlock_types.h>
 #include <linux/percpu_counter_types.h>
include/linux/iocontext.h +1 -1
index a05d8a45cce5..aa1409bd9edd 100644
@@ -2,7 +2,7 @@
 #ifndef IOCONTEXT_H
 #define IOCONTEXT_H
 
-#include <linux/radix-tree.h>
+#include <linux/radix-tree_types.h>
 #include <linux/rcupdate.h>
 #include <linux/workqueue_types.h>
 
include/linux/irqdomain.h +1 -1
index 0503bd4ea55b..c439d47b37a9 100644
@@ -35,7 +35,7 @@
 #include <linux/irqhandler.h>
 #include <linux/of.h>
 #include <linux/mutex_types.h>
-#include <linux/radix-tree.h>
+#include <linux/radix-tree_types.h>
 
 struct device_node;
 struct fwnode_handle;
include/linux/mlx4/device.h +1 -1
index 18d71b808bc2..e354c967a21d 100644
@@ -37,7 +37,7 @@
 #include <linux/if_ether.h>
 #include <linux/pci.h>
 #include <linux/completion_types.h>
-#include <linux/radix-tree.h>
+#include <linux/radix-tree_types.h>
 #include <linux/cpu_rmap.h>
 #include <linux/crash_dump.h>
 
include/linux/radix-tree.h +1 -43

62 lines not on this page · raw message

include/linux/radix-tree_types.h new file +50 -0

50 lines not on this page · raw message

kernel/dma/debug.c +1 -0
index e7e236599307..1e892a5b0d93 100644
@@ -20,6 +20,7 @@
 #include <linux/uaccess.h>
 #include <linux/export.h>
 #include <linux/device.h>
+#include <linux/radix-tree.h>
 #include <linux/types.h>
 #include <linux/sched.h>
 #include <linux/ctype.h>
kernel/irq/irqdomain.c +1 -0
index d3431093c40d..d3313b7a22c8 100644
@@ -14,6 +14,7 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
+#include <linux/radix-tree.h>
 #include <linux/sprintf.h>
 #include <linux/topology.h>
 #include <linux/seq_file.h>
Signature · 1 line
2.39.2
#29 lore raw

PATCH v5 29/35 linux/random.h: reduce dependencies on linux/kernel.h

In reply to Max Kellermann
---
 include/linux/random.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/random.h +2 -1
index 70e5250f3bc4..3183025ddda9 100644
@@ -4,7 +4,8 @@
 #define _LINUX_RANDOM_H
 
 #include <linux/bug.h>
-#include <linux/kernel.h>
+#include <linux/limits.h> // for U32_MAX
+#include <linux/log2.h> // for is_power_of_2()
 
 #include <uapi/linux/random.h>
 
Signature · 1 line
2.39.2
#30 lore raw

PATCH v5 30/35 linux/kernel.h: move might_sleep(), ... to sched/debug_atomic_sleep.h

In reply to Max Kellermann

Reducing dependencies on the header linux/kernel.h.

---
 include/linux/clk.h                      |   1 +
 include/linux/gpio/consumer.h            |   2 +-
 include/linux/kernel.h                   | 109 ----------------------
 include/linux/mmu_notifier.h             |   1 +
 include/linux/pwm.h                      |   2 +
 include/linux/rcutiny.h                  |   1 +
 include/linux/sched.h                    |   1 +
 include/linux/sched/debug_atomic_sleep.h | 114 +++++++++++++++++++++++
 include/linux/sched/mm.h                 |   2 +-
 include/linux/uaccess.h                  |   1 +
 include/linux/wait.h                     |   1 +
 include/linux/wait_bit.h                 |   2 +-
 security/landlock/object.c               |   1 +
 security/landlock/ruleset.c              |   1 +
 14 files changed, 127 insertions(+), 112 deletions(-)
 create mode 100644 include/linux/sched/debug_atomic_sleep.h
include/linux/clk.h +1 -0
index 06f1b292f8a0..2fcae620703b 100644
@@ -12,6 +12,7 @@
 #include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/notifier.h>
+#include <linux/sched/debug_atomic_sleep.h> // for might_sleep()
 
 struct device;
 struct clk;
include/linux/gpio/consumer.h +1 -1
index db2dfbae8edb..a02927330429 100644
@@ -184,7 +184,7 @@ struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev,
 #else /* CONFIG_GPIOLIB */
 
 #include <linux/err.h>
-#include <linux/kernel.h>
+#include <linux/sched/debug_atomic_sleep.h> // for might_sleep()
 
 #include <asm/bug.h>
 
include/linux/kernel.h +0 -109

115 lines not on this page · raw message

include/linux/mmu_notifier.h +1 -0
index 6aa17677254b..d13d1210e7a0 100644
@@ -5,6 +5,7 @@
 #include <linux/list.h>
 #include <linux/mm_types.h>
 #include <linux/mmap_lock.h>
+#include <linux/sched/debug_atomic_sleep.h> // for might_sleep()
 #include <linux/srcu.h>
 #include <linux/interval_tree.h>
 
include/linux/pwm.h +2 -0
index 4eef97d74366..8c3165ebec5e 100644
@@ -403,6 +403,8 @@ struct pwm_device *devm_fwnode_pwm_get(struct device *dev,
 				       struct fwnode_handle *fwnode,
 				       const char *con_id);
 #else
+#include <linux/sched/debug_atomic_sleep.h> // for might_sleep()
+
 static inline bool pwm_might_sleep(struct pwm_device *pwm)
 {
 	return true;
include/linux/rcutiny.h +1 -0
index d9ac7b136aea..e7b6acfbf054 100644
@@ -12,6 +12,7 @@
 #ifndef __LINUX_TINY_H
 #define __LINUX_TINY_H
 
+#include <linux/sched/debug_atomic_sleep.h> // for might_sleep()
 #include <asm/param.h> /* for HZ */
 
 struct rcu_gp_oldstate {
include/linux/sched.h +1 -0
index 42555e8e5aa7..796c32c124c5 100644
@@ -32,6 +32,7 @@
 #include <linux/resource.h>
 #include <linux/latencytop.h>
 #include <linux/log2.h>
+#include <linux/sched/debug_atomic_sleep.h> // for __might_resched()
 #include <linux/sched/prio.h>
 #include <linux/sched/types.h>
 #include <linux/signal_types.h>
include/linux/sched/debug_atomic_sleep.h new file +114 -0

114 lines not on this page · raw message

include/linux/sched/mm.h +1 -1
index c29059a76052..1a6286496495 100644
@@ -2,9 +2,9 @@
 #ifndef _LINUX_SCHED_MM_H
 #define _LINUX_SCHED_MM_H
 
-#include <linux/kernel.h>
 #include <linux/atomic.h>
 #include <linux/sched.h>
+#include <linux/sched/debug_atomic_sleep.h> // for might_sleep_if()
 #include <linux/mm_types.h>
 #include <linux/gfp.h>
 #include <linux/sync_core.h>
include/linux/uaccess.h +1 -0
index 3064314f4832..8ea27d05f17e 100644
@@ -6,6 +6,7 @@
 #include <linux/instrumented.h>
 #include <linux/minmax.h>
 #include <linux/sched.h>
+#include <linux/sched/debug_atomic_sleep.h> // for might_faul()
 #include <linux/thread_info.h>
 
 #include <asm/uaccess.h>
include/linux/wait.h +1 -0
index b36000bb012c..deb1204ed222 100644
@@ -5,6 +5,7 @@
  * Linux wait queue related types and methods
  */
 #include <linux/wait_types.h>
+#include <linux/sched/debug_atomic_sleep.h> // for might_sleep()
 #include <linux/stddef.h>
 #include <linux/spinlock.h>
 
include/linux/wait_bit.h +1 -1
index 514f68eff79d..9cc8fcba24c5 100644
@@ -7,7 +7,7 @@
  */
 #include <linux/bitops.h>
 #include <linux/init.h> // for __init
-#include <linux/kernel.h> // for might_sleep()
+#include <linux/sched/debug_atomic_sleep.h> // for might_sleep()
 #include <linux/wait_types.h>
 
 struct wait_bit_key {
security/landlock/object.c +1 -0
index 1f50612f0185..feb2dec3d89a 100644
@@ -12,6 +12,7 @@
 #include <linux/kernel.h>
 #include <linux/rcupdate.h>
 #include <linux/refcount.h>
+#include <linux/sched/debug_atomic_sleep.h> // for might_sleep()
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 
security/landlock/ruleset.c +1 -0
index e0a5fbf9201a..36396959a0e9 100644
@@ -16,6 +16,7 @@
 #include <linux/overflow.h>
 #include <linux/rbtree.h>
 #include <linux/refcount.h>
+#include <linux/sched/debug_atomic_sleep.h> // for might_sleep_if()
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/workqueue.h>
Signature · 1 line
2.39.2
#31 lore raw

PATCH v5 31/35 linux/kernel.h: move READ and WRITE to direction.h

In reply to Max Kellermann

Reducing dependencies on the header linux/kernel.h.

---
 drivers/memstick/core/memstick.c    | 1 +
 drivers/memstick/host/jmb38x_ms.c   | 1 +
 drivers/memstick/host/r592.c        | 1 +
 drivers/memstick/host/rtsx_pci_ms.c | 1 +
 drivers/memstick/host/rtsx_usb_ms.c | 1 +
 drivers/memstick/host/tifm_ms.c     | 1 +
 fs/overlayfs/copy_up.c              | 1 +
 include/linux/direction.h           | 9 +++++++++
 include/linux/kernel.h              | 4 ----
 include/linux/nd.h                  | 1 +
 include/linux/uio.h                 | 2 +-
 11 files changed, 18 insertions(+), 5 deletions(-)
 create mode 100644 include/linux/direction.h
drivers/memstick/core/memstick.c +1 -0
index 7afc0132f512..e48ca1bdea66 100644
@@ -12,6 +12,7 @@
 #include <linux/idr.h>
 #include <linux/fs.h>
 #include <linux/delay.h>
+#include <linux/direction.h>
 #include <linux/slab.h>
 #include <linux/kobject.h>
 #include <linux/module.h>
drivers/memstick/host/jmb38x_ms.c +1 -0
index 594f55b8cd11..0621121edb95 100644
@@ -6,6 +6,7 @@
  */
 
 #include <linux/spinlock.h>
+#include <linux/direction.h>
 #include <linux/interrupt.h>
 #include <linux/pci.h>
 #include <linux/dma-mapping.h>
drivers/memstick/host/r592.c +1 -0
index b941c8d02f7c..76a480de78d2 100644
@@ -12,6 +12,7 @@
 #include <linux/pci.h>
 #include <linux/pci_ids.h>
 #include <linux/delay.h>
+#include <linux/direction.h>
 #include <linux/slab.h>
 #include <linux/kthread.h>
 #include <linux/sched.h>
drivers/memstick/host/rtsx_pci_ms.c +1 -0
index 15720a4afac2..4bd00d69a9b6 100644
@@ -10,6 +10,7 @@
 #include <linux/module.h>
 #include <linux/highmem.h>
 #include <linux/delay.h>
+#include <linux/direction.h>
 #include <linux/platform_device.h>
 #include <linux/memstick.h>
 #include <linux/rtsx_pci.h>
drivers/memstick/host/rtsx_usb_ms.c +1 -0
index 29271ad4728a..eeebdde571e6 100644
@@ -10,6 +10,7 @@
 #include <linux/module.h>
 #include <linux/highmem.h>
 #include <linux/delay.h>
+#include <linux/direction.h>
 #include <linux/platform_device.h>
 #include <linux/workqueue.h>
 #include <linux/memstick.h>
drivers/memstick/host/tifm_ms.c +1 -0
index c272453670be..c46b6157aa25 100644
@@ -10,6 +10,7 @@
 
 #include <linux/tifm.h>
 #include <linux/memstick.h>
+#include <linux/direction.h>
 #include <linux/highmem.h>
 #include <linux/scatterlist.h>
 #include <linux/log2.h>
fs/overlayfs/copy_up.c +1 -0
index 6a861535ed38..7431a4b20081 100644
@@ -16,6 +16,7 @@
 #include <linux/uaccess.h>
 #include <linux/sched/signal.h>
 #include <linux/cred.h>
+#include <linux/direction.h>
 #include <linux/namei.h>
 #include <linux/fdtable.h>
 #include <linux/ratelimit.h>
include/linux/direction.h new file +9 -0
new file mode 100644
index 000000000000..78d70701579d
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_DIRECTION_H
+#define _LINUX_DIRECTION_H
+
+/* generic data direction definitions */
+#define READ			0
+#define WRITE			1
+
+#endif
include/linux/kernel.h +0 -4
index 67662bdb17d0..5d088ce30045 100644
@@ -39,10 +39,6 @@
 
 #define STACK_MAGIC	0xdeadbeef
 
-/* generic data direction definitions */
-#define READ			0
-#define WRITE			1
-
 #define PTR_IF(cond, ptr)	((cond) ? (ptr) : NULL)
 
 #define u64_to_user_ptr(x) (		\
include/linux/nd.h +1 -0
index b9771ba1ef87..eb8e037d92c8 100644
@@ -7,6 +7,7 @@
 #include <linux/fs.h>
 #include <linux/ndctl.h>
 #include <linux/device.h>
+#include <linux/direction.h> // for READ, WRITE
 #include <linux/badblocks.h>
 #include <linux/perf_event.h>
 
include/linux/uio.h +1 -1
index bea9c89922d9..306b0fffe2a4 100644
@@ -5,7 +5,7 @@
 #ifndef __LINUX_UIO_H
 #define __LINUX_UIO_H
 
-#include <linux/kernel.h>
+#include <linux/direction.h> // for READ, WRITE
 #include <linux/thread_info.h>
 #include <linux/mm_types.h>
 #include <uapi/linux/uio.h>
Signature · 1 line
2.39.2
#32 lore raw

PATCH v5 32/35 linux/kernel.h: move VERIFY_OCTAL_PERMISSIONS() to octal_permissions.h

In reply to Max Kellermann

Reducing dependencies on the header linux/kernel.h.

---
 arch/arc/kernel/perf_event.c             |  1 +
 drivers/edac/thunderx_edac.c             |  1 +
 drivers/hwmon/occ/common.c               |  1 +
 drivers/media/platform/amphion/vpu_dbg.c |  1 +
 drivers/soc/aspeed/aspeed-uart-routing.c |  1 +
 fs/xfs/xfs_error.c                       |  1 +
 include/linux/kernel.h                   | 13 -------------
 include/linux/moduleparam.h              |  2 +-
 include/linux/octal_permissions.h        | 20 ++++++++++++++++++++
 include/linux/sysfs.h                    |  2 +-
 10 files changed, 28 insertions(+), 15 deletions(-)
 create mode 100644 include/linux/octal_permissions.h
arch/arc/kernel/perf_event.c +1 -0
index 9d43a9988812..dbc24c9351d1 100644
@@ -9,6 +9,7 @@
 #include <linux/interrupt.h>
 #include <linux/kernel.h> // for upper_32_bits(), lower_32_bits()
 #include <linux/module.h>
+#include <linux/octal_permissions.h>
 #include <linux/of.h>
 #include <linux/perf_event.h>
 #include <linux/platform_device.h>
drivers/edac/thunderx_edac.c +1 -0
index e99ce19e6574..c610d99dceda 100644
@@ -21,6 +21,7 @@
 #include <linux/atomic.h>
 #include <linux/bitfield.h>
 #include <linux/circ_buf.h>
+#include <linux/octal_permissions.h>
 
 #include <asm/page.h>
 
drivers/hwmon/occ/common.c +1 -0
index f7b89b880339..1a4f1a90c2c5 100644
@@ -11,6 +11,7 @@
 #include <linux/math64.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
+#include <linux/octal_permissions.h>
 #include <linux/property.h>
 #include <linux/sprintf.h>
 #include <linux/sysfs.h>
drivers/media/platform/amphion/vpu_dbg.c +1 -0
index bed0ed4fb8a0..ef5658b492cf 100644
@@ -9,6 +9,7 @@
 #include <linux/list.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
+#include <linux/octal_permissions.h>
 #include <linux/sprintf.h>
 #include <linux/types.h>
 #include <linux/pm_runtime.h>
drivers/soc/aspeed/aspeed-uart-routing.c +1 -0
index a2195f062e01..6b091df7775a 100644
@@ -5,6 +5,7 @@
  */
 #include <linux/device.h>
 #include <linux/module.h>
+#include <linux/octal_permissions.h>
 #include <linux/of.h>
 #include <linux/mfd/syscon.h>
 #include <linux/regmap.h>
fs/xfs/xfs_error.c +1 -0
index 8d558f0f1b3b..a225860d272a 100644
@@ -14,6 +14,7 @@
 #include "xfs_error.h"
 #include "xfs_sysfs.h"
 #include "xfs_inode.h"
+#include <linux/octal_permissions.h>
 #include <linux/kstrtox.h>
 #include <linux/sprintf.h>
 #include <linux/sysfs.h>
include/linux/kernel.h +0 -13
index 5d088ce30045..ac332f4deed9 100644
@@ -29,7 +29,6 @@
 #include <linux/typecheck.h>
 #include <linux/panic.h>
 #include <linux/printk.h>
-#include <linux/build_bug.h>
 #include <linux/sprintf.h>
 #include <linux/static_call_types.h>
 #include <linux/instruction_pointer.h>
@@ -308,16 +307,4 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
 # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
 #endif
 
-/* Permissions on a sysfs file: you didn't miss the 0 prefix did you? */
-#define VERIFY_OCTAL_PERMISSIONS(perms)						\
-	(BUILD_BUG_ON_ZERO((perms) < 0) +					\
-	 BUILD_BUG_ON_ZERO((perms) > 0777) +					\
-	 /* USER_READABLE >= GROUP_READABLE >= OTHER_READABLE */		\
-	 BUILD_BUG_ON_ZERO((((perms) >> 6) & 4) < (((perms) >> 3) & 4)) +	\
-	 BUILD_BUG_ON_ZERO((((perms) >> 3) & 4) < ((perms) & 4)) +		\
-	 /* USER_WRITABLE >= GROUP_WRITABLE */					\
-	 BUILD_BUG_ON_ZERO((((perms) >> 6) & 2) < (((perms) >> 3) & 2)) +	\
-	 /* OTHER_WRITABLE?  Generally considered a bad idea. */		\
-	 BUILD_BUG_ON_ZERO((perms) & 2) +					\
-	 (perms))
 #endif
include/linux/moduleparam.h +1 -1
index a285e74ec028..860b0ea1f3b3 100644
@@ -4,7 +4,7 @@
 /* (C) Copyright 2001, 2002 Rusty Russell IBM Corporation */
 #include <linux/init.h>
 #include <linux/stringify.h>
-#include <linux/kernel.h> // for VERIFY_OCTAL_PERMISSIONS()
+#include <linux/octal_permissions.h>
 
 /* You can override this manually, but generally this should match the
    module name. */
include/linux/octal_permissions.h new file +20 -0
new file mode 100644
index 000000000000..57d4d6a5b66d
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_OCTAL_PERMISSIONS_H
+#define _LINUX_OCTAL_PERMISSIONS_H
+
+#include <linux/build_bug.h>
+
+/* Permissions on a sysfs file: you didn't miss the 0 prefix did you? */
+#define VERIFY_OCTAL_PERMISSIONS(perms)						\
+	(BUILD_BUG_ON_ZERO((perms) < 0) +					\
+	 BUILD_BUG_ON_ZERO((perms) > 0777) +					\
+	 /* USER_READABLE >= GROUP_READABLE >= OTHER_READABLE */		\
+	 BUILD_BUG_ON_ZERO((((perms) >> 6) & 4) < (((perms) >> 3) & 4)) +	\
+	 BUILD_BUG_ON_ZERO((((perms) >> 3) & 4) < ((perms) & 4)) +		\
+	 /* USER_WRITABLE >= GROUP_WRITABLE */					\
+	 BUILD_BUG_ON_ZERO((((perms) >> 6) & 2) < (((perms) >> 3) & 2)) +	\
+	 /* OTHER_WRITABLE?  Generally considered a bad idea. */		\
+	 BUILD_BUG_ON_ZERO((perms) & 2) +					\
+	 (perms))
+
+#endif
include/linux/sysfs.h +1 -1
index 0500b023b5cc..a4b752b24329 100644
@@ -15,10 +15,10 @@
 
 #include <linux/sysfs_types.h>
 #include <linux/kernfs.h>
-#include <linux/kernel.h> // for VERIFY_OCTAL_PERMISSIONS()
 #include <linux/compiler.h>
 #include <linux/list.h>
 #include <linux/lockdep_types.h>
+#include <linux/octal_permissions.h>
 
 struct kobject;
 struct module;
Signature · 1 line
2.39.2
#33 lore raw

PATCH v5 33/35 linux/kernel.h: move upper/lower_*_bits macros to wordpart.h

In reply to Max Kellermann

Reducing dependencies on the header linux/kernel.h.

---
 arch/arm64/include/asm/syscall.h  |  2 +-
 arch/arm64/kvm/handle_exit.c      |  2 +-
 drivers/bus/uniphier-system-bus.c |  2 +-
 drivers/irqchip/irq-gic-v3-its.c  |  1 +
 drivers/spi/spi-pci1xxxx.c        |  1 +
 fs/hfs/hfs_fs.h                   |  2 +-
 fs/hfsplus/hfsplus_fs.h           |  2 +-
 include/drm/drm_fixed.h           |  2 +-
 include/linux/dma-fence.h         |  2 +-
 include/linux/goldfish.h          |  2 +-
 include/linux/kernel.h            | 29 +----------------------------
 include/linux/qed/common_hsi.h    |  1 +
 include/linux/wordpart.h          | 28 ++++++++++++++++++++++++++++
 include/rdma/uverbs_ioctl.h       |  3 ++-
 include/soc/fsl/bman.h            |  2 ++
 include/soc/fsl/qman.h            |  1 +
 16 files changed, 45 insertions(+), 37 deletions(-)
arch/arm64/include/asm/syscall.h +1 -1
index 107ada608694..e5f462cc1a54 100644
@@ -8,7 +8,7 @@
 #include <uapi/linux/audit.h>
 #include <linux/compat.h>
 #include <linux/err.h>
-#include <linux/kernel.h> // for lower_32_bits()
+#include <linux/wordpart.h> // for lower_32_bits()
 
 typedef long (*syscall_fn_t)(const struct pt_regs *regs);
 
arch/arm64/kvm/handle_exit.c +1 -1
index a82b4b31bb36..91bd5b701acf 100644
@@ -10,7 +10,7 @@
 
 #include <linux/kvm.h>
 #include <linux/kvm_host.h>
-#include <linux/kernel.h> // for upper_32_bits(), lower_32_bits()
+#include <linux/wordpart.h> // for lower_32_bits(), upper_32_bits()
 
 #include <asm/esr.h>
 #include <asm/exception.h>
drivers/bus/uniphier-system-bus.c +1 -1
index 8cffdb089a6b..8949a7a5c170 100644
@@ -6,7 +6,7 @@
 #include <linux/io.h>
 #include <linux/kernel.h> // for upper_32_bits(), lower_32_bits()
 #include <linux/log2.h>
-#include <linux/kernel.h> // for upper_32_bits()
+#include <linux/wordpart.h> // for upper_32_bits()
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
drivers/irqchip/irq-gic-v3-its.c +1 -0
index 1be09abac7cc..2b33edb78c26 100644
@@ -30,6 +30,7 @@
 #include <linux/percpu.h>
 #include <linux/slab.h>
 #include <linux/syscore_ops.h>
+#include <linux/wordpart.h> // for lower_32_bits(), upper_32_bits()
 
 #include <linux/irqchip.h>
 #include <linux/irqchip/arm-gic-v3.h>
drivers/spi/spi-pci1xxxx.c +1 -0
index ab99aac85eb9..1ff89d726927 100644
@@ -9,6 +9,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/iopoll.h>
 #include <linux/irq.h>
+#include <linux/kernel.h> // for upper_32_bits(), lower_32_bits()
 #include <linux/module.h>
 #include <linux/msi.h>
 #include <linux/pci_regs.h>
fs/hfs/hfs_fs.h +1 -1
index 71ebbed52f5f..99e54ff4df83 100644
@@ -17,7 +17,7 @@
 
 #include <linux/slab.h>
 #include <linux/types.h>
-#include <linux/kernel.h> // for lower_32_bits()
+#include <linux/wordpart.h> // for lower_32_bits()
 #include <linux/mutex.h>
 #include <linux/buffer_head.h>
 #include <linux/fs.h>
fs/hfsplus/hfsplus_fs.h +1 -1
index 157dad01495f..79cac82d050e 100644
@@ -21,7 +21,7 @@
 #include <linux/mutex.h>
 #include <linux/buffer_head.h>
 #include <linux/blkdev.h>
-#include <linux/kernel.h> // for lower_32_bits()
+#include <linux/wordpart.h> // for lower_32_bits()
 #include "hfsplus_raw.h"
 
 #define DBG_BNODE_REFS	0x00000001
include/drm/drm_fixed.h +1 -1
index 0c9f917a4d4b..ff9a91fa40b6 100644
@@ -25,7 +25,7 @@
 #ifndef DRM_FIXED_H
 #define DRM_FIXED_H
 
-#include <linux/kernel.h>
+#include <linux/wordpart.h> // for lower_32_bits()
 #include <linux/math64.h>
 
 typedef union dfixed {
include/linux/dma-fence.h +1 -1
index 3081ff146d41..308d77098e21 100644
@@ -16,7 +16,7 @@
 #include <linux/err.h>
 #include <linux/list.h>
 #include <linux/bitops.h>
-#include <linux/kernel.h> // for lower_32_bits()
+#include <linux/wordpart.h> // for lower_32_bits()
 #include <linux/kref.h>
 #include <linux/sched.h>
 #include <linux/printk.h>
include/linux/goldfish.h +1 -1
index bcc17f95b906..8b2b3046f779 100644
@@ -2,7 +2,7 @@
 #ifndef __LINUX_GOLDFISH_H
 #define __LINUX_GOLDFISH_H
 
-#include <linux/kernel.h>
+#include <linux/wordpart.h> // for lower_32_bits(), upper_32_bits()
 #include <linux/types.h>
 #include <linux/io.h>
 
include/linux/kernel.h +1 -28
index ac332f4deed9..6f436367dd16 100644
@@ -32,6 +32,7 @@
 #include <linux/sprintf.h>
 #include <linux/static_call_types.h>
 #include <linux/instruction_pointer.h>
+#include <linux/wordpart.h>
 #include <asm/byteorder.h>
 
 #include <uapi/linux/kernel.h>
@@ -47,34 +48,6 @@
 }					\
 )
 
-/**
- * upper_32_bits - return bits 32-63 of a number
- * @n: the number we're accessing
- *
- * A basic shift-right of a 64- or 32-bit quantity.  Use this to suppress
- * the "right shift count >= width of type" warning when that quantity is
- * 32-bits.
- */
-#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
-
-/**
- * lower_32_bits - return bits 0-31 of a number
- * @n: the number we're accessing
- */
-#define lower_32_bits(n) ((u32)((n) & 0xffffffff))
-
-/**
- * upper_16_bits - return bits 16-31 of a number
- * @n: the number we're accessing
- */
-#define upper_16_bits(n) ((u16)((n) >> 16))
-
-/**
- * lower_16_bits - return bits 0-15 of a number
- * @n: the number we're accessing
- */
-#define lower_16_bits(n) ((u16)((n) & 0xffff))
-
 void do_exit(long error_code) __noreturn;
 
 extern int get_option(char **str, int *pint);
include/linux/qed/common_hsi.h +1 -0
index 827624840ee2..11482394d7f3 100644
@@ -11,6 +11,7 @@
 #include <asm/byteorder.h>
 #include <linux/bitops.h>
 #include <linux/slab.h>
+#include <linux/wordpart.h> // for upper_32_bits()
 
 /* dma_addr_t manip */
 #define PTR_LO(x)		((u32)(((uintptr_t)(x)) & 0xffffffff))
include/linux/wordpart.h +28 -0
index c9e6bd773ebd..a73f0c84a03a 100644
@@ -10,4 +10,32 @@
  */
 #define REPEAT_BYTE(x)	((~0ul / 0xff) * (x))
 
+/**
+ * upper_32_bits - return bits 32-63 of a number
+ * @n: the number we're accessing
+ *
+ * A basic shift-right of a 64- or 32-bit quantity.  Use this to suppress
+ * the "right shift count >= width of type" warning when that quantity is
+ * 32-bits.
+ */
+#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
+
+/**
+ * lower_32_bits - return bits 0-31 of a number
+ * @n: the number we're accessing
+ */
+#define lower_32_bits(n) ((u32)((n) & 0xffffffff))
+
+/**
+ * upper_16_bits - return bits 16-31 of a number
+ * @n: the number we're accessing
+ */
+#define upper_16_bits(n) ((u16)((n) >> 16))
+
+/**
+ * lower_16_bits - return bits 0-15 of a number
+ * @n: the number we're accessing
+ */
+#define lower_16_bits(n) ((u16)((n) & 0xffff))
+
 #endif // _LINUX_WORDPART_H
include/rdma/uverbs_ioctl.h +2 -1
index 049f381b16c0..6d7776438ef6 100644
@@ -7,8 +7,9 @@
 #define _UVERBS_IOCTL_
 
 #include <rdma/uverbs_types.h>
-#include <linux/kernel.h> // for u64_to_user_ptr(), upper_32_bits(), lower_32_bits()
+#include <linux/kernel.h> // for u64_to_user_ptr()
 #include <linux/uaccess.h>
+#include <linux/wordpart.h>
 #include <rdma/rdma_user_ioctl.h>
 #include <rdma/ib_user_ioctl_verbs.h>
 #include <rdma/ib_user_ioctl_cmds.h>
include/soc/fsl/bman.h +2 -0
index 173e4049d963..b01d8c0ac204 100644
@@ -31,6 +31,8 @@
 #ifndef __FSL_BMAN_H
 #define __FSL_BMAN_H
 
+#include <linux/wordpart.h> // for upper_32_bits()
+
 /* wrapper for 48-bit buffers */
 struct bm_buffer {
 	union {
include/soc/fsl/qman.h +1 -0
index 0d3d6beb7fdb..c5230a844114 100644
@@ -33,6 +33,7 @@
 
 #include <linux/bitops.h>
 #include <linux/device.h>
+#include <linux/wordpart.h> // for upper_32_bits()
 
 /* Hardware constants */
 #define QM_CHANNEL_SWPORTAL0 0
Signature · 1 line
2.39.2
#34 lore raw

PATCH v5 34/35 linux/kernel.h: move PTR_IF() to ptr_util.h

In reply to Max Kellermann

Reducing dependencies on the header linux/kernel.h.

---
 include/linux/kernel.h   | 3 +--
 include/linux/pm.h       | 2 +-
 include/linux/ptr_util.h | 7 +++++++
 3 files changed, 9 insertions(+), 3 deletions(-)
 create mode 100644 include/linux/ptr_util.h
include/linux/kernel.h +1 -2
index 6f436367dd16..e323fe139cc8 100644
@@ -32,6 +32,7 @@
 #include <linux/sprintf.h>
 #include <linux/static_call_types.h>
 #include <linux/instruction_pointer.h>
+#include <linux/ptr_util.h>
 #include <linux/wordpart.h>
 #include <asm/byteorder.h>
 
@@ -39,8 +40,6 @@
 
 #define STACK_MAGIC	0xdeadbeef
 
-#define PTR_IF(cond, ptr)	((cond) ? (ptr) : NULL)
-
 #define u64_to_user_ptr(x) (		\
 {					\
 	typecheck(u64, (x));		\
include/linux/pm.h +1 -1
index 34cf20dd1ad1..cccf320b67f6 100644
@@ -9,7 +9,7 @@
 #define _LINUX_PM_H
 
 #include <linux/export.h>
-#include <linux/kernel.h> // for PTR_IF()
+#include <linux/ptr_util.h> // for PTR_IF()
 #include <linux/list.h>
 #include <linux/workqueue_types.h>
 #include <linux/spinlock_types.h>
include/linux/ptr_util.h new file +7 -0
new file mode 100644
index 000000000000..7469aff978a9
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_PTR_UTIL_H
+#define _LINUX_PTR_UTIL_H
+
+#define PTR_IF(cond, ptr)	((cond) ? (ptr) : NULL)
+
+#endif /* _LINUX_PTR_UTIL_H  */
Signature · 1 line
2.39.2
#35 lore raw

PATCH v5 35/35 include: remove lots of unnecessary <linux/kernel.h> includes

In reply to Max Kellermann
---
 arch/arm64/include/asm/cpufeature.h      | 1 -
 arch/arm64/include/asm/fixmap.h          | 1 -
 include/acpi/platform/aclinux.h          | 1 -
 include/linux/backing-dev.h              | 1 -
 include/linux/badblocks.h                | 1 -
 include/linux/bcm47xx_nvram.h            | 1 -
 include/linux/bcm47xx_sprom.h            | 1 -
 include/linux/bit_spinlock.h             | 1 -
 include/linux/bootconfig.h               | 1 -
 include/linux/btree.h                    | 1 -
 include/linux/clk.h                      | 1 -
 include/linux/counter.h                  | 1 -
 include/linux/cpu_pm.h                   | 1 -
 include/linux/cpumask.h                  | 1 -
 include/linux/decompress/mm.h            | 1 -
 include/linux/dim.h                      | 1 -
 include/linux/firewire.h                 | 1 -
 include/linux/fs_context.h               | 1 -
 include/linux/gpio.h                     | 2 --
 include/linux/greybus.h                  | 1 -
 include/linux/hashtable.h                | 1 -
 include/linux/highmem.h                  | 1 -
 include/linux/interrupt.h                | 1 -
 include/linux/iova.h                     | 1 -
 include/linux/isa.h                      | 1 -
 include/linux/isdn/capilli.h             | 1 -
 include/linux/kallsyms.h                 | 1 -
 include/linux/kasan.h                    | 1 -
 include/linux/kfifo.h                    | 1 -
 include/linux/libnvdimm.h                | 2 +-
 include/linux/lsm_audit.h                | 1 -
 include/linux/maple_tree.h               | 1 -
 include/linux/memcontrol.h               | 1 -
 include/linux/mfd/davinci_voicecodec.h   | 1 -
 include/linux/mfd/madera/pdata.h         | 1 -
 include/linux/mfd/wm8350/core.h          | 1 -
 include/linux/mlx5/driver.h              | 1 -
 include/linux/mtd/map.h                  | 1 -
 include/linux/namei.h                    | 1 -
 include/linux/net/intel/iidc.h           | 1 -
 include/linux/pci-ecam.h                 | 1 -
 include/linux/peci.h                     | 1 -
 include/linux/profile.h                  | 1 -
 include/linux/qed/qed_chain.h            | 1 -
 include/linux/qed/qed_if.h               | 1 -
 include/linux/qed/qed_ll2_if.h           | 1 -
 include/linux/randomize_kstack.h         | 1 -
 include/linux/regulator/coupler.h        | 1 -
 include/linux/resctrl.h                  | 1 -
 include/linux/rfkill.h                   | 1 -
 include/linux/rmi.h                      | 1 -
 include/linux/sed-opal-key.h             | 2 +-
 include/linux/siphash.h                  | 1 -
 include/linux/skbuff.h                   | 1 -
 include/linux/soc/amlogic/meson-canvas.h | 2 +-
 include/linux/soc/ixp4xx/npe.h           | 1 -
 include/linux/soc/ixp4xx/qmgr.h          | 1 -
 include/linux/soc/mediatek/mtk_wed.h     | 1 -
 include/linux/sysfb.h                    | 1 -
 include/linux/textsearch.h               | 1 -
 include/linux/usb/pd.h                   | 1 -
 include/linux/vdpa.h                     | 1 -
 include/linux/videodev2.h                | 1 -
 include/linux/watchdog.h                 | 1 -
 include/linux/xarray.h                   | 1 -
 include/linux/zutil.h                    | 1 -
 include/net/af_vsock.h                   | 1 -
 include/net/caif/caif_device.h           | 1 -
 include/net/flow_offload.h               | 1 -
 include/net/ieee80211_radiotap.h         | 1 -
 include/net/inet_connection_sock.h       | 1 -
 include/net/ipv6_frag.h                  | 1 -
 include/net/mac80211.h                   | 1 -
 include/net/sock.h                       | 1 -
 include/rdma/iba.h                       | 1 -
 include/rdma/uverbs_types.h              | 1 -
 include/scsi/scsi.h                      | 1 -
 include/sound/soc.h                      | 1 -
 include/xen/grant_table.h                | 1 -
 include/xen/xen-front-pgdir-shbuf.h      | 2 --
 80 files changed, 3 insertions(+), 82 deletions(-)
arch/arm64/include/asm/cpufeature.h +0 -1
index d7c6988188d9..79ad18a0efcb 100644
@@ -22,7 +22,6 @@
 
 #include <linux/bug.h>
 #include <linux/jump_label.h>
-#include <linux/kernel.h>
 #include <linux/cpumask.h>
 
 /*
arch/arm64/include/asm/fixmap.h +0 -1
index 58c294a96676..5d127e0fe919 100644
@@ -16,7 +16,6 @@
 #define _ASM_ARM64_FIXMAP_H
 
 #ifndef __ASSEMBLY__
-#include <linux/kernel.h>
 #include <linux/math.h>
 #include <linux/sizes.h>
 #include <asm/boot.h>
include/acpi/platform/aclinux.h +0 -1
index 9d88b028f6b0..a26dbc7f66b2 100644
@@ -50,7 +50,6 @@
 #endif
 
 #include <linux/string.h>
-#include <linux/kernel.h>
 #include <linux/ctype.h>
 #include <linux/sched.h>
 #include <linux/atomic.h>
include/linux/backing-dev.h +0 -1
index 3c39a171c073..38ac4bf4c26f 100644
@@ -9,7 +9,6 @@
 #ifndef _LINUX_BACKING_DEV_H
 #define _LINUX_BACKING_DEV_H
 
-#include <linux/kernel.h>
 #include <linux/fs.h>
 #include <linux/sched.h>
 #include <linux/device.h>
include/linux/badblocks.h +0 -1
index bd14c9de160a..345b04610a60 100644
@@ -4,7 +4,6 @@
 
 #include <linux/seqlock_types.h>
 #include <linux/device.h>
-#include <linux/kernel.h>
 #include <linux/stddef.h>
 #include <linux/types.h>
 
include/linux/bcm47xx_nvram.h +0 -1
index 7615f8d7b1ed..e4b6ce953ddb 100644
@@ -7,7 +7,6 @@
 
 #include <linux/errno.h>
 #include <linux/types.h>
-#include <linux/kernel.h>
 #include <linux/vmalloc.h>
 
 #ifdef CONFIG_BCM47XX_NVRAM
include/linux/bcm47xx_sprom.h +0 -1
index f8254fd53e15..bb2b58dffa98 100644
@@ -6,7 +6,6 @@
 #define __BCM47XX_SPROM_H
 
 #include <linux/types.h>
-#include <linux/kernel.h>
 #include <linux/vmalloc.h>
 
 struct ssb_sprom;
include/linux/bit_spinlock.h +0 -1
index bbc4730a6505..9bb56222346c 100644
@@ -2,7 +2,6 @@
 #ifndef __LINUX_BIT_SPINLOCK_H
 #define __LINUX_BIT_SPINLOCK_H
 
-#include <linux/kernel.h>
 #include <linux/preempt.h>
 #include <linux/atomic.h>
 #include <linux/bug.h>
include/linux/bootconfig.h +0 -1
index 81f3738d453c..7187ce3d1a2f 100644
@@ -8,7 +8,6 @@
  */
 
 #ifdef __KERNEL__
-#include <linux/kernel.h>
 #include <linux/init.h> // for __init
 #include <linux/types.h>
 #else /* !__KERNEL__ */
include/linux/btree.h +0 -1
index 243ee544397a..f88a19413419 100644
@@ -2,7 +2,6 @@
 #ifndef BTREE_H
 #define BTREE_H
 
-#include <linux/kernel.h>
 #include <linux/mempool.h>
 
 /**
include/linux/clk.h +0 -1
index 2fcae620703b..f285683f40d8 100644
@@ -10,7 +10,6 @@
 #define __LINUX_CLK_H
 
 #include <linux/err.h>
-#include <linux/kernel.h>
 #include <linux/notifier.h>
 #include <linux/sched/debug_atomic_sleep.h> // for might_sleep()
 
include/linux/counter.h +0 -1
index 95e8067f4b78..bc66c23e1bc6 100644
@@ -8,7 +8,6 @@
 
 #include <linux/cdev.h>
 #include <linux/device_types.h>
-#include <linux/kernel.h>
 #include <linux/kfifo.h>
 #include <linux/mutex_types.h>
 #include <linux/spinlock_types.h>
include/linux/cpu_pm.h +0 -1
index 552b8f9ea05e..947e0f0faebe 100644
@@ -9,7 +9,6 @@
 #ifndef _LINUX_CPU_PM_H
 #define _LINUX_CPU_PM_H
 
-#include <linux/kernel.h>
 #include <linux/notifier.h>
 
 /*
include/linux/cpumask.h +0 -1
index 2b601a7eb148..fbb5e29aac3b 100644
@@ -8,7 +8,6 @@
  * only nr_cpu_ids (<= NR_CPUS) bits are valid.
  */
 #include <linux/cleanup.h>
-#include <linux/kernel.h>
 #include <linux/threads.h>
 #include <linux/bitmap.h>
 #include <linux/atomic.h>
include/linux/decompress/mm.h +0 -1
index ac862422df15..3fa9bbe24272 100644
@@ -76,7 +76,6 @@ MALLOC_VISIBLE void free(void *where)
 
 /* Code active when compiled standalone for use when loading ramdisk: */
 
-#include <linux/kernel.h>
 #include <linux/fs.h>
 #include <linux/string.h>
 #include <linux/slab.h>
include/linux/dim.h +0 -1
index e4ff5829963f..56b0aca7abf0 100644
@@ -5,7 +5,6 @@
 #define DIM_H
 
 #include <linux/bits.h>
-#include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/workqueue_types.h>
include/linux/firewire.h +0 -1
index a81e31472530..a4ded9ad3a71 100644
@@ -5,7 +5,6 @@
 #include <linux/completion_types.h>
 #include <linux/device.h>
 #include <linux/dma-mapping.h>
-#include <linux/kernel.h>
 #include <linux/kref.h>
 #include <linux/list.h>
 #include <linux/mutex_types.h>
include/linux/fs_context.h +0 -1
index 34ad2597640e..2ffc7c992d59 100644
@@ -8,7 +8,6 @@
 #ifndef _LINUX_FS_CONTEXT_H
 #define _LINUX_FS_CONTEXT_H
 
-#include <linux/kernel.h>
 #include <linux/refcount_types.h>
 #include <linux/errno.h>
 #include <linux/security.h>
include/linux/gpio.h +0 -2
index 7ecc25c543ce..f735f9cb1a95 100644
@@ -125,8 +125,6 @@ int devm_gpio_request_one(struct device *dev, unsigned gpio,
 
 #else /* ! CONFIG_GPIOLIB */
 
-#include <linux/kernel.h>
-
 #include <asm/bug.h>
 #include <asm/errno.h>
 
include/linux/greybus.h +0 -1
index 18c0fb958b74..f73a7996c137 100644
@@ -11,7 +11,6 @@
 
 #ifdef __KERNEL__
 
-#include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/list.h>
 #include <linux/slab.h>
include/linux/hashtable.h +0 -1
index f6c666730b8c..47fc50c72463 100644
@@ -9,7 +9,6 @@
 
 #include <linux/list.h>
 #include <linux/types.h>
-#include <linux/kernel.h>
 #include <linux/hash.h>
 #include <linux/rculist.h>
 
include/linux/highmem.h +0 -1
index 00341b56d291..a63be916fe3b 100644
@@ -3,7 +3,6 @@
 #define _LINUX_HIGHMEM_H
 
 #include <linux/fs.h>
-#include <linux/kernel.h>
 #include <linux/bug.h>
 #include <linux/cacheflush.h>
 #include <linux/kmsan.h>
include/linux/interrupt.h +0 -1
index e3a0f2c22a75..9883e30a6130 100644
@@ -3,7 +3,6 @@
 #ifndef _LINUX_INTERRUPT_H
 #define _LINUX_INTERRUPT_H
 
-#include <linux/kernel.h>
 #include <linux/bitops.h>
 #include <linux/cpumask.h>
 #include <linux/irqreturn.h>
include/linux/iova.h +0 -1
index ee656a0490ed..efd0c192e8cc 100644
@@ -10,7 +10,6 @@
 #define _IOVA_H_
 
 #include <linux/types.h>
-#include <linux/kernel.h>
 #include <linux/rbtree_types.h>
 #include <linux/dma-mapping.h>
 
include/linux/isa.h +0 -1
index 4fbbf5e36e08..7c61e9396e5b 100644
@@ -8,7 +8,6 @@
 
 #include <linux/device.h>
 #include <linux/errno.h>
-#include <linux/kernel.h>
 
 struct isa_driver {
 	int (*match)(struct device *, unsigned int);
include/linux/isdn/capilli.h +0 -1
index 12be09b6883b..758e01e6cfbf 100644
@@ -12,7 +12,6 @@
 #ifndef __CAPILLI_H__
 #define __CAPILLI_H__
 
-#include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/capi.h>
 #include <linux/kernelcapi.h>
include/linux/kallsyms.h +0 -1
index c3f075e8f60c..0eafffc64a53 100644
@@ -8,7 +8,6 @@
 
 #include <linux/errno.h>
 #include <linux/buildid.h>
-#include <linux/kernel.h>
 #include <linux/stddef.h>
 #include <linux/mm.h>
 #include <linux/module.h>
include/linux/kasan.h +0 -1
index dbb06d789e74..7d60e6c1d29c 100644
@@ -5,7 +5,6 @@
 #include <linux/bug.h>
 #include <linux/kasan-enabled.h>
 #include <linux/kasan-tags.h>
-#include <linux/kernel.h>
 #include <linux/static_key.h>
 #include <linux/types.h>
 
include/linux/kfifo.h +0 -1
index 0b35a41440ff..17fea09984fe 100644
@@ -36,7 +36,6 @@
  * to lock the reader.
  */
 
-#include <linux/kernel.h>
 #include <linux/spinlock.h>
 #include <linux/stddef.h>
 #include <linux/scatterlist.h>
include/linux/libnvdimm.h +1 -1
index 04be45d6a9ab..ff4ddab84495 100644
@@ -6,7 +6,7 @@
  */
 #ifndef __LIBNVDIMM_H__
 #define __LIBNVDIMM_H__
-#include <linux/kernel.h>
+
 #include <linux/sizes.h>
 #include <linux/types.h>
 #include <linux/uuid.h>
include/linux/lsm_audit.h +0 -1
index bd1ae08af2aa..5b1e1ffaad77 100644
@@ -13,7 +13,6 @@
 
 #include <linux/stddef.h>
 #include <linux/errno.h>
-#include <linux/kernel.h>
 #include <linux/kdev_t.h>
 #include <linux/init.h>
 #include <linux/audit.h>
include/linux/maple_tree.h +0 -1
index 7f5dd33f4b94..7e52ed3fd219 100644
@@ -10,7 +10,6 @@
 
 #include <linux/maple_tree_types.h>
 
-#include <linux/kernel.h>
 #include <linux/rcupdate.h>
 #include <linux/spinlock.h>
 /* #define CONFIG_MAPLE_RCU_DISABLED */
include/linux/memcontrol.h +0 -1
index 566566b0ae64..c2d33150b093 100644
@@ -14,7 +14,6 @@
 #include <linux/vm_event_item.h>
 #include <linux/hardirq.h>
 #include <linux/jump_label.h>
-#include <linux/kernel.h>
 #include <linux/page_counter.h>
 #include <linux/vmpressure.h>
 #include <linux/eventfd.h>
include/linux/mfd/davinci_voicecodec.h +0 -1
index 556375b91316..725c8730f34a 100644
@@ -10,7 +10,6 @@
 #ifndef __LINUX_MFD_DAVINCI_VOICECODEC_H_
 #define __LINUX_MFD_DAVINCI_VOICECODEC_H_
 
-#include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/mfd/core.h>
 #include <linux/platform_data/edma.h>
include/linux/mfd/madera/pdata.h +0 -1
index 32e3470708ed..7d7b216b2490 100644
@@ -8,7 +8,6 @@
 #ifndef MADERA_PDATA_H
 #define MADERA_PDATA_H
 
-#include <linux/kernel.h>
 #include <linux/regulator/arizona-ldo1.h>
 #include <linux/regulator/arizona-micsupp.h>
 #include <linux/regulator/machine.h>
include/linux/mfd/wm8350/core.h +0 -1
index 25379c7f94c4..90002375b2cd 100644
@@ -8,7 +8,6 @@
 #ifndef __LINUX_MFD_WM8350_CORE_H_
 #define __LINUX_MFD_WM8350_CORE_H_
 
-#include <linux/kernel.h>
 #include <linux/mutex_types.h>
 #include <linux/interrupt.h>
 #include <linux/completion_types.h>
include/linux/mlx5/driver.h +0 -1
index 07956bd2e55b..80f4fa5568d2 100644
@@ -33,7 +33,6 @@
 #ifndef MLX5_DRIVER_H
 #define MLX5_DRIVER_H
 
-#include <linux/kernel.h>
 #include <linux/completion_types.h>
 #include <linux/pci.h>
 #include <linux/irq.h>
include/linux/mtd/map.h +0 -1
index b4fa92a6e44b..97bd6007a6f8 100644
@@ -12,7 +12,6 @@
 #include <linux/list.h>
 #include <linux/string.h>
 #include <linux/bug.h>
-#include <linux/kernel.h>
 #include <linux/io.h>
 
 #include <asm/unaligned.h>
include/linux/namei.h +0 -1
index 74e0cc14ebf8..c4b71e99f414 100644
@@ -3,7 +3,6 @@
 #define _LINUX_NAMEI_H
 
 #include <linux/fs.h>
-#include <linux/kernel.h>
 #include <linux/path.h>
 #include <linux/fcntl.h>
 #include <linux/errno.h>
include/linux/net/intel/iidc.h +0 -1
index 1c1332e4df26..5424c9069ed7 100644
@@ -8,7 +8,6 @@
 #include <linux/dcbnl.h>
 #include <linux/device.h>
 #include <linux/if_ether.h>
-#include <linux/kernel.h>
 #include <linux/netdevice.h>
 
 enum iidc_event_type {
include/linux/pci-ecam.h +0 -1
index 3a4860bd2758..b987d0ba1262 100644
@@ -6,7 +6,6 @@
 #define DRIVERS_PCI_ECAM_H
 
 #include <linux/pci.h>
-#include <linux/kernel.h>
 #include <linux/platform_device.h>
 
 /*
include/linux/peci.h +0 -1
index 39d455231e21..a750b9d65dba 100644
@@ -5,7 +5,6 @@
 #define __LINUX_PECI_H
 
 #include <linux/device_types.h>
-#include <linux/kernel.h>
 #include <linux/mutex_types.h>
 #include <linux/types.h>
 
include/linux/profile.h +0 -1
index 11db1ec516e2..8b417675054e 100644
@@ -2,7 +2,6 @@
 #ifndef _LINUX_PROFILE_H
 #define _LINUX_PROFILE_H
 
-#include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/cpumask.h>
 #include <linux/cache.h>
include/linux/qed/qed_chain.h +0 -1
index a84063492c71..40c168c83816 100644
@@ -9,7 +9,6 @@
 
 #include <linux/types.h>
 #include <asm/byteorder.h>
-#include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/sizes.h>
 #include <linux/slab.h>
include/linux/qed/qed_if.h +0 -1
index 6dc4943d8aec..be88819ec6ac 100644
@@ -16,7 +16,6 @@
 #include <asm/byteorder.h>
 #include <linux/io.h>
 #include <linux/compiler.h>
-#include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/slab.h>
 #include <linux/qed/common_hsi.h>
include/linux/qed/qed_ll2_if.h +0 -1
index 5b67cd03276e..fa53d7831240 100644
@@ -12,7 +12,6 @@
 #include <linux/netdevice.h>
 #include <linux/pci.h>
 #include <linux/skbuff.h>
-#include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/qed/qed_if.h>
 
include/linux/randomize_kstack.h +0 -1
index 5d868505a94e..154d30fdd392 100644
@@ -3,7 +3,6 @@
 #define _LINUX_RANDOMIZE_KSTACK_H
 
 #ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
-#include <linux/kernel.h>
 #include <linux/jump_label.h>
 #include <linux/percpu-defs.h>
 
include/linux/regulator/coupler.h +0 -1
index 7f37ce155330..cdc0833ed31d 100644
@@ -9,7 +9,6 @@
 #define __LINUX_REGULATOR_COUPLER_H_
 
 #include <linux/errno.h>
-#include <linux/kernel.h>
 #include <linux/suspend.h>
 
 struct regulator_coupler;
include/linux/resctrl.h +0 -1
index c62f0be16fa2..32cd56aa1284 100644
@@ -2,7 +2,6 @@
 #ifndef _RESCTRL_H
 #define _RESCTRL_H
 
-#include <linux/kernel.h>
 #include <linux/list.h>
 
 #ifdef CONFIG_PROC_CPU_RESCTRL
include/linux/rfkill.h +0 -1
index 0e8d11410f9f..61497bd04956 100644
@@ -30,7 +30,6 @@ enum rfkill_user_states {
 #undef RFKILL_STATE_UNBLOCKED
 #undef RFKILL_STATE_HARD_BLOCKED
 
-#include <linux/kernel.h>
 #include <linux/leds.h>
 #include <linux/err.h>
 
include/linux/rmi.h +0 -1
index ab7eea01ab42..9bd3aadad055 100644
@@ -6,7 +6,6 @@
 
 #ifndef _RMI_H
 #define _RMI_H
-#include <linux/kernel.h>
 #include <linux/device.h>
 #include <linux/interrupt.h>
 #include <linux/input.h>
include/linux/sed-opal-key.h +1 -1
index 0ca03054e8f6..00f6e5fbd659 100644
@@ -9,7 +9,7 @@
  *
  */
 
-#include <linux/kernel.h>
+#include <linux/types.h>
 
 #ifdef CONFIG_PSERIES_PLPKS_SED
 int sed_read_key(char *keyname, char *key, u_int *keylen);
include/linux/siphash.h +0 -1
index e516ddfc3daf..6b5e06a6fac4 100644
@@ -14,7 +14,6 @@
 
 #include <linux/align.h>
 #include <linux/types.h>
-#include <linux/kernel.h>
 #include <uapi/asm/byteorder.h> // for le32_to_cpup(), le64_to_cpu()
 
 #define SIPHASH_ALIGNMENT __alignof__(u64)
include/linux/skbuff.h +0 -1
index 8ee67e49699b..fc59f80eb169 100644
@@ -10,7 +10,6 @@
 #ifndef _LINUX_SKBUFF_H
 #define _LINUX_SKBUFF_H
 
-#include <linux/kernel.h>
 #include <linux/compiler.h>
 #include <linux/time.h>
 #include <linux/bug.h>
include/linux/soc/amlogic/meson-canvas.h +1 -1
index 0cb2a6050d1f..eaa0f777ce3a 100644
@@ -5,7 +5,7 @@
 #ifndef __SOC_MESON_CANVAS_H
 #define __SOC_MESON_CANVAS_H
 
-#include <linux/kernel.h>
+#include <linux/types.h>
 
 #define MESON_CANVAS_WRAP_NONE	0x00
 #define MESON_CANVAS_WRAP_X	0x01
include/linux/soc/ixp4xx/npe.h +0 -1
index 9efeac777da1..d734f06fe5ff 100644
@@ -2,7 +2,6 @@
 #ifndef __IXP4XX_NPE_H
 #define __IXP4XX_NPE_H
 
-#include <linux/kernel.h>
 #include <linux/regmap.h>
 
 extern const char *npe_names[];
include/linux/soc/ixp4xx/qmgr.h +0 -1
index 2c0f433a3841..a51948a82eff 100644
@@ -7,7 +7,6 @@
 #define IXP4XX_QMGR_H
 
 #include <linux/io.h>
-#include <linux/kernel.h>
 
 #define DEBUG_QMGR	0
 
include/linux/soc/mediatek/mtk_wed.h +0 -1
index a476648858a6..c8474a65e474 100644
@@ -1,7 +1,6 @@
 #ifndef __MTK_WED_H
 #define __MTK_WED_H
 
-#include <linux/kernel.h>
 #include <linux/rcupdate.h>
 #include <linux/regmap.h>
 #include <linux/pci.h>
include/linux/sysfb.h +0 -1
index 19cb803dd5ec..c21885316349 100644
@@ -7,7 +7,6 @@
  * Copyright (c) 2012-2013 David Herrmann <[email protected]>
  */
 
-#include <linux/kernel.h>
 #include <linux/platform_data/simplefb.h>
 
 struct screen_info;
include/linux/textsearch.h +0 -1
index 6673e4d4ac2e..b5f8fe9c9ac5 100644
@@ -4,7 +4,6 @@
 
 #include <linux/types.h>
 #include <linux/list.h>
-#include <linux/kernel.h>
 #include <linux/err.h>
 #include <linux/slab.h>
 
include/linux/usb/pd.h +0 -1
index 5fe5f786ad96..2f5ba98c2640 100644
@@ -7,7 +7,6 @@
 #define __LINUX_USB_PD_H
 
 #include <uapi/asm/byteorder.h> // for __le16
-#include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/usb/typec.h>
 
include/linux/vdpa.h +0 -1
index db15ac07f8a6..ba3e6aae8bb7 100644
@@ -2,7 +2,6 @@
 #ifndef _LINUX_VDPA_H
 #define _LINUX_VDPA_H
 
-#include <linux/kernel.h>
 #include <linux/device.h>
 #include <linux/interrupt.h>
 #include <linux/vhost_iotlb.h>
include/linux/videodev2.h +0 -1
index 219037f4c08d..16c0ed6c50a7 100644
@@ -57,7 +57,6 @@
 #define __LINUX_VIDEODEV2_H
 
 #include <linux/time.h>     /* need struct timeval */
-#include <linux/kernel.h>
 #include <uapi/linux/videodev2.h>
 
 #endif /* __LINUX_VIDEODEV2_H */
include/linux/watchdog.h +0 -1
index 99660197a36c..4aeb3704c348 100644
@@ -13,7 +13,6 @@
 #include <linux/bitops.h>
 #include <linux/cdev.h>
 #include <linux/device.h>
-#include <linux/kernel.h>
 #include <linux/notifier.h>
 #include <uapi/linux/watchdog.h>
 
include/linux/xarray.h +0 -1
index ff1e63ec4865..2ecb2ee42cd4 100644
@@ -14,7 +14,6 @@
 #include <linux/bug.h>
 #include <linux/compiler.h>
 #include <linux/kconfig.h>
-#include <linux/kernel.h>
 #include <linux/math.h> // for DIV_ROUND_UP()
 #include <linux/rcupdate.h>
 #include <linux/sched/mm.h>
include/linux/zutil.h +0 -1
index 663689521759..a63c8eb8294d 100644
@@ -15,7 +15,6 @@
 
 #include <linux/zlib.h>
 #include <linux/string.h>
-#include <linux/kernel.h>
 
 typedef unsigned char  uch;
 typedef unsigned short ush;
include/net/af_vsock.h +0 -1
index 7eca98931e25..2737d8fb7133 100644
@@ -8,7 +8,6 @@
 #ifndef __AF_VSOCK_H__
 #define __AF_VSOCK_H__
 
-#include <linux/kernel.h>
 #include <linux/workqueue_types.h>
 #include <net/sock.h>
 #include <uapi/linux/vm_sockets.h>
include/net/caif/caif_device.h +0 -1
index 91d1fd5b44a4..f40be65cebae 100644
@@ -6,7 +6,6 @@
 
 #ifndef CAIF_DEVICE_H_
 #define CAIF_DEVICE_H_
-#include <linux/kernel.h>
 #include <linux/net.h>
 #include <linux/netdevice.h>
 #include <linux/caif/caif_socket.h>
include/net/flow_offload.h +0 -1
index 314087a5e181..1e56da4fb2b4 100644
@@ -1,7 +1,6 @@
 #ifndef _NET_FLOW_OFFLOAD_H
 #define _NET_FLOW_OFFLOAD_H
 
-#include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/netlink.h>
 #include <net/flow_dissector.h>
include/net/ieee80211_radiotap.h +0 -1
index 925bac726a92..8b0a19ef2652 100644
@@ -17,7 +17,6 @@
 #ifndef __RADIOTAP_H
 #define __RADIOTAP_H
 
-#include <linux/kernel.h>
 #include <asm/unaligned.h>
 
 /**
include/net/inet_connection_sock.h +0 -1
index 4e62121e1cb6..9568878dd6bc 100644
@@ -15,7 +15,6 @@
 #include <linux/string.h>
 #include <linux/timer_types.h>
 #include <linux/poll.h>
-#include <linux/kernel.h>
 #include <linux/sockptr.h>
 
 #include <net/inet_sock.h>
include/net/ipv6_frag.h +0 -1
index 7321ffe3a108..a593919e9d83 100644
@@ -2,7 +2,6 @@
 #ifndef _IPV6_FRAG_H
 #define _IPV6_FRAG_H
 #include <linux/icmpv6.h>
-#include <linux/kernel.h>
 #include <net/addrconf.h>
 #include <net/ipv6.h>
 #include <net/inet_frag.h>
include/net/mac80211.h +0 -1
index 45d905b17a65..8213a2a0afab 100644
@@ -14,7 +14,6 @@
 #define MAC80211_H
 
 #include <linux/bug.h>
-#include <linux/kernel.h>
 #include <linux/if_ether.h>
 #include <linux/skbuff.h>
 #include <linux/ieee80211.h>
include/net/sock.h +0 -1
index 008a6c5a3bfc..4377a8ebc251 100644
@@ -36,7 +36,6 @@
 #define _SOCK_H
 
 #include <linux/hardirq.h>
-#include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/list_nulls.h>
 #include <linux/timer_types.h>
include/rdma/iba.h +0 -1
index 6a1115b02a0d..bcea705a36ea 100644
@@ -5,7 +5,6 @@
 #ifndef _IBA_DEFS_H_
 #define _IBA_DEFS_H_
 
-#include <linux/kernel.h>
 #include <linux/bitfield.h>
 #include <asm/unaligned.h>
 
include/rdma/uverbs_types.h +0 -1
index 8744e75220a3..87566478032d 100644
@@ -6,7 +6,6 @@
 #ifndef _UVERBS_TYPES_
 #define _UVERBS_TYPES_
 
-#include <linux/kernel.h>
 #include <linux/kref.h>
 #include <rdma/ib_verbs.h>
 
include/scsi/scsi.h +0 -1
index 4498f845b112..3eadcf14b7f7 100644
@@ -8,7 +8,6 @@
 
 #include <linux/types.h>
 #include <linux/scatterlist.h>
-#include <linux/kernel.h>
 #include <scsi/scsi_common.h>
 #include <scsi/scsi_proto.h>
 #include <scsi/scsi_status.h>
include/sound/soc.h +0 -1
index 0021d54625da..72f7b3372014 100644
@@ -17,7 +17,6 @@
 #include <linux/notifier.h>
 #include <linux/workqueue_types.h>
 #include <linux/interrupt.h>
-#include <linux/kernel.h>
 #include <linux/regmap.h>
 #include <linux/log2.h>
 #include <sound/core.h>
include/xen/grant_table.h +0 -1
index e279be353e3f..b4e0506262e6 100644
@@ -48,7 +48,6 @@
 #include <xen/page.h>
 #include <linux/mm_types.h>
 #include <linux/page-flags.h>
-#include <linux/kernel.h>
 
 /*
  * Technically there's no reliably invalid grant reference or grant handle,
include/xen/xen-front-pgdir-shbuf.h +0 -2
index 150ef7ec51ec..27ceb1c1920f 100644
@@ -12,8 +12,6 @@
 #ifndef __XEN_FRONT_PGDIR_SHBUF_H_
 #define __XEN_FRONT_PGDIR_SHBUF_H_
 
-#include <linux/kernel.h>
-
 #include <xen/grant_table.h>
 
 struct xen_front_pgdir_shbuf_ops;
Signature · 1 line
2.39.2
#36 lore raw
In reply to Max Kellermann

Hi Max,

Quoted 3 lines · Max Kellermann

This patch set aims to reduce the dependencies between headers, in order to have cleaner code and speed up the build. It continues previous efforts by other developers.

[...]

Thanks for your series!

On next-20240212 + your series:

m68k/defconfig:

sound/oss/dmasound/dmasound_core.c:1436:8: error: implicit declaration of function ‘get_options’ [-Werror=implicit-function-declaration] arch/m68k/emu/nfblock.c:45:10: error: implicit declaration of function ‘virt_to_phys’; did you mean ‘virt_to_pfn’? [-Werror=implicit-function-declaration] arch/m68k/emu/nfblock.c:71:2: error: implicit declaration of function ‘bio_for_each_segment’ [-Werror=implicit-function-declaration] arch/m68k/emu/nfblock.c:71:39: error: expected ‘;’ before ‘{’ token
fs/notify/fanotify/fanotify_user.c:1760:6: error: implicit declaration of function ‘upper_32_bits’ [-Werror=implicit-function-declaration] drivers/block/amiflop.c:1954:7: error: implicit declaration of function ‘get_option’; did you mean ‘get_pid’? [-Werror=implicit-function-declaration] drivers/block/ataflop.c:2163:8: error: implicit declaration of function ‘get_options’ [-Werror=implicit-function-declaration] drivers/net/Space.c:148:8: error: implicit declaration of function ‘get_options’ [-Werror=implicit-function-declaration] drivers/scsi/atari_scsi.c:396:2: error: implicit declaration of function ‘get_options’ [-Werror=implicit-function-declaration] drivers/scsi/NCR5380.c:424:2: error: implicit declaration of function ‘snprintf’ [-Werror=implicit-function-declaration] drivers/scsi/mac_scsi.c:72:8: error: implicit declaration of function ‘get_options’ [-Werror=implicit-function-declaration] drivers/zorro/zorro-driver.c:144:6: error: implicit declaration of function ‘add_uevent_var’ [-Werror=implicit-function-declaration] fs/open.c:1214:19: error: implicit declaration of function ‘upper_32_bits’ [-Werror=implicit-function-declaration]

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds