diff options
author | Mariusz Skamra <mariuszx.skamra@intel.com> | 2017-05-26 12:15:59 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-06-03 11:08:04 +0200 |
commit | fa72e6afa795dbb35d0cc6332606e83e4415e45e (patch) | |
tree | 53092ad9c42474e38982c96adb4b12b2abe5a26a /drivers/usb/chipidea | |
parent | usb: typec: Add a sysfs node to manage port type (diff) | |
download | linux-fa72e6afa795dbb35d0cc6332606e83e4415e45e.tar.xz linux-fa72e6afa795dbb35d0cc6332606e83e4415e45e.zip |
usb: Make use of ktime_* comparison functions
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.skamra@intel.com>
Acked-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/chipidea')
-rw-r--r-- | drivers/usb/chipidea/otg_fsm.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 93e24ce61a3a..949183ede16f 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; } |