/* Math helper, returns latch value converted to nanoseconds (bound checked)  */
u64 clockevent_delta2ns(unsigned long latch, struct clock_event_device *evt)
/* Math helper, returns latch value converted to nanoseconds (bound checked)  */
u64 clockevent_delta2ns(unsigned long latch, struct clock_event_device *evt)
{
	u64 clc = (u64) latch << evt->shift;
	if (unlikely(!evt->mult)) {
		evt->mult = 1;
		WARN_ON(1);
	}
	do_div(clc, evt->mult);
	if (clc < 1000)
		clc = 1000;
	if (clc > KTIME_MAX)
		clc = KTIME_MAX;
	return clc;
}