Skip to content

Commit 79093f3

Browse files
SiFiveHollandpalmer-dabbelt
authored andcommitted
riscv: Remove unused members from struct cpu_operations
name is not used anywhere at all. cpu_prepare and cpu_disable do nothing and always return 0 if implemented. Signed-off-by: Samuel Holland <[email protected]> Reviewed-by: Conor Dooley <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent a4166ae commit 79093f3

File tree

8 files changed

+1
-58
lines changed

8 files changed

+1
-58
lines changed

arch/riscv/include/asm/cpu_ops.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,16 @@
1313
/**
1414
* struct cpu_operations - Callback operations for hotplugging CPUs.
1515
*
16-
* @name: Name of the boot protocol.
17-
* @cpu_prepare: Early one-time preparation step for a cpu. If there
18-
* is a mechanism for doing so, tests whether it is
19-
* possible to boot the given HART.
2016
* @cpu_start: Boots a cpu into the kernel.
21-
* @cpu_disable: Prepares a cpu to die. May fail for some
22-
* mechanism-specific reason, which will cause the hot
23-
* unplug to be aborted. Called from the cpu to be killed.
2417
* @cpu_stop: Makes a cpu leave the kernel. Must not fail. Called from
2518
* the cpu being stopped.
2619
* @cpu_is_stopped: Ensures a cpu has left the kernel. Called from another
2720
* cpu.
2821
*/
2922
struct cpu_operations {
30-
const char *name;
31-
int (*cpu_prepare)(unsigned int cpu);
3223
int (*cpu_start)(unsigned int cpu,
3324
struct task_struct *tidle);
3425
#ifdef CONFIG_HOTPLUG_CPU
35-
int (*cpu_disable)(unsigned int cpu);
3626
void (*cpu_stop)(void);
3727
int (*cpu_is_stopped)(unsigned int cpu);
3828
#endif

arch/riscv/kernel/cpu-hotplug.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,18 @@ bool cpu_has_hotplug(unsigned int cpu)
2929
*/
3030
int __cpu_disable(void)
3131
{
32-
int ret = 0;
3332
unsigned int cpu = smp_processor_id();
3433

3534
if (!cpu_ops[cpu] || !cpu_ops[cpu]->cpu_stop)
3635
return -EOPNOTSUPP;
3736

38-
if (cpu_ops[cpu]->cpu_disable)
39-
ret = cpu_ops[cpu]->cpu_disable(cpu);
40-
41-
if (ret)
42-
return ret;
43-
4437
remove_cpu_topology(cpu);
4538
numa_remove_cpu(cpu);
4639
set_cpu_online(cpu, false);
4740
riscv_ipi_disable();
4841
irq_migrate_all_off_this_cpu();
4942

50-
return ret;
43+
return 0;
5144
}
5245

5346
#ifdef CONFIG_HOTPLUG_CPU

arch/riscv/kernel/cpu_ops.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ const struct cpu_operations *cpu_ops[NR_CPUS] __ro_after_init;
1818
extern const struct cpu_operations cpu_ops_sbi;
1919
#ifndef CONFIG_RISCV_BOOT_SPINWAIT
2020
const struct cpu_operations cpu_ops_spinwait = {
21-
.name = "",
22-
.cpu_prepare = NULL,
2321
.cpu_start = NULL,
2422
};
2523
#endif

arch/riscv/kernel/cpu_ops_sbi.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -79,23 +79,7 @@ static int sbi_cpu_start(unsigned int cpuid, struct task_struct *tidle)
7979
return sbi_hsm_hart_start(hartid, boot_addr, hsm_data);
8080
}
8181

82-
static int sbi_cpu_prepare(unsigned int cpuid)
83-
{
84-
if (!cpu_ops_sbi.cpu_start) {
85-
pr_err("cpu start method not defined for CPU [%d]\n", cpuid);
86-
return -ENODEV;
87-
}
88-
return 0;
89-
}
90-
9182
#ifdef CONFIG_HOTPLUG_CPU
92-
static int sbi_cpu_disable(unsigned int cpuid)
93-
{
94-
if (!cpu_ops_sbi.cpu_stop)
95-
return -EOPNOTSUPP;
96-
return 0;
97-
}
98-
9983
static void sbi_cpu_stop(void)
10084
{
10185
int ret;
@@ -118,11 +102,8 @@ static int sbi_cpu_is_stopped(unsigned int cpuid)
118102
#endif
119103

120104
const struct cpu_operations cpu_ops_sbi = {
121-
.name = "sbi",
122-
.cpu_prepare = sbi_cpu_prepare,
123105
.cpu_start = sbi_cpu_start,
124106
#ifdef CONFIG_HOTPLUG_CPU
125-
.cpu_disable = sbi_cpu_disable,
126107
.cpu_stop = sbi_cpu_stop,
127108
.cpu_is_stopped = sbi_cpu_is_stopped,
128109
#endif

arch/riscv/kernel/cpu_ops_spinwait.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,6 @@ static void cpu_update_secondary_bootdata(unsigned int cpuid,
3939
WRITE_ONCE(__cpu_spinwait_task_pointer[hartid], tidle);
4040
}
4141

42-
static int spinwait_cpu_prepare(unsigned int cpuid)
43-
{
44-
if (!cpu_ops_spinwait.cpu_start) {
45-
pr_err("cpu start method not defined for CPU [%d]\n", cpuid);
46-
return -ENODEV;
47-
}
48-
return 0;
49-
}
50-
5142
static int spinwait_cpu_start(unsigned int cpuid, struct task_struct *tidle)
5243
{
5344
/*
@@ -64,7 +55,5 @@ static int spinwait_cpu_start(unsigned int cpuid, struct task_struct *tidle)
6455
}
6556

6657
const struct cpu_operations cpu_ops_spinwait = {
67-
.name = "spinwait",
68-
.cpu_prepare = spinwait_cpu_prepare,
6958
.cpu_start = spinwait_cpu_start,
7059
};

arch/riscv/kernel/head.S

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <asm/page.h>
1212
#include <asm/pgtable.h>
1313
#include <asm/csr.h>
14-
#include <asm/cpu_ops_sbi.h>
1514
#include <asm/hwcap.h>
1615
#include <asm/image.h>
1716
#include <asm/scs.h>

arch/riscv/kernel/setup.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include <asm/alternative.h>
2727
#include <asm/cacheflush.h>
2828
#include <asm/cpufeature.h>
29-
#include <asm/cpu_ops.h>
3029
#include <asm/early_ioremap.h>
3130
#include <asm/pgtable.h>
3231
#include <asm/setup.h>

arch/riscv/kernel/smpboot.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ void __init smp_prepare_boot_cpu(void)
4949
void __init smp_prepare_cpus(unsigned int max_cpus)
5050
{
5151
int cpuid;
52-
int ret;
5352
unsigned int curr_cpuid;
5453

5554
init_cpu_topology();
@@ -66,11 +65,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
6665
for_each_possible_cpu(cpuid) {
6766
if (cpuid == curr_cpuid)
6867
continue;
69-
if (cpu_ops[cpuid]->cpu_prepare) {
70-
ret = cpu_ops[cpuid]->cpu_prepare(cpuid);
71-
if (ret)
72-
continue;
73-
}
7468
set_cpu_present(cpuid, true);
7569
numa_store_cpu_info(cpuid);
7670
}

0 commit comments

Comments
 (0)