[patch 26/40] arm: perf: Convert to hotplug state machine

From: Thomas Gleixner
Date: Thu Jan 31 2013 - 07:16:51 EST


Straight forward conversion w/o bells and whistles.

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
arch/arm/kernel/perf_event_cpu.c | 28 +++++-----------------------
include/linux/cpuhotplug.h | 1 +
2 files changed, 6 insertions(+), 23 deletions(-)

Index: linux-2.6/arch/arm/kernel/perf_event_cpu.c
===================================================================
--- linux-2.6.orig/arch/arm/kernel/perf_event_cpu.c
+++ linux-2.6/arch/arm/kernel/perf_event_cpu.c
@@ -157,24 +157,13 @@ static void cpu_pmu_init(struct arm_pmu
* UNKNOWN at reset, the PMU must be explicitly reset to avoid reading
* junk values out of them.
*/
-static int __cpuinit cpu_pmu_notify(struct notifier_block *b,
- unsigned long action, void *hcpu)
+static int __cpuinit arm_perf_starting_cpu(unsigned int cpu)
{
- if ((action & ~CPU_TASKS_FROZEN) != CPU_STARTING)
- return NOTIFY_DONE;
-
if (cpu_pmu && cpu_pmu->reset)
cpu_pmu->reset(cpu_pmu);
- else
- return NOTIFY_DONE;
-
- return NOTIFY_OK;
+ return 0;
}

-static struct notifier_block __cpuinitdata cpu_pmu_hotplug_notifier = {
- .notifier_call = cpu_pmu_notify,
-};
-
/*
* PMU platform driver and devicetree bindings.
*/
@@ -304,16 +293,9 @@ static struct platform_driver cpu_pmu_dr

static int __init register_pmu_driver(void)
{
- int err;
-
- err = register_cpu_notifier(&cpu_pmu_hotplug_notifier);
- if (err)
- return err;
-
- err = platform_driver_register(&cpu_pmu_driver);
- if (err)
- unregister_cpu_notifier(&cpu_pmu_hotplug_notifier);
+ int err = platform_driver_register(&cpu_pmu_driver);

- return err;
+ return err ? err : cpuhp_setup_state_nocalls(CPUHP_AP_PERF_ARM_STARTING,
+ arm_perf_starting_cpu, NULL);
}
device_initcall(register_pmu_driver);
Index: linux-2.6/include/linux/cpuhotplug.h
===================================================================
--- linux-2.6.orig/include/linux/cpuhotplug.h
+++ linux-2.6/include/linux/cpuhotplug.h
@@ -22,6 +22,7 @@ enum cpuhp_states {
CPUHP_AP_PERF_X86_UNCORE_STARTING,
CPUHP_AP_PERF_X86_AMD_IBS_STARTING,
CPUHP_AP_PERF_X86_STARTING,
+ CPUHP_AP_PERF_ARM_STARTING,
CPUHP_AP_ARM_VFP_STARTING,
CPUHP_AP_ARM64_TIMER_STARTING,
CPUHP_AP_NOTIFY_STARTING,


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/