Skip to content

Commit 942e891

Browse files
chleroympe
authored andcommitted
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
1 parent ff125fb commit 942e891

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

arch/powerpc/include/asm/delay.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ extern void udelay(unsigned long usecs);
5454
({ \
5555
typeof(condition) __ret; \
5656
unsigned long __loops = tb_ticks_per_usec * timeout; \
57-
unsigned long __start = get_tbl(); \
57+
unsigned long __start = mftb(); \
5858
\
5959
if (delay) { \
6060
while (!(__ret = (condition)) && \

arch/powerpc/include/asm/time.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ static inline u64 get_tb(void)
7676
unsigned int tbhi, tblo, tbhi2;
7777

7878
do {
79-
tbhi = get_tbu();
80-
tblo = get_tbl();
81-
tbhi2 = get_tbu();
79+
tbhi = mftbu();
80+
tblo = mftb();
81+
tbhi2 = mftbu();
8282
} while (tbhi != tbhi2);
8383

8484
return ((u64)tbhi << 32) | tblo;
@@ -123,7 +123,7 @@ static inline void set_dec(u64 val)
123123

124124
static inline unsigned long tb_ticks_since(unsigned long tstamp)
125125
{
126-
return get_tbl() - tstamp;
126+
return mftb() - tstamp;
127127
}
128128

129129
#define mulhwu(x,y) \

arch/powerpc/kernel/time.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,8 @@ void __delay(unsigned long loops)
448448
*/
449449
spin_cpu_relax();
450450
} else {
451-
start = get_tbl();
452-
while (get_tbl() - start < loops)
451+
start = mftb();
452+
while (mftb() - start < loops)
453453
spin_cpu_relax();
454454
}
455455
spin_end();

0 commit comments

Comments
 (0)