/* This code is licenced under the GPL version 2. For details see kernel-base/COPYING. tick_program_event internal worker function  */
int tick_dev_program_event(struct clock_event_device *dev, ktime_t expires, int force)
/* This code is licenced under the GPL version 2. For details see kernel-base/COPYING. tick_program_event internal worker function  */
int tick_dev_program_event(struct clock_event_device *dev, ktime_t expires, int force)
{
	ktime_t now = ktime_get();
	int i;
	for (i = 0;;) {
		int ret = clockevents_program_event(dev, expires, now);
		if (!ret || !force)
			return ret;
		if (++i > 2) {
			if (!dev->min_delta_ns)
				dev->min_delta_ns = 5000;
			else
				dev->min_delta_ns += dev->min_delta_ns >> 1;
			printk(KERN_WARNING
			       "CE: %s increasing min_delta_ns to %llu nsec\n",
			       dev->name ? dev->name : "?",
			       (unsigned long long) dev->min_delta_ns << 1);
			i = 0;
		}
		now = ktime_get();
		expires = ktime_add_ns(now, dev->min_delta_ns);
	}
}