pkt_sched: use ns_to_ktime() helper
authorEric Dumazet <edumazet@google.com>
Sat, 20 Oct 2012 00:40:51 +0000 (00:40 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 22 Oct 2012 02:21:27 +0000 (22:21 -0400)
ns_to_ktime() seems better than ktime_set() + ktime_add_ns()

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_api.c
net/sched/sch_cbq.c

index a18d975db59cea34eb0558490deb800f24c10d22..13cc744a24981ea4ce8d9ebe2c7d321ed3e2ebfa 100644 (file)
@@ -495,16 +495,15 @@ EXPORT_SYMBOL(qdisc_watchdog_init);
 
 void qdisc_watchdog_schedule(struct qdisc_watchdog *wd, psched_time_t expires)
 {
-       ktime_t time;
-
        if (test_bit(__QDISC_STATE_DEACTIVATED,
                     &qdisc_root_sleeping(wd->qdisc)->state))
                return;
 
        qdisc_throttled(wd->qdisc);
-       time = ktime_set(0, 0);
-       time = ktime_add_ns(time, PSCHED_TICKS2NS(expires));
-       hrtimer_start(&wd->timer, time, HRTIMER_MODE_ABS);
+
+       hrtimer_start(&wd->timer,
+                     ns_to_ktime(PSCHED_TICKS2NS(expires)),
+                     HRTIMER_MODE_ABS);
 }
 EXPORT_SYMBOL(qdisc_watchdog_schedule);
 
index 564b9fc8efd3c8778ef8ba155cf17f79d92a9a80..0e19948470b88ce8dff6c3e1cded52a6121fe7ea 100644 (file)
@@ -509,8 +509,7 @@ static void cbq_ovl_delay(struct cbq_class *cl)
                        cl->cpriority = TC_CBQ_MAXPRIO;
                        q->pmask |= (1<<TC_CBQ_MAXPRIO);
 
-                       expires = ktime_set(0, 0);
-                       expires = ktime_add_ns(expires, PSCHED_TICKS2NS(sched));
+                       expires = ns_to_ktime(PSCHED_TICKS2NS(sched));
                        if (hrtimer_try_to_cancel(&q->delay_timer) &&
                            ktime_to_ns(ktime_sub(
                                        hrtimer_get_expires(&q->delay_timer),