aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2017-04-24 20:46:59 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2017-05-03 14:45:38 +1000
commit3f2290e1b5192fdfa74f012220a8d90067beb076 (patch)
treed789e4a7958fcde2c25d55d7e436452f461bcc8f /arch/powerpc/kernel
parentpowerpc/smp: Document irq enable/disable after migrating IRQs (diff)
downloadlinux-dev-3f2290e1b5192fdfa74f012220a8d90067beb076.tar.xz
linux-dev-3f2290e1b5192fdfa74f012220a8d90067beb076.zip
powerpc/sysfs: Move #ifdef CONFIG_HOTPLUG_CPU out of the function body
The entire body of unregister_cpu_online() is inside an #ifdef CONFIG_HOTPLUG_CPU block. This is ugly and means we create an empty function when hotplug is disabled for no reason. Instead move the #ifdef out of the function body and define the function to be NULL in the else case. This means we'll pass NULL to cpuhp_setup_state(), but that's fine because it accepts NULL to mean there is no teardown callback, which is exactly what we want. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/sysfs.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 949957b97ead..4437c70c7c2b 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -789,9 +789,9 @@ static int register_cpu_online(unsigned int cpu)
return 0;
}
+#ifdef CONFIG_HOTPLUG_CPU
static int unregister_cpu_online(unsigned int cpu)
{
-#ifdef CONFIG_HOTPLUG_CPU
struct cpu *c = &per_cpu(cpu_devices, cpu);
struct device *s = &c->dev;
struct device_attribute *attrs, *pmc_attrs;
@@ -870,9 +870,11 @@ static int unregister_cpu_online(unsigned int cpu)
cacheinfo_cpu_offline(cpu);
of_node_put(s->of_node);
s->of_node = NULL;
-#endif /* CONFIG_HOTPLUG_CPU */
return 0;
}
+#else /* !CONFIG_HOTPLUG_CPU */
+#define unregister_cpu_online NULL
+#endif
#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
ssize_t arch_cpu_probe(const char *buf, size_t count)