]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - kernel/hrtimer.c
sis190: remove needless MII reset
[linux-2.6-omap-h63xx.git] / kernel / hrtimer.c
index c2893af9479e6812e33ae14f97fac7f9a4b8afd7..c642ef75069f28f4b230bea197dcbf86e3ea4b95 100644 (file)
@@ -442,6 +442,8 @@ static int hrtimer_reprogram(struct hrtimer *timer,
        ktime_t expires = ktime_sub(timer->expires, base->offset);
        int res;
 
+       WARN_ON_ONCE(timer->expires.tv64 < 0);
+
        /*
         * When the callback is running, we do not reprogram the clock event
         * device. The timer callback is either running on a different CPU or
@@ -452,6 +454,15 @@ static int hrtimer_reprogram(struct hrtimer *timer,
        if (hrtimer_callback_running(timer))
                return 0;
 
+       /*
+        * CLOCK_REALTIME timer might be requested with an absolute
+        * expiry time which is less than base->offset. Nothing wrong
+        * about that, just avoid to call into the tick code, which
+        * has now objections against negative expiry values.
+        */
+       if (expires.tv64 < 0)
+               return -ETIME;
+
        if (expires.tv64 >= expires_next->tv64)
                return 0;
 
@@ -1343,13 +1354,13 @@ long __sched hrtimer_nanosleep_restart(struct restart_block *restart)
        struct hrtimer_sleeper t;
        struct timespec __user  *rmtp;
 
-       hrtimer_init(&t.timer, restart->arg0, HRTIMER_MODE_ABS);
-       t.timer.expires.tv64 = ((u64)restart->arg3 << 32) | (u64) restart->arg2;
+       hrtimer_init(&t.timer, restart->nanosleep.index, HRTIMER_MODE_ABS);
+       t.timer.expires.tv64 = restart->nanosleep.expires;
 
        if (do_nanosleep(&t, HRTIMER_MODE_ABS))
                return 0;
 
-       rmtp = (struct timespec __user *)restart->arg1;
+       rmtp = restart->nanosleep.rmtp;
        if (rmtp) {
                int ret = update_rmtp(&t.timer, rmtp);
                if (ret <= 0)
@@ -1383,10 +1394,9 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp,
 
        restart = &current_thread_info()->restart_block;
        restart->fn = hrtimer_nanosleep_restart;
-       restart->arg0 = (unsigned long) t.timer.base->index;
-       restart->arg1 = (unsigned long) rmtp;
-       restart->arg2 = t.timer.expires.tv64 & 0xFFFFFFFF;
-       restart->arg3 = t.timer.expires.tv64 >> 32;
+       restart->nanosleep.index = t.timer.base->index;
+       restart->nanosleep.rmtp = rmtp;
+       restart->nanosleep.expires = t.timer.expires.tv64;
 
        return -ERESTART_RESTARTBLOCK;
 }
@@ -1414,7 +1424,6 @@ static void __cpuinit init_hrtimers_cpu(int cpu)
        int i;
 
        spin_lock_init(&cpu_base->lock);
-       lockdep_set_class(&cpu_base->lock, &cpu_base->lock_key);
 
        for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++)
                cpu_base->clock_base[i].cpu_base = cpu_base;
@@ -1455,16 +1464,16 @@ static void migrate_hrtimers(int cpu)
        tick_cancel_sched_timer(cpu);
 
        local_irq_disable();
-       double_spin_lock(&new_base->lock, &old_base->lock,
-                        smp_processor_id() < cpu);
+       spin_lock(&new_base->lock);
+       spin_lock_nested(&old_base->lock, SINGLE_DEPTH_NESTING);
 
        for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) {
                migrate_hrtimer_list(&old_base->clock_base[i],
                                     &new_base->clock_base[i]);
        }
 
-       double_spin_unlock(&new_base->lock, &old_base->lock,
-                          smp_processor_id() < cpu);
+       spin_unlock(&old_base->lock);
+       spin_unlock(&new_base->lock);
        local_irq_enable();
        put_cpu_var(hrtimer_bases);
 }