Revert "clocksource/drivers/imx-tpm: Fix return -ETIME when delta exceeds INT_MAX"

This reverts commit 36e2da06de.
This commit is contained in:
Ksawlii 2024-11-24 00:23:37 +01:00
parent 983be60aeb
commit 10e292d1f6

View file

@ -83,10 +83,10 @@ static u64 notrace tpm_read_sched_clock(void)
static int tpm_set_next_event(unsigned long delta, static int tpm_set_next_event(unsigned long delta,
struct clock_event_device *evt) struct clock_event_device *evt)
{ {
unsigned long next, prev, now; unsigned long next, now;
prev = tpm_read_counter(); next = tpm_read_counter();
next = prev + delta; next += delta;
writel(next, timer_base + TPM_C0V); writel(next, timer_base + TPM_C0V);
now = tpm_read_counter(); now = tpm_read_counter();
@ -96,7 +96,7 @@ static int tpm_set_next_event(unsigned long delta,
* of writing CNT registers which may cause the min_delta event got * of writing CNT registers which may cause the min_delta event got
* missed, so we need add a ETIME check here in case it happened. * missed, so we need add a ETIME check here in case it happened.
*/ */
return (now - prev) >= delta ? -ETIME : 0; return (int)(next - now) <= 0 ? -ETIME : 0;
} }
static int tpm_set_state_oneshot(struct clock_event_device *evt) static int tpm_set_state_oneshot(struct clock_event_device *evt)