Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2456e855 authored by Thomas Gleixner's avatar Thomas Gleixner
Browse files

ktime: Get rid of the union



ktime is a union because the initial implementation stored the time in
scalar nanoseconds on 64 bit machine and in a endianess optimized timespec
variant for 32bit machines. The Y2038 cleanup removed the timespec variant
and switched everything to scalar nanoseconds. The union remained, but
become completely pointless.

Get rid of the union and just keep ktime_t as simple typedef of type s64.

The conversion was done with coccinelle and some manual mopping up.

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
parent a5a1d1c2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -998,7 +998,7 @@ static int print_wakeup_source_stats(struct seq_file *m,

		active_time = ktime_sub(now, ws->last_time);
		total_time = ktime_add(total_time, active_time);
		if (active_time.tv64 > max_time.tv64)
		if (active_time > max_time)
			max_time = active_time;

		if (ws->autosleep_enabled)
+1 −1
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ static enum hrtimer_restart lirc_rx51_timer_cb(struct hrtimer *timer)

		now = timer->base->get_time();

	} while (hrtimer_get_expires_tv64(timer) < now.tv64);
	} while (hrtimer_get_expires_tv64(timer) < now);

	return HRTIMER_RESTART;
end:
+4 −4
Original line number Diff line number Diff line
@@ -394,8 +394,8 @@ int rtc_initialize_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
	rtc->aie_timer.period = ktime_set(0, 0);

	/* Alarm has to be enabled & in the future for us to enqueue it */
	if (alarm->enabled && (rtc_tm_to_ktime(now).tv64 <
			 rtc->aie_timer.node.expires.tv64)) {
	if (alarm->enabled && (rtc_tm_to_ktime(now) <
			 rtc->aie_timer.node.expires)) {

		rtc->aie_timer.enabled = 1;
		timerqueue_add(&rtc->timerqueue, &rtc->aie_timer.node);
@@ -766,7 +766,7 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer)

	/* Skip over expired timers */
	while (next) {
		if (next->expires.tv64 >= now.tv64)
		if (next->expires >= now)
			break;
		next = timerqueue_iterate_next(next);
	}
@@ -858,7 +858,7 @@ void rtc_timer_do_work(struct work_struct *work)
	__rtc_read_time(rtc, &tm);
	now = rtc_tm_to_ktime(tm);
	while ((next = timerqueue_getnext(&rtc->timerqueue))) {
		if (next->expires.tv64 > now.tv64)
		if (next->expires > now)
			break;

		/* expire timer */
+7 −7
Original line number Diff line number Diff line
@@ -234,8 +234,8 @@ static void ci_otg_add_timer(struct ci_hdrc *ci, enum otg_fsm_timer t)
				ktime_set(timer_sec, timer_nsec));
	ci->enabled_otg_timer_bits |= (1 << t);
	if ((ci->next_otg_timer == NUM_OTG_FSM_TIMERS) ||
			(ci->hr_timeouts[ci->next_otg_timer].tv64 >
						ci->hr_timeouts[t].tv64)) {
			(ci->hr_timeouts[ci->next_otg_timer] >
						ci->hr_timeouts[t])) {
			ci->next_otg_timer = t;
			hrtimer_start_range_ns(&ci->otg_fsm_hrtimer,
					ci->hr_timeouts[t], NSEC_PER_MSEC,
@@ -269,8 +269,8 @@ static void ci_otg_del_timer(struct ci_hdrc *ci, enum otg_fsm_timer t)
			for_each_set_bit(cur_timer, &enabled_timer_bits,
							NUM_OTG_FSM_TIMERS) {
				if ((next_timer == NUM_OTG_FSM_TIMERS) ||
					(ci->hr_timeouts[next_timer].tv64 <
					ci->hr_timeouts[cur_timer].tv64))
					(ci->hr_timeouts[next_timer] <
					 ci->hr_timeouts[cur_timer]))
					next_timer = cur_timer;
			}
		}
@@ -397,14 +397,14 @@ static enum hrtimer_restart ci_otg_hrtimer_func(struct hrtimer *t)

	now = ktime_get();
	for_each_set_bit(cur_timer, &enabled_timer_bits, NUM_OTG_FSM_TIMERS) {
		if (now.tv64 >= ci->hr_timeouts[cur_timer].tv64) {
		if (now >= ci->hr_timeouts[cur_timer]) {
			ci->enabled_otg_timer_bits &= ~(1 << cur_timer);
			if (otg_timer_handlers[cur_timer])
				ret = otg_timer_handlers[cur_timer](ci);
		} else {
			if ((next_timer == NUM_OTG_FSM_TIMERS) ||
				(ci->hr_timeouts[cur_timer].tv64 <
					ci->hr_timeouts[next_timer].tv64))
				(ci->hr_timeouts[cur_timer] <
					ci->hr_timeouts[next_timer]))
				next_timer = cur_timer;
		}
	}
+1 −1
Original line number Diff line number Diff line
@@ -425,7 +425,7 @@ static enum hrtimer_restart ehci_hrtimer_func(struct hrtimer *t)
	 */
	now = ktime_get();
	for_each_set_bit(e, &events, EHCI_HRTIMER_NUM_EVENTS) {
		if (now.tv64 >= ehci->hr_timeouts[e].tv64)
		if (now >= ehci->hr_timeouts[e])
			event_handlers[e](ehci);
		else
			ehci_enable_event(ehci, e, false);
Loading