Harald Welte | 9f240b6 | 2016-03-18 10:32:56 +0100 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Harald Welte | b41598b | 2017-02-04 12:15:58 +0100 | [diff] [blame^] | 3 | #include "osmocom/core/linuxlist.h" |
Harald Welte | 9f240b6 | 2016-03-18 10:32:56 +0100 | [diff] [blame] | 4 | |
| 5 | static inline void llist_add_tail_irqsafe(struct llist_head *_new, |
| 6 | struct llist_head *head) |
| 7 | { |
| 8 | __disable_irq(); |
| 9 | llist_add_tail(_new, head); |
| 10 | __enable_irq(); |
| 11 | } |
| 12 | |
| 13 | static inline struct llist_head *llist_head_dequeue_irqsafe(struct llist_head *head) |
| 14 | { |
| 15 | struct llist_head *lh; |
| 16 | |
| 17 | __disable_irq(); |
| 18 | if (llist_empty(head)) { |
| 19 | lh = NULL; |
| 20 | } else { |
| 21 | lh = head->next; |
| 22 | llist_del(lh); |
| 23 | } |
| 24 | __enable_irq(); |
| 25 | |
| 26 | return lh; |
| 27 | } |