aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/time.h
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@csgroup.eu>2020-10-01 10:59:19 +0000
committerMichael Ellerman <mpe@ellerman.id.au>2020-10-08 21:17:14 +1100
commit63f9d9df5ed0d4f3a2c0cd08730e1cae1edd11bf (patch)
tree45d36892745d363c036d159462c6d444abcb1d48 /arch/powerpc/include/asm/time.h
parent6601ec1c2ba929430f5585ce7f9d9960b0e0a01d (diff)
downloadlinux-63f9d9df5ed0d4f3a2c0cd08730e1cae1edd11bf.tar.gz
powerpc/time: Remove ifdef in get_dec() and set_dec()
Move SPRN_PIT definition in reg.h. This allows to remove ifdef in get_dec() and set_dec() and makes them more readable. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/3c9a6eb0fc040868ac59be66f338d08fd017668d.1601549945.git.christophe.leroy@csgroup.eu
Diffstat (limited to 'arch/powerpc/include/asm/time.h')
-rw-r--r--arch/powerpc/include/asm/time.h23
1 files changed, 10 insertions, 13 deletions
diff --git a/arch/powerpc/include/asm/time.h b/arch/powerpc/include/asm/time.h
index 410ed72eef1c..a0c8ae4cb27c 100644
--- a/arch/powerpc/include/asm/time.h
+++ b/arch/powerpc/include/asm/time.h
@@ -100,11 +100,10 @@ static inline void set_tb(unsigned int upper, unsigned int lower)
*/
static inline u64 get_dec(void)
{
-#if defined(CONFIG_40x)
- return (mfspr(SPRN_PIT));
-#else
- return (mfspr(SPRN_DEC));
-#endif
+ if (IS_ENABLED(CONFIG_40x))
+ return mfspr(SPRN_PIT);
+
+ return mfspr(SPRN_DEC);
}
/*
@@ -114,14 +113,12 @@ static inline u64 get_dec(void)
*/
static inline void set_dec(u64 val)
{
-#if defined(CONFIG_40x)
- mtspr(SPRN_PIT, (u32) val);
-#else
-#ifndef CONFIG_BOOKE
- --val;
-#endif
- mtspr(SPRN_DEC, val);
-#endif /* not 40x */
+ if (IS_ENABLED(CONFIG_40x))
+ mtspr(SPRN_PIT, (u32)val);
+ else if (IS_ENABLED(CONFIG_BOOKE))
+ mtspr(SPRN_DEC, val);
+ else
+ mtspr(SPRN_DEC, val - 1);
}
static inline unsigned long tb_ticks_since(unsigned long tstamp)