From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753619AbcKZXPM (ORCPT ); Sat, 26 Nov 2016 18:15:12 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:43549 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753384AbcKZXOo (ORCPT ); Sat, 26 Nov 2016 18:14:44 -0500 From: Sebastian Andrzej Siewior To: linux-kernel@vger.kernel.org Cc: rt@linutronix.de, tglx@linutronix.de, Sebastian Andrzej Siewior , Roy Pledge , Scott Wood , Claudiu Manoil Subject: [PATCH 19/22] soc/fsl/qbman: Convert to hotplug state machine Date: Sun, 27 Nov 2016 00:13:47 +0100 Message-Id: <20161126231350.10321-20-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: Roy Pledge Cc: Scott Wood Cc: Claudiu Manoil Signed-off-by: Sebastian Andrzej Siewior --- drivers/soc/fsl/qbman/bman_portal.c | 46 +++++++++++++--------------------= ---- 1 file changed, 16 insertions(+), 30 deletions(-) diff --git a/drivers/soc/fsl/qbman/bman_portal.c b/drivers/soc/fsl/qbman/bm= an_portal.c index 6579cc18811a..986f64690e6e 100644 --- a/drivers/soc/fsl/qbman/bman_portal.c +++ b/drivers/soc/fsl/qbman/bman_portal.c @@ -53,58 +53,38 @@ static struct bman_portal *init_pcfg(struct bm_portal_c= onfig *pcfg) return p; } =20 -static void bman_offline_cpu(unsigned int cpu) +static int bman_offline_cpu(unsigned int cpu) { struct bman_portal *p =3D affine_bportals[cpu]; const struct bm_portal_config *pcfg; =20 if (!p) - return; + return 0; =20 pcfg =3D bman_get_bm_portal_config(p); if (!pcfg) - return; + return 0; =20 irq_set_affinity(pcfg->irq, cpumask_of(0)); + return 0; } =20 -static void bman_online_cpu(unsigned int cpu) +static int bman_online_cpu(unsigned int cpu) { struct bman_portal *p =3D affine_bportals[cpu]; const struct bm_portal_config *pcfg; =20 if (!p) - return; + return 0; =20 pcfg =3D bman_get_bm_portal_config(p); if (!pcfg) - return; + return 0; =20 irq_set_affinity(pcfg->irq, cpumask_of(cpu)); + return 0; } =20 -static int bman_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: - bman_online_cpu(cpu); - break; - case CPU_DOWN_PREPARE: - case CPU_DOWN_PREPARE_FROZEN: - bman_offline_cpu(cpu); - } - - return NOTIFY_OK; -} - -static struct notifier_block bman_hotplug_cpu_notifier =3D { - .notifier_call =3D bman_hotplug_cpu_callback, -}; - static int bman_portal_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; @@ -210,8 +190,14 @@ static int __init bman_portal_driver_register(struct p= latform_driver *drv) if (ret < 0) return ret; =20 - register_hotcpu_notifier(&bman_hotplug_cpu_notifier); - + ret =3D cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, + "soc/qbman_portal:online", + bman_online_cpu, bman_offline_cpu); + if (ret < 0) { + pr_err("bman: failed to register hotplug callbacks.\n"); + platform_driver_unregister(drv); + return ret; + } return 0; } =20 --=20 2.10.2