diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2016-11-17 13:35:35 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2016-11-22 17:34:41 -0500 |
commit | a3c9b14f6f151ee4c2a119fab14f9a60d1684d60 (patch) | |
tree | bad0878e239fbe51d03121f0397278292fde9228 | |
parent | 31eff2434db542763a00074a8368d7bd78d14ea1 (diff) |
arm/bL_switcher: Convert to hotplug state machine
Install the callbacks via the state machine.
Signed-off-by: Sebastian 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.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | arch/arm/common/bL_switcher.c | 34 | ||||
-rw-r--r-- | include/linux/cpuhotplug.h | 1 |
2 files changed, 21 insertions, 14 deletions
diff --git a/arch/arm/common/bL_switcher.c b/arch/arm/common/bL_switcher.c index 37dc0fe1093f..46730017b3c5 100644 --- a/arch/arm/common/bL_switcher.c +++ b/arch/arm/common/bL_switcher.c | |||
@@ -757,19 +757,18 @@ EXPORT_SYMBOL_GPL(bL_switcher_put_enabled); | |||
757 | * while the switcher is active. | 757 | * while the switcher is active. |
758 | * We're just not ready to deal with that given the trickery involved. | 758 | * We're just not ready to deal with that given the trickery involved. |
759 | */ | 759 | */ |
760 | static int bL_switcher_hotplug_callback(struct notifier_block *nfb, | 760 | static int bL_switcher_cpu_pre(unsigned int cpu) |
761 | unsigned long action, void *hcpu) | ||
762 | { | 761 | { |
763 | if (bL_switcher_active) { | 762 | int pairing; |
764 | int pairing = bL_switcher_cpu_pairing[(unsigned long)hcpu]; | 763 | |
765 | switch (action & 0xf) { | 764 | if (!bL_switcher_active) |
766 | case CPU_UP_PREPARE: | 765 | return 0; |
767 | case CPU_DOWN_PREPARE: | 766 | |
768 | if (pairing == -1) | 767 | pairing = bL_switcher_cpu_pairing[cpu]; |
769 | return NOTIFY_BAD; | 768 | |
770 | } | 769 | if (pairing == -1) |
771 | } | 770 | return -EINVAL; |
772 | return NOTIFY_DONE; | 771 | return 0; |
773 | } | 772 | } |
774 | 773 | ||
775 | static bool no_bL_switcher; | 774 | static bool no_bL_switcher; |
@@ -782,8 +781,15 @@ static int __init bL_switcher_init(void) | |||
782 | if (!mcpm_is_available()) | 781 | if (!mcpm_is_available()) |
783 | return -ENODEV; | 782 | return -ENODEV; |
784 | 783 | ||
785 | cpu_notifier(bL_switcher_hotplug_callback, 0); | 784 | cpuhp_setup_state_nocalls(CPUHP_ARM_BL_PREPARE, "arm/bl:prepare", |
786 | 785 | bL_switcher_cpu_pre, NULL); | |
786 | ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "arm/bl:predown", | ||
787 | NULL, bL_switcher_cpu_pre); | ||
788 | if (ret < 0) { | ||
789 | cpuhp_remove_state_nocalls(CPUHP_ARM_BL_PREPARE); | ||
790 | pr_err("bL_switcher: Failed to allocate a hotplug state\n"); | ||
791 | return ret; | ||
792 | } | ||
787 | if (!no_bL_switcher) { | 793 | if (!no_bL_switcher) { |
788 | ret = bL_switcher_enable(); | 794 | ret = bL_switcher_enable(); |
789 | if (ret) | 795 | if (ret) |
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 12bbcf3ded70..e3771fb959c0 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h | |||
@@ -61,6 +61,7 @@ enum cpuhp_state { | |||
61 | CPUHP_NET_FLOW_PREPARE, | 61 | CPUHP_NET_FLOW_PREPARE, |
62 | CPUHP_TOPOLOGY_PREPARE, | 62 | CPUHP_TOPOLOGY_PREPARE, |
63 | CPUHP_NET_IUCV_PREPARE, | 63 | CPUHP_NET_IUCV_PREPARE, |
64 | CPUHP_ARM_BL_PREPARE, | ||
64 | CPUHP_TIMERS_DEAD, | 65 | CPUHP_TIMERS_DEAD, |
65 | CPUHP_NOTF_ERR_INJ_PREPARE, | 66 | CPUHP_NOTF_ERR_INJ_PREPARE, |
66 | CPUHP_MIPS_SOC_PREPARE, | 67 | CPUHP_MIPS_SOC_PREPARE, |