Optimize the parisc_requires_coherency() macro to use a static branch. Signed-off-by: Helge Deller <deller@xxxxxx> --- arch/parisc/include/asm/processor.h | 5 +++-- arch/parisc/kernel/processor.c | 7 +++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/parisc/include/asm/processor.h b/arch/parisc/include/asm/processor.h index 006364212795..9fc80a77b46a 100644 --- a/arch/parisc/include/asm/processor.h +++ b/arch/parisc/include/asm/processor.h @@ -11,6 +11,7 @@ #ifndef __ASSEMBLY__ #include <linux/threads.h> +#include <linux/jump_label.h> #include <asm/assembly.h> #include <asm/prefetch.h> @@ -281,8 +282,8 @@ extern unsigned long __get_wchan(struct task_struct *p); * with different data, whether clean or not) to operate */ #ifdef CONFIG_PA8X00 -extern int _parisc_requires_coherency; -#define parisc_requires_coherency() _parisc_requires_coherency +DECLARE_STATIC_KEY_TRUE(_parisc_requires_coherency); +#define parisc_requires_coherency() static_branch_likely(&_parisc_requires_coherency) #else #define parisc_requires_coherency() (0) #endif diff --git a/arch/parisc/kernel/processor.c b/arch/parisc/kernel/processor.c index 1b6129e7d776..ccaf075d0750 100644 --- a/arch/parisc/kernel/processor.c +++ b/arch/parisc/kernel/processor.c @@ -32,8 +32,7 @@ struct system_cpuinfo_parisc boot_cpu_data __ro_after_init; EXPORT_SYMBOL(boot_cpu_data); #ifdef CONFIG_PA8X00 -int _parisc_requires_coherency __ro_after_init; -EXPORT_SYMBOL(_parisc_requires_coherency); +DEFINE_STATIC_KEY_TRUE(_parisc_requires_coherency); #endif DEFINE_PER_CPU(struct cpuinfo_parisc, cpu_data); @@ -284,8 +283,8 @@ void __init collect_boot_cpu_data(void) boot_cpu_data.family_name = cpu_name_version[boot_cpu_data.cpu_type][1]; #ifdef CONFIG_PA8X00 - _parisc_requires_coherency = (boot_cpu_data.cpu_type == mako) || - (boot_cpu_data.cpu_type == mako2); + if ((boot_cpu_data.cpu_type != mako) && (boot_cpu_data.cpu_type != mako2)) + static_branch_disable(&_parisc_requires_coherency); #endif if (pdc_model_platform_info(orig_prod_num, current_prod_num, serial_no) == PDC_OK) { -- 2.35.1