ARM/OMAP/wakeupgen: Convert to hotplug state machine
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Tue, 6 Sep 2016 17:04:39 +0000 (19:04 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 19 Sep 2016 19:44:26 +0000 (21:44 +0200)
Install the callbacks via the state machine.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Tony Lindgren <tony@atomide.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: rt@linutronix.de
Cc: linux-omap@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/20160906170457.32393-4-bigeasy@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/arm/mach-omap2/omap-wakeupgen.c
include/linux/cpuhotplug.h

index 0c47543865327270a0c18601d68dd493099b13e3..369f95a703ac0a4c4c7289770da4a96b5414b454 100644 (file)
@@ -322,34 +322,25 @@ static void irq_save_secure_context(void)
 #endif
 
 #ifdef CONFIG_HOTPLUG_CPU
-static int irq_cpu_hotplug_notify(struct notifier_block *self,
-                                 unsigned long action, void *hcpu)
+static int omap_wakeupgen_cpu_online(unsigned int cpu)
 {
-       unsigned int cpu = (unsigned int)hcpu;
-
-       /*
-        * Corresponding FROZEN transitions do not have to be handled,
-        * they are handled by at a higher level
-        * (drivers/cpuidle/coupled.c).
-        */
-       switch (action) {
-       case CPU_ONLINE:
-               wakeupgen_irqmask_all(cpu, 0);
-               break;
-       case CPU_DEAD:
-               wakeupgen_irqmask_all(cpu, 1);
-               break;
-       }
-       return NOTIFY_OK;
+       wakeupgen_irqmask_all(cpu, 0);
+       return 0;
 }
 
-static struct notifier_block irq_hotplug_notifier = {
-       .notifier_call = irq_cpu_hotplug_notify,
-};
+static int omap_wakeupgen_cpu_dead(unsigned int cpu)
+{
+       wakeupgen_irqmask_all(cpu, 1);
+       return 0;
+}
 
 static void __init irq_hotplug_init(void)
 {
-       register_hotcpu_notifier(&irq_hotplug_notifier);
+       cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "arm/omap-wake:online",
+                                 omap_wakeupgen_cpu_online, NULL);
+       cpuhp_setup_state_nocalls(CPUHP_ARM_OMAP_WAKE_DEAD,
+                                 "arm/omap-wake:dead", NULL,
+                                 omap_wakeupgen_cpu_dead);
 }
 #else
 static void __init irq_hotplug_init(void)
index 008eed0c078744d41c6e13d5a317e4b6f9904972..35859aafbbfc782cb167fc9abe90db19a3672664 100644 (file)
@@ -21,6 +21,7 @@ enum cpuhp_state {
        CPUHP_NET_MVNETA_DEAD,
        CPUHP_CPUIDLE_DEAD,
        CPUHP_ARM64_FPSIMD_DEAD,
+       CPUHP_ARM_OMAP_WAKE_DEAD,
        CPUHP_WORKQUEUE_PREP,
        CPUHP_POWER_NUMA_PREPARE,
        CPUHP_HRTIMERS_PREPARE,