Commit 7c985351 authored by Bryan O'Donoghue's avatar Bryan O'Donoghue Committed by Greg Kroah-Hartman

greybus: loopback: functionally decompose gb_loopback_calc_latency

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: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent bd416103
......@@ -292,16 +292,22 @@ static u32 gb_loopback_nsec_to_usec_latency(u64 elapsed_nsecs)
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)
......
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