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

Commit 92d523fa authored by Sven Schnelle's avatar Sven Schnelle Committed by Greg Kroah-Hartman
Browse files

s390/time: Use monotonic clock in get_cycles()



[ Upstream commit 09e7e29d2b49ba84bcefb3dc1657726d2de5bb24 ]

Otherwise the code might not work correctly when the clock
is changed.

Signed-off-by: default avatarSven Schnelle <svens@linux.ibm.com>
Reviewed-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 79d464ed
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -172,13 +172,6 @@ static inline unsigned long long get_tod_clock_fast(void)
	return get_tod_clock();
#endif
}

static inline cycles_t get_cycles(void)
{
	return (cycles_t) get_tod_clock() >> 2;
}
#define get_cycles get_cycles

int get_phys_clock(unsigned long *clock);
void init_cpu_timer(void);
unsigned long long monotonic_clock(void);
@@ -202,6 +195,12 @@ static inline unsigned long long get_tod_clock_monotonic(void)
	return tod;
}

static inline cycles_t get_cycles(void)
{
	return (cycles_t)get_tod_clock_monotonic() >> 2;
}
#define get_cycles get_cycles

/**
 * tod_to_ns - convert a TOD format value to nanoseconds
 * @todval: to be converted TOD format value