mirror of
https://github.com/candle-usb/candleLight_fw.git
synced 2025-01-28 06:02:52 +08:00
list.h: add locked variants
This commit is contained in:
parent
9ea65a1d98
commit
61baf8ce90
@ -32,6 +32,7 @@
|
||||
#define _LINUXKPI_LINUX_LIST_H_
|
||||
|
||||
#include "compiler.h"
|
||||
#include "util.h"
|
||||
|
||||
#ifndef prefetch
|
||||
#define prefetch(x)
|
||||
@ -427,6 +428,23 @@ static inline int list_is_last(const struct list_head *list,
|
||||
return list->next == head;
|
||||
}
|
||||
|
||||
#define list_first_entry_or_null_locked(ptr, type, member) \
|
||||
({ \
|
||||
bool was_irq_enabled = disable_irq(); \
|
||||
type *entry = list_first_entry_or_null(ptr, type, member); \
|
||||
restore_irq(was_irq_enabled); \
|
||||
entry; \
|
||||
})
|
||||
|
||||
static inline void
|
||||
list_move_tail_locked(struct list_head *entry, struct list_head *head)
|
||||
{
|
||||
bool was_irq_enabled = disable_irq();
|
||||
|
||||
list_move_tail(entry, head);
|
||||
restore_irq(was_irq_enabled);
|
||||
}
|
||||
|
||||
#define hlist_entry(ptr, type, field) container_of(ptr, type, field)
|
||||
|
||||
#define hlist_for_each(p, head) \
|
||||
|
Loading…
x
Reference in New Issue
Block a user