From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933832AbcLBAPe (ORCPT ); Thu, 1 Dec 2016 19:15:34 -0500 Received: from terminus.zytor.com ([198.137.202.10]:55912 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933532AbcLBAPc (ORCPT ); Thu, 1 Dec 2016 19:15:32 -0500 Date: Thu, 1 Dec 2016 16:15:23 -0800 From: tip-bot for Anna-Maria Gleixner Message-ID: Cc: mingo@kernel.org, bigeasy@linutronix.de, anna-maria@linutronix.de, hpa@zytor.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, tglx@linutronix.de Reply-To: anna-maria@linutronix.de, catalin.marinas@arm.com, suzuki.poulose@arm.com, hpa@zytor.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@kernel.org, bigeasy@linutronix.de In-Reply-To: <20161126231350.10321-17-bigeasy@linutronix.de> References: <20161126231350.10321-17-bigeasy@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:smp/hotplug] arm64/cpuinfo: Convert to hotplug state machine Git-Commit-ID: a7ce95e1741f2d866481c8138a84ce5af61eb219 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: a7ce95e1741f2d866481c8138a84ce5af61eb219 Gitweb: http://git.kernel.org/tip/a7ce95e1741f2d866481c8138a84ce5af61eb219 Author: Anna-Maria Gleixner AuthorDate: Sun, 27 Nov 2016 00:13:44 +0100 Committer: Thomas Gleixner CommitDate: Fri, 2 Dec 2016 00:52:38 +0100 arm64/cpuinfo: Convert to hotplug state machine Install the callbacks via the state machine and let the core invoke the callbacks on the already online CPUs. Signed-off-by: Anna-Maria Gleixner Signed-off-by: Sebastian Andrzej Siewior Reviewed-by: Suzuki K Poulose Cc: Catalin Marinas Cc: Will Deacon Cc: rt@linutronix.de Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/20161126231350.10321-17-bigeasy@linutronix.de Signed-off-by: Thomas Gleixner --- arch/arm64/kernel/cpuinfo.c | 37 +++++++++---------------------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c index 19aad70..7b7be71 100644 --- a/arch/arm64/kernel/cpuinfo.c +++ b/arch/arm64/kernel/cpuinfo.c @@ -227,7 +227,7 @@ static struct attribute_group cpuregs_attr_group = { .name = "identification" }; -static int cpuid_add_regs(int cpu) +static int cpuid_cpu_online(unsigned int cpu) { int rc; struct device *dev; @@ -248,7 +248,7 @@ out: return rc; } -static int cpuid_remove_regs(int cpu) +static int cpuid_cpu_offline(unsigned int cpu) { struct device *dev; struct cpuinfo_arm64 *info = &per_cpu(cpu_data, cpu); @@ -264,41 +264,22 @@ static int cpuid_remove_regs(int cpu) return 0; } -static int cpuid_callback(struct notifier_block *nb, - unsigned long action, void *hcpu) -{ - int rc = 0; - unsigned long cpu = (unsigned long)hcpu; - - switch (action & ~CPU_TASKS_FROZEN) { - case CPU_ONLINE: - case CPU_DOWN_FAILED: - rc = cpuid_add_regs(cpu); - break; - case CPU_DOWN_PREPARE: - rc = cpuid_remove_regs(cpu); - break; - } - - return notifier_from_errno(rc); -} - static int __init cpuinfo_regs_init(void) { - int cpu; - - cpu_notifier_register_begin(); + int cpu, ret; for_each_possible_cpu(cpu) { struct cpuinfo_arm64 *info = &per_cpu(cpu_data, cpu); kobject_init(&info->kobj, &cpuregs_kobj_type); - if (cpu_online(cpu)) - cpuid_add_regs(cpu); } - __hotcpu_notifier(cpuid_callback, 0); - cpu_notifier_register_done(); + ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "arm64/cpuinfo:online", + cpuid_cpu_online, cpuid_cpu_offline); + if (ret < 0) { + pr_err("cpuinfo: failed to register hotplug callbacks.\n"); + return ret; + } return 0; } static void cpuinfo_detect_icache_policy(struct cpuinfo_arm64 *info)