[patch 38/38] treewide: Remove asm/timex.h includes from generic code
Thomas Gleixner
tglx at kernel.org
Fri Apr 10 22:21:32 AEST 2026
asm/timex.h does not provide any functionality for non-architecture code
anymore.
Remove the asm-generic fallback and all references in include and source
files along with the random_get_entropy() #ifdeffery in timex.h.
Signed-off-by: Thomas Gleixner <tglx at kernel.org>
---
include/asm-generic/Kbuild | 1 -
include/asm-generic/timex.h | 15 ---------------
include/linux/random.h | 3 +++
include/linux/timex.h | 26 --------------------------
kernel/time/timer.c | 1 -
lib/interval_tree_test.c | 1 -
lib/rbtree_test.c | 1 -
7 files changed, 3 insertions(+), 45 deletions(-)
--- a/include/asm-generic/Kbuild
+++ b/include/asm-generic/Kbuild
@@ -56,7 +56,6 @@ mandatory-y += shmparam.h
mandatory-y += simd.h
mandatory-y += softirq_stack.h
mandatory-y += switch_to.h
-mandatory-y += timex.h
mandatory-y += tlbflush.h
mandatory-y += topology.h
mandatory-y += trace_clock.h
--- a/include/asm-generic/timex.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __ASM_GENERIC_TIMEX_H
-#define __ASM_GENERIC_TIMEX_H
-
-/*
- * If you have a cycle counter, return the value here.
- */
-#ifndef get_cycles
-static inline cycles_t get_cycles(void)
-{
- return 0;
-}
-#endif
-
-#endif /* __ASM_GENERIC_TIMEX_H */
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -1,3 +1,4 @@
+
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _LINUX_RANDOM_H
@@ -152,6 +153,8 @@ unsigned long random_get_entropy_fallbac
*/
#ifdef CONFIG_ARCH_HAS_RANDOM_ENTROPY
#include <asm/random.h>
+#else
+#define random_get_entropy() random_get_entropy_fallback()
#endif
#endif /* _LINUX_RANDOM_H */
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -62,32 +62,6 @@
#include <linux/types.h>
#include <linux/param.h>
-unsigned long random_get_entropy_fallback(void);
-
-#include <asm/timex.h>
-
-#ifndef CONFIG_ARCH_HAS_RANDOM_ENTROPY
-#ifndef random_get_entropy
-/*
- * The random_get_entropy() function is used by the /dev/random driver
- * in order to extract entropy via the relative unpredictability of
- * when an interrupt takes places versus a high speed, fine-grained
- * timing source or cycle counter. Since it will be occurred on every
- * single interrupt, it must have a very low cost/overhead.
- *
- * By default we use get_cycles() for this purpose, but individual
- * architectures may override this in their asm/timex.h header file.
- * If a given arch does not have get_cycles(), then we fallback to
- * using random_get_entropy_fallback().
- */
-#ifdef get_cycles
-#define random_get_entropy() ((unsigned long)get_cycles())
-#else
-#define random_get_entropy() random_get_entropy_fallback()
-#endif
-#endif
-#endif
-
/*
* SHIFT_PLL is used as a dampening factor to define how much we
* adjust the frequency correction for a given offset in PLL mode.
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -48,7 +48,6 @@
#include <linux/uaccess.h>
#include <asm/unistd.h>
#include <asm/div64.h>
-#include <asm/timex.h>
#include <asm/io.h>
#include "tick-internal.h"
--- a/lib/interval_tree_test.c
+++ b/lib/interval_tree_test.c
@@ -4,7 +4,6 @@
#include <linux/interval_tree.h>
#include <linux/prandom.h>
#include <linux/slab.h>
-#include <asm/timex.h>
#include <linux/bitmap.h>
#include <linux/maple_tree.h>
--- a/lib/rbtree_test.c
+++ b/lib/rbtree_test.c
@@ -4,7 +4,6 @@
#include <linux/rbtree_augmented.h>
#include <linux/prandom.h>
#include <linux/slab.h>
-#include <asm/timex.h>
#define __param(type, name, init, msg) \
static type name = init; \
More information about the Linuxppc-dev
mailing list