aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/input/touchscreen/ads7846.c11
-rw-r--r--include/linux/hrtimer.h20
-rw-r--r--include/linux/timer.h2
-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
9 files changed, 40 insertions, 34 deletions
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index cd251efda410..0a26e0663542 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -546,7 +546,7 @@ static void ads7846_rx(void *ads)
546 ts->spi->dev.bus_id, ts->tc.ignore, Rt); 546 ts->spi->dev.bus_id, ts->tc.ignore, Rt);
547#endif 547#endif
548 hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_PERIOD), 548 hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_PERIOD),
549 HRTIMER_REL); 549 HRTIMER_MODE_REL);
550 return; 550 return;
551 } 551 }
552 552
@@ -578,7 +578,8 @@ static void ads7846_rx(void *ads)
578#endif 578#endif
579 } 579 }
580 580
581 hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_PERIOD), HRTIMER_REL); 581 hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_PERIOD),
582 HRTIMER_MODE_REL);
582} 583}
583 584
584static int ads7846_debounce(void *ads, int data_idx, int *val) 585static int ads7846_debounce(void *ads, int data_idx, int *val)
@@ -667,7 +668,7 @@ static void ads7846_rx_val(void *ads)
667 status); 668 status);
668} 669}
669 670
670static int ads7846_timer(struct hrtimer *handle) 671static enum hrtimer_restart ads7846_timer(struct hrtimer *handle)
671{ 672{
672 struct ads7846 *ts = container_of(handle, struct ads7846, timer); 673 struct ads7846 *ts = container_of(handle, struct ads7846, timer);
673 int status = 0; 674 int status = 0;
@@ -724,7 +725,7 @@ static irqreturn_t ads7846_irq(int irq, void *handle)
724 disable_irq(ts->spi->irq); 725 disable_irq(ts->spi->irq);
725 ts->pending = 1; 726 ts->pending = 1;
726 hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_DELAY), 727 hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_DELAY),
727 HRTIMER_REL); 728 HRTIMER_MODE_REL);
728 } 729 }
729 } 730 }
730 spin_unlock_irqrestore(&ts->lock, flags); 731 spin_unlock_irqrestore(&ts->lock, flags);
@@ -862,7 +863,7 @@ static int __devinit ads7846_probe(struct spi_device *spi)
862 ts->spi = spi; 863 ts->spi = spi;
863 ts->input = input_dev; 864 ts->input = input_dev;
864 865
865 hrtimer_init(&ts->timer, CLOCK_MONOTONIC, HRTIMER_REL); 866 hrtimer_init(&ts->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
866 ts->timer.function = ads7846_timer; 867 ts->timer.function = ads7846_timer;
867 868
868 spin_lock_init(&ts->lock); 869 spin_lock_init(&ts->lock);
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 660d91dea78c..44c7d280b1a5 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -25,17 +25,18 @@
25 * Mode arguments of xxx_hrtimer functions: 25 * Mode arguments of xxx_hrtimer functions:
26 */ 26 */
27enum hrtimer_mode { 27enum hrtimer_mode {
28 HRTIMER_ABS, /* Time value is absolute */ 28 HRTIMER_MODE_ABS, /* Time value is absolute */
29 HRTIMER_REL, /* Time value is relative to now */ 29 HRTIMER_MODE_REL, /* Time value is relative to now */
30}; 30};
31 31
32/*
33 * Return values for the callback function
34 */
32enum hrtimer_restart { 35enum hrtimer_restart {
33 HRTIMER_NORESTART, 36 HRTIMER_NORESTART, /* Timer is not restarted */
34 HRTIMER_RESTART, 37 HRTIMER_RESTART, /* Timer must be restarted */
35}; 38};
36 39
37#define HRTIMER_INACTIVE ((void *)1UL)
38
39struct hrtimer_base; 40struct hrtimer_base;
40 41
41/** 42/**
@@ -52,7 +53,7 @@ struct hrtimer_base;
52struct hrtimer { 53struct hrtimer {
53 struct rb_node node; 54 struct rb_node node;
54 ktime_t expires; 55 ktime_t expires;
55 int (*function)(struct hrtimer *); 56 enum hrtimer_restart (*function)(struct hrtimer *);
56 struct hrtimer_base *base; 57 struct hrtimer_base *base;
57}; 58};
58 59
@@ -114,7 +115,10 @@ extern int hrtimer_start(struct hrtimer *timer, ktime_t tim,
114extern int hrtimer_cancel(struct hrtimer *timer); 115extern int hrtimer_cancel(struct hrtimer *timer);
115extern int hrtimer_try_to_cancel(struct hrtimer *timer); 116extern int hrtimer_try_to_cancel(struct hrtimer *timer);
116 117
117#define hrtimer_restart(timer) hrtimer_start((timer), (timer)->expires, HRTIMER_ABS) 118static inline int hrtimer_restart(struct hrtimer *timer)
119{
120 return hrtimer_start(timer, timer->expires, HRTIMER_MODE_ABS);
121}
118 122
119/* Query timers: */ 123/* Query timers: */
120extern ktime_t hrtimer_get_remaining(const struct hrtimer *timer); 124extern ktime_t hrtimer_get_remaining(const struct hrtimer *timer);
diff --git a/include/linux/timer.h b/include/linux/timer.h
index bd0af324fd48..44d41e9d7818 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -106,7 +106,7 @@ static inline void add_timer(struct timer_list *timer)
106extern void init_timers(void); 106extern void init_timers(void);
107extern void run_local_timers(void); 107extern void run_local_timers(void);
108struct hrtimer; 108struct hrtimer;
109extern int it_real_fn(struct hrtimer *); 109extern enum hrtimer_restart it_real_fn(struct hrtimer *);
110 110
111unsigned long __round_jiffies(unsigned long j, int cpu); 111unsigned long __round_jiffies(unsigned long j, int cpu);
112unsigned long __round_jiffies_relative(unsigned long j, int cpu); 112unsigned long __round_jiffies_relative(unsigned long j, int cpu);
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: */