Commit a3c9b14f authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Thomas Gleixner

arm/bL_switcher: Convert to hotplug state machine

Install the callbacks via the state machine.
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: rt@linuxtronix.de
Cc: linux-arm-kernel@lists.infradead.org
Cc: Russell King <linux@armlinux.org.uk>
Link: http://lkml.kernel.org/r/20161117183541.8588-15-bigeasy@linutronix.deSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 31eff243
...@@ -757,19 +757,18 @@ EXPORT_SYMBOL_GPL(bL_switcher_put_enabled); ...@@ -757,19 +757,18 @@ EXPORT_SYMBOL_GPL(bL_switcher_put_enabled);
* while the switcher is active. * while the switcher is active.
* We're just not ready to deal with that given the trickery involved. * We're just not ready to deal with that given the trickery involved.
*/ */
static int bL_switcher_hotplug_callback(struct notifier_block *nfb, static int bL_switcher_cpu_pre(unsigned int cpu)
unsigned long action, void *hcpu)
{ {
if (bL_switcher_active) { int pairing;
int pairing = bL_switcher_cpu_pairing[(unsigned long)hcpu];
switch (action & 0xf) { if (!bL_switcher_active)
case CPU_UP_PREPARE: return 0;
case CPU_DOWN_PREPARE:
pairing = bL_switcher_cpu_pairing[cpu];
if (pairing == -1) if (pairing == -1)
return NOTIFY_BAD; return -EINVAL;
} return 0;
}
return NOTIFY_DONE;
} }
static bool no_bL_switcher; static bool no_bL_switcher;
...@@ -782,8 +781,15 @@ static int __init bL_switcher_init(void) ...@@ -782,8 +781,15 @@ static int __init bL_switcher_init(void)
if (!mcpm_is_available()) if (!mcpm_is_available())
return -ENODEV; return -ENODEV;
cpu_notifier(bL_switcher_hotplug_callback, 0); cpuhp_setup_state_nocalls(CPUHP_ARM_BL_PREPARE, "arm/bl:prepare",
bL_switcher_cpu_pre, NULL);
ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "arm/bl:predown",
NULL, bL_switcher_cpu_pre);
if (ret < 0) {
cpuhp_remove_state_nocalls(CPUHP_ARM_BL_PREPARE);
pr_err("bL_switcher: Failed to allocate a hotplug state\n");
return ret;
}
if (!no_bL_switcher) { if (!no_bL_switcher) {
ret = bL_switcher_enable(); ret = bL_switcher_enable();
if (ret) if (ret)
......
...@@ -61,6 +61,7 @@ enum cpuhp_state { ...@@ -61,6 +61,7 @@ enum cpuhp_state {
CPUHP_NET_FLOW_PREPARE, CPUHP_NET_FLOW_PREPARE,
CPUHP_TOPOLOGY_PREPARE, CPUHP_TOPOLOGY_PREPARE,
CPUHP_NET_IUCV_PREPARE, CPUHP_NET_IUCV_PREPARE,
CPUHP_ARM_BL_PREPARE,
CPUHP_TIMERS_DEAD, CPUHP_TIMERS_DEAD,
CPUHP_NOTF_ERR_INJ_PREPARE, CPUHP_NOTF_ERR_INJ_PREPARE,
CPUHP_MIPS_SOC_PREPARE, CPUHP_MIPS_SOC_PREPARE,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment