[patch 19/40] sh: perf: Convert the hotplug notifiers to statemachine callbacks

From: Thomas Gleixner
Date: Thu Jan 31 2013 - 07:18:44 EST


Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
arch/sh/kernel/perf_event.c | 22 +++-------------------
include/linux/cpuhotplug.h | 1 +
2 files changed, 4 insertions(+), 19 deletions(-)

Index: linux-2.6/arch/sh/kernel/perf_event.c
===================================================================
--- linux-2.6.orig/arch/sh/kernel/perf_event.c
+++ linux-2.6/arch/sh/kernel/perf_event.c
@@ -360,28 +360,12 @@ static struct pmu pmu = {
.read = sh_pmu_read,
};

-static void sh_pmu_setup(int cpu)
+static int __cpuinit sh_pmu_prepare_cpu(unsigned int cpu)
{
struct cpu_hw_events *cpuhw = &per_cpu(cpu_hw_events, cpu);

memset(cpuhw, 0, sizeof(struct cpu_hw_events));
-}
-
-static int __cpuinit
-sh_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
-{
- unsigned int cpu = (long)hcpu;
-
- switch (action & ~CPU_TASKS_FROZEN) {
- case CPU_UP_PREPARE:
- sh_pmu_setup(cpu);
- break;
-
- default:
- break;
- }
-
- return NOTIFY_OK;
+ return 0;
}

int __cpuinit register_sh_pmu(struct sh_pmu *_pmu)
@@ -395,6 +379,6 @@ int __cpuinit register_sh_pmu(struct sh_
WARN_ON(_pmu->num_events > MAX_HWEVENTS);

perf_pmu_register(&pmu, "cpu", PERF_TYPE_RAW);
- perf_cpu_notifier(sh_pmu_notifier);
+ cpuhp_setup_state(CPUHP_PERF_SUPERH, sh_pmu_prepare_cpu, NULL);
return 0;
}
Index: linux-2.6/include/linux/cpuhotplug.h
===================================================================
--- linux-2.6.orig/include/linux/cpuhotplug.h
+++ linux-2.6/include/linux/cpuhotplug.h
@@ -8,6 +8,7 @@ enum cpuhp_states {
CPUHP_PERF_X86_PREPARE,
CPUHP_PERF_BFIN,
CPUHP_PERF_POWER,
+ CPUHP_PERF_SUPERH,
CPUHP_PERF_PREPARE,
CPUHP_NOTIFY_PREPARE,
CPUHP_NOTIFY_DEAD,


--
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/