Commit 6d9b757c authored by Thomas Gleixner's avatar Thomas Gleixner Committed by John Stultz

misc: ioc4: Use ktime_get_ns()

Replace the ever recurring:
        ts = ktime_get_ts();
        ns = timespec_to_ns(&ts);
with
        ns = ktime_get_ns();
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
parent 154adc14
...@@ -145,7 +145,6 @@ ioc4_clock_calibrate(struct ioc4_driver_data *idd) ...@@ -145,7 +145,6 @@ ioc4_clock_calibrate(struct ioc4_driver_data *idd)
union ioc4_int_out int_out; union ioc4_int_out int_out;
union ioc4_gpcr gpcr; union ioc4_gpcr gpcr;
unsigned int state, last_state = 1; unsigned int state, last_state = 1;
struct timespec start_ts, end_ts;
uint64_t start, end, period; uint64_t start, end, period;
unsigned int count = 0; unsigned int count = 0;
...@@ -174,10 +173,10 @@ ioc4_clock_calibrate(struct ioc4_driver_data *idd) ...@@ -174,10 +173,10 @@ ioc4_clock_calibrate(struct ioc4_driver_data *idd)
if (!last_state && state) { if (!last_state && state) {
count++; count++;
if (count == IOC4_CALIBRATE_END) { if (count == IOC4_CALIBRATE_END) {
ktime_get_ts(&end_ts); end = ktime_get_ns();
break; break;
} else if (count == IOC4_CALIBRATE_DISCARD) } else if (count == IOC4_CALIBRATE_DISCARD)
ktime_get_ts(&start_ts); start = ktime_get_ns();
} }
last_state = state; last_state = state;
} while (1); } while (1);
...@@ -192,8 +191,6 @@ ioc4_clock_calibrate(struct ioc4_driver_data *idd) ...@@ -192,8 +191,6 @@ ioc4_clock_calibrate(struct ioc4_driver_data *idd)
* by which the IOC4 generates the square wave, to get the * by which the IOC4 generates the square wave, to get the
* period of an IOC4 INT_OUT count. * period of an IOC4 INT_OUT count.
*/ */
end = end_ts.tv_sec * NSEC_PER_SEC + end_ts.tv_nsec;
start = start_ts.tv_sec * NSEC_PER_SEC + start_ts.tv_nsec;
period = (end - start) / period = (end - start) /
(IOC4_CALIBRATE_CYCLES * 2 * (IOC4_CALIBRATE_COUNT + 1)); (IOC4_CALIBRATE_CYCLES * 2 * (IOC4_CALIBRATE_COUNT + 1));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment