aboutsummaryrefslogtreecommitdiffstats
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
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>
-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)