USB: storage: Remove redundant license text
[linux/fpc-iii.git] / arch / s390 / numa / toptree.h
blobbdf502027af49f360e4f9c329f3c4fae8563bc95
1 /*
2 * NUMA support for s390
4 * A tree structure used for machine topology mangling
6 * Copyright IBM Corp. 2015
7 */
8 #ifndef S390_TOPTREE_H
9 #define S390_TOPTREE_H
11 #include <linux/cpumask.h>
12 #include <linux/list.h>
14 struct toptree {
15 int level;
16 int id;
17 cpumask_t mask;
18 struct toptree *parent;
19 struct list_head sibling;
20 struct list_head children;
23 struct toptree *toptree_alloc(int level, int id);
24 void toptree_free(struct toptree *cand);
25 void toptree_update_mask(struct toptree *cand);
26 void toptree_unify(struct toptree *cand);
27 struct toptree *toptree_get_child(struct toptree *cand, int id);
28 void toptree_move(struct toptree *cand, struct toptree *target);
29 int toptree_count(struct toptree *context, int level);
31 struct toptree *toptree_first(struct toptree *context, int level);
32 struct toptree *toptree_next(struct toptree *cur, struct toptree *context,
33 int level);
35 #define toptree_for_each_child(child, ptree) \
36 list_for_each_entry(child, &ptree->children, sibling)
38 #define toptree_for_each_child_safe(child, ptmp, ptree) \
39 list_for_each_entry_safe(child, ptmp, &ptree->children, sibling)
41 #define toptree_is_last(ptree) \
42 ((ptree->parent == NULL) || \
43 (ptree->parent->children.prev == &ptree->sibling))
45 #define toptree_for_each(ptree, cont, ttype) \
46 for (ptree = toptree_first(cont, ttype); \
47 ptree != NULL; \
48 ptree = toptree_next(ptree, cont, ttype))
50 #define toptree_for_each_safe(ptree, tmp, cont, ttype) \
51 for (ptree = toptree_first(cont, ttype), \
52 tmp = toptree_next(ptree, cont, ttype); \
53 ptree != NULL; \
54 ptree = tmp, \
55 tmp = toptree_next(ptree, cont, ttype))
57 #define toptree_for_each_sibling(ptree, start) \
58 toptree_for_each(ptree, start->parent, start->level)
60 #endif /* S390_TOPTREE_H */