diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/hrtimer.c | 39 |
1 files changed, 9 insertions, 30 deletions
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 877cdf9678bf..49cbf7cffebd 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
| @@ -655,7 +655,6 @@ void hrtimer_run_queues(void) | |||
| 655 | /* | 655 | /* |
| 656 | * Sleep related functions: | 656 | * Sleep related functions: |
| 657 | */ | 657 | */ |
| 658 | |||
| 659 | static int hrtimer_wakeup(struct hrtimer *timer) | 658 | static int hrtimer_wakeup(struct hrtimer *timer) |
| 660 | { | 659 | { |
| 661 | struct hrtimer_sleeper *t = | 660 | struct hrtimer_sleeper *t = |
| @@ -675,28 +674,9 @@ void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, task_t *task) | |||
| 675 | sl->task = task; | 674 | sl->task = task; |
| 676 | } | 675 | } |
| 677 | 676 | ||
| 678 | struct sleep_hrtimer { | 677 | static int __sched do_nanosleep(struct hrtimer_sleeper *t, enum hrtimer_mode mode) |
| 679 | struct hrtimer timer; | ||
| 680 | struct task_struct *task; | ||
| 681 | int expired; | ||
| 682 | }; | ||
| 683 | |||
| 684 | static int nanosleep_wakeup(struct hrtimer *timer) | ||
| 685 | { | 678 | { |
| 686 | struct sleep_hrtimer *t = | 679 | hrtimer_init_sleeper(t, current); |
| 687 | container_of(timer, struct sleep_hrtimer, timer); | ||
| 688 | |||
| 689 | t->expired = 1; | ||
| 690 | wake_up_process(t->task); | ||
| 691 | |||
| 692 | return HRTIMER_NORESTART; | ||
| 693 | } | ||
| 694 | |||
| 695 | static int __sched do_nanosleep(struct sleep_hrtimer *t, enum hrtimer_mode mode) | ||
| 696 | { | ||
| 697 | t->timer.function = nanosleep_wakeup; | ||
| 698 | t->task = current; | ||
| 699 | t->expired = 0; | ||
| 700 | 680 | ||
| 701 | do { | 681 | do { |
| 702 | set_current_state(TASK_INTERRUPTIBLE); | 682 | set_current_state(TASK_INTERRUPTIBLE); |
| @@ -704,18 +684,17 @@ static int __sched do_nanosleep(struct sleep_hrtimer *t, enum hrtimer_mode mode) | |||
| 704 | 684 | ||
| 705 | schedule(); | 685 | schedule(); |
| 706 | 686 | ||
| 707 | if (unlikely(!t->expired)) { | 687 | hrtimer_cancel(&t->timer); |
| 708 | hrtimer_cancel(&t->timer); | 688 | mode = HRTIMER_ABS; |
| 709 | mode = HRTIMER_ABS; | 689 | |
| 710 | } | 690 | } while (t->task && !signal_pending(current)); |
| 711 | } while (!t->expired && !signal_pending(current)); | ||
| 712 | 691 | ||
| 713 | return t->expired; | 692 | return t->task == NULL; |
| 714 | } | 693 | } |
| 715 | 694 | ||
| 716 | static long __sched nanosleep_restart(struct restart_block *restart) | 695 | static long __sched nanosleep_restart(struct restart_block *restart) |
| 717 | { | 696 | { |
| 718 | struct sleep_hrtimer t; | 697 | struct hrtimer_sleeper t; |
| 719 | struct timespec __user *rmtp; | 698 | struct timespec __user *rmtp; |
| 720 | struct timespec tu; | 699 | struct timespec tu; |
| 721 | ktime_t time; | 700 | ktime_t time; |
| @@ -748,7 +727,7 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp, | |||
| 748 | const enum hrtimer_mode mode, const clockid_t clockid) | 727 | const enum hrtimer_mode mode, const clockid_t clockid) |
| 749 | { | 728 | { |
| 750 | struct restart_block *restart; | 729 | struct restart_block *restart; |
| 751 | struct sleep_hrtimer t; | 730 | struct hrtimer_sleeper t; |
| 752 | struct timespec tu; | 731 | struct timespec tu; |
| 753 | ktime_t rem; | 732 | ktime_t rem; |
| 754 | 733 | ||
