|
@@ -23,6 +23,7 @@ struct __wait_queue {
|
|
struct wait_bit_key {
|
|
struct wait_bit_key {
|
|
void *flags;
|
|
void *flags;
|
|
int bit_nr;
|
|
int bit_nr;
|
|
|
|
+#define WAIT_ATOMIC_T_BIT_NR -1
|
|
};
|
|
};
|
|
|
|
|
|
struct wait_bit_queue {
|
|
struct wait_bit_queue {
|
|
@@ -60,6 +61,9 @@ struct task_struct;
|
|
#define __WAIT_BIT_KEY_INITIALIZER(word, bit) \
|
|
#define __WAIT_BIT_KEY_INITIALIZER(word, bit) \
|
|
{ .flags = word, .bit_nr = bit, }
|
|
{ .flags = word, .bit_nr = bit, }
|
|
|
|
|
|
|
|
+#define __WAIT_ATOMIC_T_KEY_INITIALIZER(p) \
|
|
|
|
+ { .flags = p, .bit_nr = WAIT_ATOMIC_T_BIT_NR, }
|
|
|
|
+
|
|
extern void __init_waitqueue_head(wait_queue_head_t *q, const char *name, struct lock_class_key *);
|
|
extern void __init_waitqueue_head(wait_queue_head_t *q, const char *name, struct lock_class_key *);
|
|
|
|
|
|
#define init_waitqueue_head(q) \
|
|
#define init_waitqueue_head(q) \
|
|
@@ -146,8 +150,10 @@ void __wake_up_bit(wait_queue_head_t *, void *, int);
|
|
int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned);
|
|
int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned);
|
|
int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned);
|
|
int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned);
|
|
void wake_up_bit(void *, int);
|
|
void wake_up_bit(void *, int);
|
|
|
|
+void wake_up_atomic_t(atomic_t *);
|
|
int out_of_line_wait_on_bit(void *, int, int (*)(void *), unsigned);
|
|
int out_of_line_wait_on_bit(void *, int, int (*)(void *), unsigned);
|
|
int out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned);
|
|
int out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned);
|
|
|
|
+int out_of_line_wait_on_atomic_t(atomic_t *, int (*)(atomic_t *), unsigned);
|
|
wait_queue_head_t *bit_waitqueue(void *, int);
|
|
wait_queue_head_t *bit_waitqueue(void *, int);
|
|
|
|
|
|
#define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL)
|
|
#define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL)
|
|
@@ -896,5 +902,23 @@ static inline int wait_on_bit_lock(void *word, int bit,
|
|
return 0;
|
|
return 0;
|
|
return out_of_line_wait_on_bit_lock(word, bit, action, mode);
|
|
return out_of_line_wait_on_bit_lock(word, bit, action, mode);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * wait_on_atomic_t - Wait for an atomic_t to become 0
|
|
|
|
+ * @val: The atomic value being waited on, a kernel virtual address
|
|
|
|
+ * @action: the function used to sleep, which may take special actions
|
|
|
|
+ * @mode: the task state to sleep in
|
|
|
|
+ *
|
|
|
|
+ * Wait for an atomic_t to become 0. We abuse the bit-wait waitqueue table for
|
|
|
|
+ * the purpose of getting a waitqueue, but we set the key to a bit number
|
|
|
|
+ * outside of the target 'word'.
|
|
|
|
+ */
|
|
|
|
+static inline
|
|
|
|
+int wait_on_atomic_t(atomic_t *val, int (*action)(atomic_t *), unsigned mode)
|
|
|
|
+{
|
|
|
|
+ if (atomic_read(val) == 0)
|
|
|
|
+ return 0;
|
|
|
|
+ return out_of_line_wait_on_atomic_t(val, action, mode);
|
|
|
|
+}
|
|
|
|
|
|
#endif
|
|
#endif
|