aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2007-02-16 04:27:49 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-16 11:13:58 -0500
commitc9cb2e3d7c9178ab75d0942f96abb3abe0369906 (patch)
tree2d4a5470ece5efe82463653678c491c2f249d560 /kernel
parentfd064b9b7770d5c7705bf9542950c7bd81c30f98 (diff)
[PATCH] hrtimers: namespace and enum cleanup
- hrtimers did not use the hrtimer_restart enum and relied on the implict int representation. Fix the prototypes and the functions using the enums. - Use seperate name spaces for the enumerations - Convert hrtimer_restart macro to inline function - Add comments No functional changes. [akpm@osdl.org: fix input driver] Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu> Cc: john stultz <johnstul@us.ibm.com> Cc: Roman Zippel <zippel@linux-m68k.org> Cc: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/fork.c2
-rw-r--r--kernel/futex.c2
-rw-r--r--kernel/hrtimer.c18
-rw-r--r--kernel/itimer.c4
-rw-r--r--kernel/posix-timers.c13
-rw-r--r--kernel/rtmutex.c2
6 files changed, 21 insertions, 20 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 0b6293d94d96..d154cc786489 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -858,7 +858,7 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts
858 init_sigpending(&sig->shared_pending); 858 init_sigpending(&sig->shared_pending);
859 INIT_LIST_HEAD(&sig->posix_timers); 859 INIT_LIST_HEAD(&sig->posix_timers);
860 860
861 hrtimer_init(&sig->real_timer, CLOCK_MONOTONIC, HRTIMER_REL); 861 hrtimer_init(&sig->real_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
862 sig->it_real_incr.tv64 = 0; 862 sig->it_real_incr.tv64 = 0;
863 sig->real_timer.function = it_real_fn; 863 sig->real_timer.function = it_real_fn;
864 sig->tsk = tsk; 864 sig->tsk = tsk;
diff --git a/kernel/futex.c b/kernel/futex.c
index 5a737de857d3..e749e7df14b1 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1134,7 +1134,7 @@ static int futex_lock_pi(u32 __user *uaddr, int detect, unsigned long sec,
1134 1134
1135 if (sec != MAX_SCHEDULE_TIMEOUT) { 1135 if (sec != MAX_SCHEDULE_TIMEOUT) {
1136 to = &timeout; 1136 to = &timeout;
1137 hrtimer_init(&to->timer, CLOCK_REALTIME, HRTIMER_ABS); 1137 hrtimer_init(&to->timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
1138 hrtimer_init_sleeper(to, current); 1138 hrtimer_init_sleeper(to, current);
1139 to->timer.expires = ktime_set(sec, nsec); 1139 to->timer.expires = ktime_set(sec, nsec);
1140 } 1140 }
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index bd57ef403049..83fc50416b1d 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -444,7 +444,7 @@ hrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode)
444 /* Switch the timer base, if necessary: */ 444 /* Switch the timer base, if necessary: */
445 new_base = switch_hrtimer_base(timer, base); 445 new_base = switch_hrtimer_base(timer, base);
446 446
447 if (mode == HRTIMER_REL) { 447 if (mode == HRTIMER_MODE_REL) {
448 tim = ktime_add(tim, new_base->get_time()); 448 tim = ktime_add(tim, new_base->get_time());
449 /* 449 /*
450 * CONFIG_TIME_LOW_RES is a temporary way for architectures 450 * CONFIG_TIME_LOW_RES is a temporary way for architectures
@@ -583,7 +583,7 @@ void hrtimer_init(struct hrtimer *timer, clockid_t clock_id,
583 583
584 bases = __raw_get_cpu_var(hrtimer_bases); 584 bases = __raw_get_cpu_var(hrtimer_bases);
585 585
586 if (clock_id == CLOCK_REALTIME && mode != HRTIMER_ABS) 586 if (clock_id == CLOCK_REALTIME && mode != HRTIMER_MODE_ABS)
587 clock_id = CLOCK_MONOTONIC; 587 clock_id = CLOCK_MONOTONIC;
588 588
589 timer->base = &bases[clock_id]; 589 timer->base = &bases[clock_id];
@@ -627,7 +627,7 @@ static inline void run_hrtimer_queue(struct hrtimer_base *base)
627 627
628 while ((node = base->first)) { 628 while ((node = base->first)) {
629 struct hrtimer *timer; 629 struct hrtimer *timer;
630 int (*fn)(struct hrtimer *); 630 enum hrtimer_restart (*fn)(struct hrtimer *);
631 int restart; 631 int restart;
632 632
633 timer = rb_entry(node, struct hrtimer, node); 633 timer = rb_entry(node, struct hrtimer, node);
@@ -669,7 +669,7 @@ void hrtimer_run_queues(void)
669/* 669/*
670 * Sleep related functions: 670 * Sleep related functions:
671 */ 671 */
672static int hrtimer_wakeup(struct hrtimer *timer) 672static enum hrtimer_restart hrtimer_wakeup(struct hrtimer *timer)
673{ 673{
674 struct hrtimer_sleeper *t = 674 struct hrtimer_sleeper *t =
675 container_of(timer, struct hrtimer_sleeper, timer); 675 container_of(timer, struct hrtimer_sleeper, timer);
@@ -699,7 +699,7 @@ static int __sched do_nanosleep(struct hrtimer_sleeper *t, enum hrtimer_mode mod
699 schedule(); 699 schedule();
700 700
701 hrtimer_cancel(&t->timer); 701 hrtimer_cancel(&t->timer);
702 mode = HRTIMER_ABS; 702 mode = HRTIMER_MODE_ABS;
703 703
704 } while (t->task && !signal_pending(current)); 704 } while (t->task && !signal_pending(current));
705 705
@@ -715,10 +715,10 @@ long __sched hrtimer_nanosleep_restart(struct restart_block *restart)
715 715
716 restart->fn = do_no_restart_syscall; 716 restart->fn = do_no_restart_syscall;
717 717
718 hrtimer_init(&t.timer, restart->arg0, HRTIMER_ABS); 718 hrtimer_init(&t.timer, restart->arg0, HRTIMER_MODE_ABS);
719 t.timer.expires.tv64 = ((u64)restart->arg3 << 32) | (u64) restart->arg2; 719 t.timer.expires.tv64 = ((u64)restart->arg3 << 32) | (u64) restart->arg2;
720 720
721 if (do_nanosleep(&t, HRTIMER_ABS)) 721 if (do_nanosleep(&t, HRTIMER_MODE_ABS))
722 return 0; 722 return 0;
723 723
724 rmtp = (struct timespec __user *) restart->arg1; 724 rmtp = (struct timespec __user *) restart->arg1;
@@ -751,7 +751,7 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp,
751 return 0; 751 return 0;
752 752
753 /* Absolute timers do not update the rmtp value and restart: */ 753 /* Absolute timers do not update the rmtp value and restart: */
754 if (mode == HRTIMER_ABS) 754 if (mode == HRTIMER_MODE_ABS)
755 return -ERESTARTNOHAND; 755 return -ERESTARTNOHAND;
756 756
757 if (rmtp) { 757 if (rmtp) {
@@ -784,7 +784,7 @@ sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp)
784 if (!timespec_valid(&tu)) 784 if (!timespec_valid(&tu))
785 return -EINVAL; 785 return -EINVAL;
786 786
787 return hrtimer_nanosleep(&tu, rmtp, HRTIMER_REL, CLOCK_MONOTONIC); 787 return hrtimer_nanosleep(&tu, rmtp, HRTIMER_MODE_REL, CLOCK_MONOTONIC);
788} 788}
789 789
790/* 790/*
diff --git a/kernel/itimer.c b/kernel/itimer.c
index 204ed7939e75..9cefe1d1eb13 100644
--- a/kernel/itimer.c
+++ b/kernel/itimer.c
@@ -128,7 +128,7 @@ asmlinkage long sys_getitimer(int which, struct itimerval __user *value)
128/* 128/*
129 * The timer is automagically restarted, when interval != 0 129 * The timer is automagically restarted, when interval != 0
130 */ 130 */
131int it_real_fn(struct hrtimer *timer) 131enum hrtimer_restart it_real_fn(struct hrtimer *timer)
132{ 132{
133 struct signal_struct *sig = 133 struct signal_struct *sig =
134 container_of(timer, struct signal_struct, real_timer); 134 container_of(timer, struct signal_struct, real_timer);
@@ -235,7 +235,7 @@ again:
235 timeval_to_ktime(value->it_interval); 235 timeval_to_ktime(value->it_interval);
236 expires = timeval_to_ktime(value->it_value); 236 expires = timeval_to_ktime(value->it_value);
237 if (expires.tv64 != 0) 237 if (expires.tv64 != 0)
238 hrtimer_start(timer, expires, HRTIMER_REL); 238 hrtimer_start(timer, expires, HRTIMER_MODE_REL);
239 spin_unlock_irq(&tsk->sighand->siglock); 239 spin_unlock_irq(&tsk->sighand->siglock);
240 break; 240 break;
241 case ITIMER_VIRTUAL: 241 case ITIMER_VIRTUAL:
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index a1bf61617839..210f462c650e 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -145,7 +145,7 @@ static int common_timer_set(struct k_itimer *, int,
145 struct itimerspec *, struct itimerspec *); 145 struct itimerspec *, struct itimerspec *);
146static int common_timer_del(struct k_itimer *timer); 146static int common_timer_del(struct k_itimer *timer);
147 147
148static int posix_timer_fn(struct hrtimer *data); 148static enum hrtimer_restart posix_timer_fn(struct hrtimer *data);
149 149
150static struct k_itimer *lock_timer(timer_t timer_id, unsigned long *flags); 150static struct k_itimer *lock_timer(timer_t timer_id, unsigned long *flags);
151 151
@@ -334,12 +334,12 @@ EXPORT_SYMBOL_GPL(posix_timer_event);
334 334
335 * This code is for CLOCK_REALTIME* and CLOCK_MONOTONIC* timers. 335 * This code is for CLOCK_REALTIME* and CLOCK_MONOTONIC* timers.
336 */ 336 */
337static int posix_timer_fn(struct hrtimer *timer) 337static enum hrtimer_restart posix_timer_fn(struct hrtimer *timer)
338{ 338{
339 struct k_itimer *timr; 339 struct k_itimer *timr;
340 unsigned long flags; 340 unsigned long flags;
341 int si_private = 0; 341 int si_private = 0;
342 int ret = HRTIMER_NORESTART; 342 enum hrtimer_restart ret = HRTIMER_NORESTART;
343 343
344 timr = container_of(timer, struct k_itimer, it.real.timer); 344 timr = container_of(timer, struct k_itimer, it.real.timer);
345 spin_lock_irqsave(&timr->it_lock, flags); 345 spin_lock_irqsave(&timr->it_lock, flags);
@@ -722,7 +722,7 @@ common_timer_set(struct k_itimer *timr, int flags,
722 if (!new_setting->it_value.tv_sec && !new_setting->it_value.tv_nsec) 722 if (!new_setting->it_value.tv_sec && !new_setting->it_value.tv_nsec)
723 return 0; 723 return 0;
724 724
725 mode = flags & TIMER_ABSTIME ? HRTIMER_ABS : HRTIMER_REL; 725 mode = flags & TIMER_ABSTIME ? HRTIMER_MODE_ABS : HRTIMER_MODE_REL;
726 hrtimer_init(&timr->it.real.timer, timr->it_clock, mode); 726 hrtimer_init(&timr->it.real.timer, timr->it_clock, mode);
727 timr->it.real.timer.function = posix_timer_fn; 727 timr->it.real.timer.function = posix_timer_fn;
728 728
@@ -734,7 +734,7 @@ common_timer_set(struct k_itimer *timr, int flags,
734 /* SIGEV_NONE timers are not queued ! See common_timer_get */ 734 /* SIGEV_NONE timers are not queued ! See common_timer_get */
735 if (((timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE)) { 735 if (((timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE)) {
736 /* Setup correct expiry time for relative timers */ 736 /* Setup correct expiry time for relative timers */
737 if (mode == HRTIMER_REL) 737 if (mode == HRTIMER_MODE_REL)
738 timer->expires = ktime_add(timer->expires, 738 timer->expires = ktime_add(timer->expires,
739 timer->base->get_time()); 739 timer->base->get_time());
740 return 0; 740 return 0;
@@ -950,7 +950,8 @@ static int common_nsleep(const clockid_t which_clock, int flags,
950 struct timespec *tsave, struct timespec __user *rmtp) 950 struct timespec *tsave, struct timespec __user *rmtp)
951{ 951{
952 return hrtimer_nanosleep(tsave, rmtp, flags & TIMER_ABSTIME ? 952 return hrtimer_nanosleep(tsave, rmtp, flags & TIMER_ABSTIME ?
953 HRTIMER_ABS : HRTIMER_REL, which_clock); 953 HRTIMER_MODE_ABS : HRTIMER_MODE_REL,
954 which_clock);
954} 955}
955 956
956asmlinkage long 957asmlinkage long
diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index 4ab17da46fd8..180978cb2f75 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -625,7 +625,7 @@ rt_mutex_slowlock(struct rt_mutex *lock, int state,
625 /* Setup the timer, when timeout != NULL */ 625 /* Setup the timer, when timeout != NULL */
626 if (unlikely(timeout)) 626 if (unlikely(timeout))
627 hrtimer_start(&timeout->timer, timeout->timer.expires, 627 hrtimer_start(&timeout->timer, timeout->timer.expires,
628 HRTIMER_ABS); 628 HRTIMER_MODE_ABS);
629 629
630 for (;;) { 630 for (;;) {
631 /* Try to acquire the lock: */ 631 /* Try to acquire the lock: */