mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
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: Sven Schnelle <svens@linux.ibm.com> Reviewed-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
65b7c83873
commit
d46484e9db
@@ -192,13 +192,6 @@ static inline unsigned long get_tod_clock_fast(void)
|
||||
asm volatile("stckf %0" : "=Q" (clk) : : "cc");
|
||||
return clk;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@@ -226,6 +219,12 @@ static inline unsigned 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
|
||||
|
||||
Reference in New Issue
Block a user