The __gb_loopback_calc_latency will be useful in later patches. Provide it
here and use as intended. Later on we just want to use the timestamp
rollover detection, so split it out now.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
return lat;
}
+static u64 __gb_loopback_calc_latency(u64 t1, u64 t2)
+{
+ if (t2 > t1)
+ return t2 - t1;
+ else
+ return NSEC_PER_DAY - t2 + t1;
+}
+
static u64 gb_loopback_calc_latency(struct timeval *ts, struct timeval *te)
{
u64 t1, t2;
t1 = timeval_to_ns(ts);
t2 = timeval_to_ns(te);
- if (t2 > t1)
- return t2 - t1;
- else
- return NSEC_PER_DAY - t2 + t1;
+
+ return __gb_loopback_calc_latency(t1, t2);
}
static int gb_loopback_sink(struct gb_loopback *gb, u32 len)