Skip to content

Commit de5d9bf

Browse files
Move list types from <linux/list.h> to <linux/types.h>.
This allows a list_head (or hlist_head, etc.) to be used from places that used to be impractical, in particular <asm/processor.h>, which used to cause include file recursion: <linux/list.h> includes <linux/prefetch.h>, which always includes <asm/processor.h> for the prefetch macros, as well as <asm/system.h>, which often includes <asm/processor.h> directly or indirectly. This avoids a lot of painful workaround hackery on the tile architecture, where we use a list_head in the thread_struct to chain together tasks that are activated on a particular hardwall. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> Reviewed-by: Matthew Wilcox <willy@linux.intel.com>
1 parent b51cae2 commit de5d9bf

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

‎include/linux/list.h‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef _LINUX_LIST_H
22
#define _LINUX_LIST_H
33

4+
#include <linux/types.h>
45
#include <linux/stddef.h>
56
#include <linux/poison.h>
67
#include <linux/prefetch.h>
@@ -16,10 +17,6 @@
1617
* using the generic single-entry routines.
1718
*/
1819

19-
struct list_head {
20-
struct list_head *next, *prev;
21-
};
22-
2320
#define LIST_HEAD_INIT(name) { &(name), &(name) }
2421

2522
#define LIST_HEAD(name) \
@@ -551,14 +548,6 @@ static inline void list_splice_tail_init(struct list_head *list,
551548
* You lose the ability to access the tail in O(1).
552549
*/
553550

554-
struct hlist_head {
555-
struct hlist_node *first;
556-
};
557-
558-
struct hlist_node {
559-
struct hlist_node *next, **pprev;
560-
};
561-
562551
#define HLIST_HEAD_INIT { .first = NULL }
563552
#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL }
564553
#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)

‎include/linux/types.h‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,18 @@ typedef struct {
197197
} atomic64_t;
198198
#endif
199199

200+
struct list_head {
201+
struct list_head *next, *prev;
202+
};
203+
204+
struct hlist_head {
205+
struct hlist_node *first;
206+
};
207+
208+
struct hlist_node {
209+
struct hlist_node *next, **pprev;
210+
};
211+
200212
struct ustat {
201213
__kernel_daddr_t f_tfree;
202214
__kernel_ino_t f_tinode;

0 commit comments

Comments
 (0)