From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753843AbcKZXQQ (ORCPT ); Sat, 26 Nov 2016 18:16:16 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:43554 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753359AbcKZXOk (ORCPT ); Sat, 26 Nov 2016 18:14:40 -0500 From: Sebastian Andrzej Siewior To: linux-kernel@vger.kernel.org Cc: rt@linutronix.de, tglx@linutronix.de, Sebastian Andrzej Siewior , Claudiu Manoil , Scott Wood , Roy Pledge Subject: [PATCH 20/22] soc/fsl/qbman: Convert to hotplug state machine Date: Sun, 27 Nov 2016 00:13:48 +0100 Message-Id: <20161126231350.10321-21-bigeasy@linutronix.de> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161126231350.10321-1-bigeasy@linutronix.de> References: <20161126231350.10321-1-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Install the callbacks via the state machine. Cc: Claudiu Manoil Cc: Scott Wood Cc: Roy Pledge Signed-off-by: Sebastian Andrzej Siewior --- 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/qm= an_portal.c index 148614388fca..d068e4820f49 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_po= rtal_config *pcfg, qman_set_sdest(pcfg->channel, cpu); } =20 -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; } =20 -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; } =20 -static int qman_hotplug_cpu_callback(struct notifier_block *nfb, - unsigned long action, void *hcpu) -{ - unsigned int cpu =3D (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 =3D { - .notifier_call =3D qman_hotplug_cpu_callback, -}; - static int qman_portal_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; @@ -346,8 +325,14 @@ static int __init qman_portal_driver_register(struct p= latform_driver *drv) if (ret < 0) return ret; =20 - register_hotcpu_notifier(&qman_hotplug_cpu_notifier); - + ret =3D 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; } =20 --=20 2.10.2