From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756105AbcLBARg (ORCPT ); Thu, 1 Dec 2016 19:17:36 -0500 Received: from terminus.zytor.com ([198.137.202.10]:56046 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933027AbcLBARc (ORCPT ); Thu, 1 Dec 2016 19:17:32 -0500 Date: Thu, 1 Dec 2016 16:17:22 -0800 From: tip-bot for Sebastian Andrzej Siewior Message-ID: Cc: roy.pledge@nxp.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, mingo@kernel.org, hpa@zytor.com, claudiu.manoil@nxp.com, oss@buserror.net, bigeasy@linutronix.de Reply-To: claudiu.manoil@nxp.com, oss@buserror.net, bigeasy@linutronix.de, mingo@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, roy.pledge@nxp.com, hpa@zytor.com In-Reply-To: <20161126231350.10321-21-bigeasy@linutronix.de> References: <20161126231350.10321-21-bigeasy@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:smp/hotplug] soc/fsl/qbman: Convert to hotplug state machine Git-Commit-ID: 1f759d328f6d8c06b5db55374b028565187deaca 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: 1f759d328f6d8c06b5db55374b028565187deaca Gitweb: http://git.kernel.org/tip/1f759d328f6d8c06b5db55374b028565187deaca Author: Sebastian Andrzej Siewior AuthorDate: Sun, 27 Nov 2016 00:13:48 +0100 Committer: Thomas Gleixner CommitDate: Fri, 2 Dec 2016 00:52:40 +0100 soc/fsl/qbman: Convert to hotplug state machine Install the callbacks via the state machine. Signed-off-by: Sebastian Andrzej Siewior Cc: Scott Wood Cc: Claudiu Manoil Cc: rt@linutronix.de Cc: Roy Pledge Link: http://lkml.kernel.org/r/20161126231350.10321-21-bigeasy@linutronix.de Signed-off-by: Thomas Gleixner --- drivers/soc/fsl/qbman/qman_portal.c | 39 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 27 deletions(-) diff --git a/drivers/soc/fsl/qbman/qman_portal.c b/drivers/soc/fsl/qbman/qman_portal.c index 1486143..d068e48 100644 --- a/drivers/soc/fsl/qbman/qman_portal.c +++ b/drivers/soc/fsl/qbman/qman_portal.c @@ -179,7 +179,7 @@ static void qman_portal_update_sdest(const struct qm_portal_config *pcfg, qman_set_sdest(pcfg->channel, cpu); } -static void qman_offline_cpu(unsigned int cpu) +static int qman_offline_cpu(unsigned int cpu) { struct qman_portal *p; const struct qm_portal_config *pcfg; @@ -192,9 +192,10 @@ static void qman_offline_cpu(unsigned int cpu) qman_portal_update_sdest(pcfg, 0); } } + return 0; } -static void qman_online_cpu(unsigned int cpu) +static int qman_online_cpu(unsigned int cpu) { struct qman_portal *p; const struct qm_portal_config *pcfg; @@ -207,31 +208,9 @@ static void qman_online_cpu(unsigned int cpu) qman_portal_update_sdest(pcfg, cpu); } } + return 0; } -static int qman_hotplug_cpu_callback(struct notifier_block *nfb, - unsigned long action, void *hcpu) -{ - unsigned int cpu = (unsigned long)hcpu; - - switch (action) { - case CPU_ONLINE: - case CPU_ONLINE_FROZEN: - qman_online_cpu(cpu); - break; - case CPU_DOWN_PREPARE: - case CPU_DOWN_PREPARE_FROZEN: - qman_offline_cpu(cpu); - default: - break; - } - return NOTIFY_OK; -} - -static struct notifier_block qman_hotplug_cpu_notifier = { - .notifier_call = qman_hotplug_cpu_callback, -}; - static int qman_portal_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -346,8 +325,14 @@ static int __init qman_portal_driver_register(struct platform_driver *drv) if (ret < 0) return ret; - register_hotcpu_notifier(&qman_hotplug_cpu_notifier); - + ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, + "soc/qman_portal:online", + qman_online_cpu, qman_offline_cpu); + if (ret < 0) { + pr_err("qman: failed to register hotplug callbacks.\n"); + platform_driver_unregister(drv); + return ret; + } return 0; }