Message ID | 20200226002356.86986-2-gshan@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | arm64: Dereference CPU operations indirectly | expand |
On Wed, Feb 26, 2020 at 11:23:52AM +1100, Gavin Shan wrote: > It's obvious we needn't declare the corresponding CPU operation when > CONFIG_ARM64_ACPI_PARKING_PROTOCOL is disabled. > > Signed-off-by: Gavin Shan <gshan@redhat.com> Is there a problem leaving this as-is, e.g. a compiler warning? If so, it'd be nice to mention that in the commit message. We don't always bother placing declartions under ifdefs where the use would result in a link-time error. No strong feelings form me either way, so FWIW: Acked-by: Mark Rutland <mark.rutland@arm.com> Mark. > --- > arch/arm64/kernel/cpu_ops.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c > index 7e07072757af..2082cfb1be86 100644 > --- a/arch/arm64/kernel/cpu_ops.c > +++ b/arch/arm64/kernel/cpu_ops.c > @@ -15,7 +15,9 @@ > #include <asm/smp_plat.h> > > extern const struct cpu_operations smp_spin_table_ops; > +#ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL > extern const struct cpu_operations acpi_parking_protocol_ops; > +#endif > extern const struct cpu_operations cpu_psci_ops; > > const struct cpu_operations *cpu_ops[NR_CPUS] __ro_after_init; > -- > 2.23.0 >
On 3/17/20 9:28 PM, Mark Rutland wrote: > On Wed, Feb 26, 2020 at 11:23:52AM +1100, Gavin Shan wrote: >> It's obvious we needn't declare the corresponding CPU operation when >> CONFIG_ARM64_ACPI_PARKING_PROTOCOL is disabled. >> >> Signed-off-by: Gavin Shan <gshan@redhat.com> > > Is there a problem leaving this as-is, e.g. a compiler warning? If so, > it'd be nice to mention that in the commit message. > > We don't always bother placing declartions under ifdefs where the use > would result in a link-time error. > > No strong feelings form me either way, so FWIW: > > Acked-by: Mark Rutland <mark.rutland@arm.com> > > Mark. > It doesn't cause a compiler warning because the corresponding CPU operations is declared as "extern". I will have commit log in next revision as below: It's obvious we needn't declare the corresponding CPU operation when CONFIG_ARM64_ACPI_PARKING_PROTOCOL is disabled, even it doesn't cause any compiling warnings. Thanks, Gavin >> --- >> arch/arm64/kernel/cpu_ops.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c >> index 7e07072757af..2082cfb1be86 100644 >> --- a/arch/arm64/kernel/cpu_ops.c >> +++ b/arch/arm64/kernel/cpu_ops.c >> @@ -15,7 +15,9 @@ >> #include <asm/smp_plat.h> >> >> extern const struct cpu_operations smp_spin_table_ops; >> +#ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL >> extern const struct cpu_operations acpi_parking_protocol_ops; >> +#endif >> extern const struct cpu_operations cpu_psci_ops; >> >> const struct cpu_operations *cpu_ops[NR_CPUS] __ro_after_init; >> -- >> 2.23.0 >> >
diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c index 7e07072757af..2082cfb1be86 100644 --- a/arch/arm64/kernel/cpu_ops.c +++ b/arch/arm64/kernel/cpu_ops.c @@ -15,7 +15,9 @@ #include <asm/smp_plat.h> extern const struct cpu_operations smp_spin_table_ops; +#ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL extern const struct cpu_operations acpi_parking_protocol_ops; +#endif extern const struct cpu_operations cpu_psci_ops; const struct cpu_operations *cpu_ops[NR_CPUS] __ro_after_init;
It's obvious we needn't declare the corresponding CPU operation when CONFIG_ARM64_ACPI_PARKING_PROTOCOL is disabled. Signed-off-by: Gavin Shan <gshan@redhat.com> --- arch/arm64/kernel/cpu_ops.c | 2 ++ 1 file changed, 2 insertions(+)