On Fri, Apr 10, 2026 at 02:20:55PM +0200, Thomas Gleixner wrote: > The only remaining non-architecture usage of get_cycles() is to provide > random_get_entropy(). > > Switch openrisc over to the new scheme of selecting ARCH_HAS_RANDOM_ENTROPY > and providing random_get_entropy() in asm/random.h. > > Add 'asm/timex.h' includes to the relevant files, so the global include can > be removed once all architectures are converted over. > > Signed-off-by: Thomas Gleixner <[email protected]> > Cc: Jonas Bonn <[email protected]> > Cc: [email protected]
This looks good to me. Acked-by: Stafford Horne <[email protected]> > --- > arch/openrisc/Kconfig | 1 + > arch/openrisc/include/asm/random.h | 12 ++++++++++++ > arch/openrisc/include/asm/timex.h | 5 ----- > arch/openrisc/lib/delay.c | 1 + > 4 files changed, 14 insertions(+), 5 deletions(-) > > --- a/arch/openrisc/Kconfig > +++ b/arch/openrisc/Kconfig > @@ -10,6 +10,7 @@ config OPENRISC > select ARCH_HAS_DELAY_TIMER > select ARCH_HAS_DMA_SET_UNCACHED > select ARCH_HAS_DMA_CLEAR_UNCACHED > + select ARCH_HAS_RANDOM_ENTROPY > select ARCH_HAS_SYNC_DMA_FOR_DEVICE > select GENERIC_BUILTIN_DTB > select COMMON_CLK > --- /dev/null > +++ b/arch/openrisc/include/asm/random.h > @@ -0,0 +1,12 @@ > +/* SPDX-License-Identifier: GPL-2.0-or-later */ > +#ifndef __ASM_OPENRISC_RANDOM_H > +#define __ASM_OPENRISC_RANDOM_H > + > +#include <asm/timex.h> > + > +static inline unsigned long random_get_entropy(void) > +{ > + return get_cycles(); > +} > + > +#endif > --- a/arch/openrisc/include/asm/timex.h > +++ b/arch/openrisc/include/asm/timex.h > @@ -9,13 +9,9 @@ > * OpenRISC implementation: > * Copyright (C) 2010-2011 Jonas Bonn <[email protected]> > */ > - > #ifndef __ASM_OPENRISC_TIMEX_H > #define __ASM_OPENRISC_TIMEX_H > > -#define get_cycles get_cycles > - > -#include <asm-generic/timex.h> > #include <asm/spr.h> > #include <asm/spr_defs.h> > > @@ -23,6 +19,5 @@ static inline cycles_t get_cycles(void) > { > return mfspr(SPR_TTCR); > } > -#define get_cycles get_cycles > > #endif > --- a/arch/openrisc/lib/delay.c > +++ b/arch/openrisc/lib/delay.c > @@ -18,6 +18,7 @@ > #include <linux/init.h> > > #include <asm/param.h> > +#include <asm/timex.h> > #include <asm/processor.h> > > bool delay_read_timer(unsigned long *timer_value) > >

