[packages] zaptel-1.4.x: fix compilation with linux 2.6.28+

git-svn-id: svn://svn.openwrt.org/openwrt/packages@15415 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nico 2009-04-25 23:45:16 +00:00
parent 98a7f47eae
commit edbeb47551

View File

@ -0,0 +1,48 @@
--- a/kernel/ztdummy.c
+++ b/kernel/ztdummy.c
@@ -55,7 +55,7 @@
* the #define USE_RTC should be commented out.
*/
#if defined(__i386__) || defined(__x86_64__)
-#if LINUX_VERSION_CODE >= VERSION_CODE(2,6,13)
+#if LINUX_VERSION_CODE >= VERSION_CODE(2,6,15)
/* The symbol hrtimer_forward is only exported as of 2.6.22: */
#if defined(CONFIG_HIGH_RES_TIMERS) && LINUX_VERSION_CODE >= VERSION_CODE(2,6,22)
#define USE_HIGHRESTIMER
@@ -91,6 +91,18 @@
#endif
#include "ztdummy.h"
+#if defined(USE_HIGHRESTIMER) && ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) )
+/* compatibility with new hrtimer interface */
+static inline ktime_t hrtimer_get_expires(const struct hrtimer *timer)
+{
+ return timer->expires;
+}
+
+static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time)
+{
+ timer->expires = time;
+}
+#endif
static struct ztdummy *ztd;
@@ -200,7 +212,7 @@ static enum hrtimer_restart ztdummy_hr_i
* expired.
* We should worry if overrun is 2 or more; then we really missed
* a tick */
- overrun = hrtimer_forward(&zaptimer, htmr->expires,
+ overrun = hrtimer_forward(&zaptimer, hrtimer_get_expires(htmr),
ktime_set(0, ZAPTEL_TIME_NS));
if(overrun > 1) {
if(printk_ratelimit())
@@ -223,7 +235,7 @@ static enum hrtimer_restart ztdummy_hr_i
/* use kernel system tick timer if PC architecture RTC is not available */
static void ztdummy_timer(unsigned long param)
{
- timer.expires = jiffies + 1;
+ hrtimer_set_expires(timer, jiffies + 1);
add_timer(&timer);
ztd->counter += ZAPTEL_TIME;