diff options
| author | David S. Miller <davem@davemloft.net> | 2016-01-13 08:22:13 +0300 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2016-01-13 08:22:13 +0300 |
| commit | 725da8dee445662beea77d3f42c3f4c79f7a7a0e (patch) | |
| tree | be1e2bd103c69d7bbace3fffd97bc3d714bbc3d7 /include/linux/list.h | |
| parent | ce78c76f33b9f43b92444869d1723f9e4260797a (diff) | |
| parent | ddb5388ffd0ad75d07e7b78181a0b579824ba6f0 (diff) | |
| download | linux-725da8dee445662beea77d3f42c3f4c79f7a7a0e.tar.xz | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'include/linux/list.h')
| -rw-r--r-- | include/linux/list.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/include/linux/list.h b/include/linux/list.h index 993395a2e55c..5356f4d661a7 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -24,7 +24,7 @@ static inline void INIT_LIST_HEAD(struct list_head *list) { - list->next = list; + WRITE_ONCE(list->next, list); list->prev = list; } @@ -42,7 +42,7 @@ static inline void __list_add(struct list_head *new, next->prev = new; new->next = next; new->prev = prev; - prev->next = new; + WRITE_ONCE(prev->next, new); } #else extern void __list_add(struct list_head *new, @@ -186,7 +186,7 @@ static inline int list_is_last(const struct list_head *list, */ static inline int list_empty(const struct list_head *head) { - return head->next == head; + return READ_ONCE(head->next) == head; } /** @@ -608,7 +608,7 @@ static inline int hlist_unhashed(const struct hlist_node *h) static inline int hlist_empty(const struct hlist_head *h) { - return !h->first; + return !READ_ONCE(h->first); } static inline void __hlist_del(struct hlist_node *n) @@ -642,7 +642,7 @@ static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) n->next = first; if (first) first->pprev = &n->next; - h->first = n; + WRITE_ONCE(h->first, n); n->pprev = &h->first; } @@ -653,14 +653,14 @@ static inline void hlist_add_before(struct hlist_node *n, n->pprev = next->pprev; n->next = next; next->pprev = &n->next; - *(n->pprev) = n; + WRITE_ONCE(*(n->pprev), n); } static inline void hlist_add_behind(struct hlist_node *n, struct hlist_node *prev) { n->next = prev->next; - prev->next = n; + WRITE_ONCE(prev->next, n); n->pprev = &prev->next; if (n->next) |
