[packages] zaptel-1.4.x: fix compilation with linux 2.6.28+
[openwrt/svn-archive/archive.git] / libs / zaptel-1.4.x / patches / 002-upstream_hrtimer.patch
1 --- a/kernel/ztdummy.c
2 +++ b/kernel/ztdummy.c
3 @@ -55,7 +55,7 @@
4 * the #define USE_RTC should be commented out.
5 */
6 #if defined(__i386__) || defined(__x86_64__)
7 -#if LINUX_VERSION_CODE >= VERSION_CODE(2,6,13)
8 +#if LINUX_VERSION_CODE >= VERSION_CODE(2,6,15)
9 /* The symbol hrtimer_forward is only exported as of 2.6.22: */
10 #if defined(CONFIG_HIGH_RES_TIMERS) && LINUX_VERSION_CODE >= VERSION_CODE(2,6,22)
11 #define USE_HIGHRESTIMER
12 @@ -91,6 +91,18 @@
13 #endif
14 #include "ztdummy.h"
15
16 +#if defined(USE_HIGHRESTIMER) && ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) )
17 +/* compatibility with new hrtimer interface */
18 +static inline ktime_t hrtimer_get_expires(const struct hrtimer *timer)
19 +{
20 + return timer->expires;
21 +}
22 +
23 +static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time)
24 +{
25 + timer->expires = time;
26 +}
27 +#endif
28
29 static struct ztdummy *ztd;
30
31 @@ -200,7 +212,7 @@ static enum hrtimer_restart ztdummy_hr_i
32 * expired.
33 * We should worry if overrun is 2 or more; then we really missed
34 * a tick */
35 - overrun = hrtimer_forward(&zaptimer, htmr->expires,
36 + overrun = hrtimer_forward(&zaptimer, hrtimer_get_expires(htmr),
37 ktime_set(0, ZAPTEL_TIME_NS));
38 if(overrun > 1) {
39 if(printk_ratelimit())
40 @@ -223,7 +235,7 @@ static enum hrtimer_restart ztdummy_hr_i
41 /* use kernel system tick timer if PC architecture RTC is not available */
42 static void ztdummy_timer(unsigned long param)
43 {
44 - timer.expires = jiffies + 1;
45 + hrtimer_set_expires(timer, jiffies + 1);
46 add_timer(&timer);
47
48 ztd->counter += ZAPTEL_TIME;