Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/time: Avoid using get_tbl() and get_tbu() internally

get_tbl() is confusing as it returns the content of TBL register
on PPC32 but the concatenation of TBL and TBU on PPC64.

Use mftb() instead.

Do the same with get_tbu() for consistency allthough it's name
is less confusing.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/41573406a4eab98838decaa91649086fef1e6119.1601556145.git.christophe.leroy@csgroup.eu

authored by

Christophe Leroy and committed by
Michael Ellerman
942e8911 ff125fbc

+7 -7
+1 -1
arch/powerpc/include/asm/delay.h
··· 54 54 ({ \ 55 55 typeof(condition) __ret; \ 56 56 unsigned long __loops = tb_ticks_per_usec * timeout; \ 57 - unsigned long __start = get_tbl(); \ 57 + unsigned long __start = mftb(); \ 58 58 \ 59 59 if (delay) { \ 60 60 while (!(__ret = (condition)) && \
+4 -4
arch/powerpc/include/asm/time.h
··· 76 76 unsigned int tbhi, tblo, tbhi2; 77 77 78 78 do { 79 - tbhi = get_tbu(); 80 - tblo = get_tbl(); 81 - tbhi2 = get_tbu(); 79 + tbhi = mftbu(); 80 + tblo = mftb(); 81 + tbhi2 = mftbu(); 82 82 } while (tbhi != tbhi2); 83 83 84 84 return ((u64)tbhi << 32) | tblo; ··· 123 123 124 124 static inline unsigned long tb_ticks_since(unsigned long tstamp) 125 125 { 126 - return get_tbl() - tstamp; 126 + return mftb() - tstamp; 127 127 } 128 128 129 129 #define mulhwu(x,y) \
+2 -2
arch/powerpc/kernel/time.c
··· 448 448 */ 449 449 spin_cpu_relax(); 450 450 } else { 451 - start = get_tbl(); 452 - while (get_tbl() - start < loops) 451 + start = mftb(); 452 + while (mftb() - start < loops) 453 453 spin_cpu_relax(); 454 454 } 455 455 spin_end();