aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/wait.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/wait.h')
-rw-r--r--include/linux/wait.h31
1 files changed, 10 insertions, 21 deletions
diff --git a/include/linux/wait.h b/include/linux/wait.h
index aacb1282d19a..db076ca7f11d 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -620,30 +620,19 @@ do { \
620 __ret; \ 620 __ret; \
621}) 621})
622 622
623extern int do_wait_intr(wait_queue_head_t *, wait_queue_t *);
624extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_t *);
623 625
624#define __wait_event_interruptible_locked(wq, condition, exclusive, irq) \ 626#define __wait_event_interruptible_locked(wq, condition, exclusive, fn) \
625({ \ 627({ \
626 int __ret = 0; \ 628 int __ret; \
627 DEFINE_WAIT(__wait); \ 629 DEFINE_WAIT(__wait); \
628 if (exclusive) \ 630 if (exclusive) \
629 __wait.flags |= WQ_FLAG_EXCLUSIVE; \ 631 __wait.flags |= WQ_FLAG_EXCLUSIVE; \
630 do { \ 632 do { \
631 if (likely(list_empty(&__wait.task_list))) \ 633 __ret = fn(&(wq), &__wait); \
632 __add_wait_queue_tail(&(wq), &__wait); \ 634 if (__ret) \
633 set_current_state(TASK_INTERRUPTIBLE); \
634 if (signal_pending(current)) { \
635 __ret = -ERESTARTSYS; \
636 break; \ 635 break; \
637 } \
638 if (irq) \
639 spin_unlock_irq(&(wq).lock); \
640 else \
641 spin_unlock(&(wq).lock); \
642 schedule(); \
643 if (irq) \
644 spin_lock_irq(&(wq).lock); \
645 else \
646 spin_lock(&(wq).lock); \
647 } while (!(condition)); \ 636 } while (!(condition)); \
648 __remove_wait_queue(&(wq), &__wait); \ 637 __remove_wait_queue(&(wq), &__wait); \
649 __set_current_state(TASK_RUNNING); \ 638 __set_current_state(TASK_RUNNING); \
@@ -676,7 +665,7 @@ do { \
676 */ 665 */
677#define wait_event_interruptible_locked(wq, condition) \ 666#define wait_event_interruptible_locked(wq, condition) \
678 ((condition) \ 667 ((condition) \
679 ? 0 : __wait_event_interruptible_locked(wq, condition, 0, 0)) 668 ? 0 : __wait_event_interruptible_locked(wq, condition, 0, do_wait_intr))
680 669
681/** 670/**
682 * wait_event_interruptible_locked_irq - sleep until a condition gets true 671 * wait_event_interruptible_locked_irq - sleep until a condition gets true
@@ -703,7 +692,7 @@ do { \
703 */ 692 */
704#define wait_event_interruptible_locked_irq(wq, condition) \ 693#define wait_event_interruptible_locked_irq(wq, condition) \
705 ((condition) \ 694 ((condition) \
706 ? 0 : __wait_event_interruptible_locked(wq, condition, 0, 1)) 695 ? 0 : __wait_event_interruptible_locked(wq, condition, 0, do_wait_intr_irq))
707 696
708/** 697/**
709 * wait_event_interruptible_exclusive_locked - sleep exclusively until a condition gets true 698 * wait_event_interruptible_exclusive_locked - sleep exclusively until a condition gets true
@@ -734,7 +723,7 @@ do { \
734 */ 723 */
735#define wait_event_interruptible_exclusive_locked(wq, condition) \ 724#define wait_event_interruptible_exclusive_locked(wq, condition) \
736 ((condition) \ 725 ((condition) \
737 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, 0)) 726 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, do_wait_intr))
738 727
739/** 728/**
740 * wait_event_interruptible_exclusive_locked_irq - sleep until a condition gets true 729 * wait_event_interruptible_exclusive_locked_irq - sleep until a condition gets true
@@ -765,7 +754,7 @@ do { \
765 */ 754 */
766#define wait_event_interruptible_exclusive_locked_irq(wq, condition) \ 755#define wait_event_interruptible_exclusive_locked_irq(wq, condition) \
767 ((condition) \ 756 ((condition) \
768 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, 1)) 757 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, do_wait_intr_irq))
769 758
770 759
771#define __wait_event_killable(wq, condition) \ 760#define __wait_event_killable(wq, condition) \