x86/setup: Move duplicate variable definition out of the if/else block
PATCH 1/1 x86/setup: Move duplicate variable definition out of the if/else block
Both the if and else blocks define an exact same boot_cpu_data variable, move the duplicate variable definition out of the if/else block.
In addition, this patch also does some other minor cleanups.
Signed-off-by Yuntao Wang <[email protected]>
--- arch/x86/kernel/e820.c | 4 ++-- arch/x86/kernel/setup.c | 10 ++-------- 2 files changed, 4 insertions(+), 10 deletions(-)
arch/x86/kernel/e820.c +2 -2
@@ -395,7 +395,7 @@ int __init e820__update_table(struct e820_table *table)/* Continue building up new map based on this information: */ if (current_type != last_type ||e820_nomerge (current_type)) { -if (last_type !=0 ) { +if (last_type !=0 ) { new_entries[new_nr_entries].size = change_point[chg_idx]->addr - last_addr;/* Move forward only if the new size was non-zero: */ if (new_entries[new_nr_entries].size !=0 )
@@ -403,7 +403,7 @@ int __init e820__update_table(struct e820_table *table)if (++new_nr_entries >= max_nr_entries)break ; } -if (current_type !=0 ) { +if (current_type !=0 ) { new_entries[new_nr_entries].addr = change_point[chg_idx]->addr; new_entries[new_nr_entries].type = current_type; last_addr = change_point[chg_idx]->addr;
arch/x86/kernel/setup.c +2 -8
@@ -115,11 +115,6 @@ static struct resource bss_resource = {#ifdef CONFIG_X86_32 /* CPU data as detected by the assembly code in head_32.S */ struct cpuinfo_x86 new_cpu_data; - -/* Common CPU data for all CPUs */ -struct cpuinfo_x86 boot_cpu_data__read_mostly ; -EXPORT_SYMBOL (boot_cpu_data); -unsigned int def_to_bigsmp;struct apm_info apm_info;
@@ -133,11 +128,10 @@ EXPORT_SYMBOL(ist_info);struct ist_info ist_info;#endif -#else -struct cpuinfo_x86 boot_cpu_data__read_mostly ; -EXPORT_SYMBOL (boot_cpu_data);#endif +struct cpuinfo_x86 boot_cpu_data__read_mostly ; +EXPORT_SYMBOL (boot_cpu_data);#if !defined(CONFIG_X86_PAE ) || defined(CONFIG_X86_64 )__visible unsigned long mmu_cr4_features__ro_after_init ;
Signature · 1 line
2.36.0
[tip: x86/cleanups] x86/setup: Move duplicate boot_cpu_data definition out of the ifdeffery
The following commit has been merged into the x86/cleanups branch of tip:
The following commit has been merged into the x86/cleanups branch of tip:
Commit-ID: 50c66d7b049ddec095644a005bfe0b28e22c4b02 Gitweb: https://git.kernel.org/tip/50c66d7b049ddec095644a005bfe0b28e22c4b02 Author: Yuntao Wang <[email protected]> AuthorDate: Wed, 01 Jun 2022 20:29:14 +08:00 Committer: Borislav Petkov (AMD) <[email protected]> CommitterDate: Wed, 11 Jan 2023 12:45:16 +01:00
x86/setup: Move duplicate boot_cpu_data definition out of the ifdeffery
Both the if and else blocks define an exact same boot_cpu_data variable, move the duplicate variable definition out of the if/else block.
In addition, do some other minor cleanups.
[ bp: Massage. ]
Signed-off-by Yuntao Wang <[email protected]>
Signed-off-by Borislav Petkov (AMD) <[email protected]>
--- arch/x86/kernel/e820.c | 4 ++-- arch/x86/kernel/setup.c | 10 ++-------- 2 files changed, 4 insertions(+), 10 deletions(-)
arch/x86/kernel/e820.c +2 -2
@@ -395,7 +395,7 @@ int __init e820__update_table(struct e820_table *table)/* Continue building up new map based on this information: */ if (current_type != last_type ||e820_nomerge (current_type)) { -if (last_type !=0 ) { +if (last_type) { new_entries[new_nr_entries].size = change_point[chg_idx]->addr - last_addr;/* Move forward only if the new size was non-zero: */ if (new_entries[new_nr_entries].size !=0 )
@@ -403,7 +403,7 @@ int __init e820__update_table(struct e820_table *table)if (++new_nr_entries >= max_nr_entries)break ; } -if (current_type !=0 ) { +if (current_type) { new_entries[new_nr_entries].addr = change_point[chg_idx]->addr; new_entries[new_nr_entries].type = current_type; last_addr = change_point[chg_idx]->addr;
arch/x86/kernel/setup.c +2 -8
@@ -114,11 +114,6 @@ static struct resource bss_resource = {#ifdef CONFIG_X86_32 /* CPU data as detected by the assembly code in head_32.S */ struct cpuinfo_x86 new_cpu_data; - -/* Common CPU data for all CPUs */ -struct cpuinfo_x86 boot_cpu_data__read_mostly ; -EXPORT_SYMBOL (boot_cpu_data); -unsigned int def_to_bigsmp;struct apm_info apm_info;
@@ -132,11 +127,10 @@ EXPORT_SYMBOL(ist_info);struct ist_info ist_info;#endif -#else -struct cpuinfo_x86 boot_cpu_data__read_mostly ; -EXPORT_SYMBOL (boot_cpu_data);#endif +struct cpuinfo_x86 boot_cpu_data__read_mostly ; +EXPORT_SYMBOL (boot_cpu_data);#if !defined(CONFIG_X86_PAE ) || defined(CONFIG_X86_64 )__visible unsigned long mmu_cr4_features__ro_after_init ;