Start using ktime_* compare functions to make the code backportable.
Now that may be a bit tricky due to recent change of ktime_t.

Signed-off-by: Mariusz Skamra <mariuszx.ska...@intel.com>
Acked-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppusw...@intel.com>
---
 drivers/usb/chipidea/otg_fsm.c | 8 ++++----
 drivers/usb/host/ehci-timer.c  | 2 +-
 drivers/usb/host/fotg210-hcd.c | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
index 93e24ce..949183e 100644
--- a/drivers/usb/chipidea/otg_fsm.c
+++ b/drivers/usb/chipidea/otg_fsm.c
@@ -234,7 +234,7 @@ static void ci_otg_add_timer(struct ci_hdrc *ci, enum 
otg_fsm_timer t)
                                ktime_set(timer_sec, timer_nsec));
        ci->enabled_otg_timer_bits |= (1 << t);
        if ((ci->next_otg_timer == NUM_OTG_FSM_TIMERS) ||
-                       (ci->hr_timeouts[ci->next_otg_timer] >
+                       ktime_after(ci->hr_timeouts[ci->next_otg_timer],
                                                ci->hr_timeouts[t])) {
                        ci->next_otg_timer = t;
                        hrtimer_start_range_ns(&ci->otg_fsm_hrtimer,
@@ -269,7 +269,7 @@ static void ci_otg_del_timer(struct ci_hdrc *ci, enum 
otg_fsm_timer t)
                        for_each_set_bit(cur_timer, &enabled_timer_bits,
                                                        NUM_OTG_FSM_TIMERS) {
                                if ((next_timer == NUM_OTG_FSM_TIMERS) ||
-                                       (ci->hr_timeouts[next_timer] <
+                                       
ktime_before(ci->hr_timeouts[next_timer],
                                         ci->hr_timeouts[cur_timer]))
                                        next_timer = cur_timer;
                        }
@@ -397,13 +397,13 @@ static enum hrtimer_restart ci_otg_hrtimer_func(struct 
hrtimer *t)
 
        now = ktime_get();
        for_each_set_bit(cur_timer, &enabled_timer_bits, NUM_OTG_FSM_TIMERS) {
-               if (now >= ci->hr_timeouts[cur_timer]) {
+               if (ktime_compare(now, ci->hr_timeouts[cur_timer]) >= 0) {
                        ci->enabled_otg_timer_bits &= ~(1 << cur_timer);
                        if (otg_timer_handlers[cur_timer])
                                ret = otg_timer_handlers[cur_timer](ci);
                } else {
                        if ((next_timer == NUM_OTG_FSM_TIMERS) ||
-                               (ci->hr_timeouts[cur_timer] <
+                               ktime_before(ci->hr_timeouts[cur_timer],
                                        ci->hr_timeouts[next_timer]))
                                next_timer = cur_timer;
                }
diff --git a/drivers/usb/host/ehci-timer.c b/drivers/usb/host/ehci-timer.c
index 3893b5b..0b6cdb7 100644
--- a/drivers/usb/host/ehci-timer.c
+++ b/drivers/usb/host/ehci-timer.c
@@ -424,7 +424,7 @@ static enum hrtimer_restart ehci_hrtimer_func(struct 
hrtimer *t)
         */
        now = ktime_get();
        for_each_set_bit(e, &events, EHCI_HRTIMER_NUM_EVENTS) {
-               if (now >= ehci->hr_timeouts[e])
+               if (ktime_compare(now, ehci->hr_timeouts[e]) >= 0)
                        event_handlers[e](ehci);
                else
                        ehci_enable_event(ehci, e, false);
diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
index ced08dc..457cc65 100644
--- a/drivers/usb/host/fotg210-hcd.c
+++ b/drivers/usb/host/fotg210-hcd.c
@@ -1380,7 +1380,7 @@ static enum hrtimer_restart fotg210_hrtimer_func(struct 
hrtimer *t)
         */
        now = ktime_get();
        for_each_set_bit(e, &events, FOTG210_HRTIMER_NUM_EVENTS) {
-               if (now >= fotg210->hr_timeouts[e])
+               if (ktime_compare(now, fotg210->hr_timeouts[e]) >= 0)
                        event_handlers[e](fotg210);
                else
                        fotg210_enable_event(fotg210, e, false);
-- 
2.1.4

--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial 
Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | 
Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i 
moze zawierac informacje poufne. W razie przypadkowego otrzymania tej 
wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; 
jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole 
use of the intended recipient(s). If you are not the intended recipient, please 
contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to