soc/fsl/qbman: Convert to hotplug state machine
Install the callbacks via the state machine. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Scott Wood <oss@buserror.net> Cc: Claudiu Manoil <claudiu.manoil@nxp.com> Cc: rt@linutronix.de Cc: Roy Pledge <roy.pledge@nxp.com> Link: http://lkml.kernel.org/r/20161126231350.10321-20-bigeasy@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
parent
1dd6c834fa
commit
fce77c3562
@ -53,58 +53,38 @@ static struct bman_portal *init_pcfg(struct bm_portal_config *pcfg)
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bman_offline_cpu(unsigned int cpu)
|
static int bman_offline_cpu(unsigned int cpu)
|
||||||
{
|
{
|
||||||
struct bman_portal *p = affine_bportals[cpu];
|
struct bman_portal *p = affine_bportals[cpu];
|
||||||
const struct bm_portal_config *pcfg;
|
const struct bm_portal_config *pcfg;
|
||||||
|
|
||||||
if (!p)
|
if (!p)
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
pcfg = bman_get_bm_portal_config(p);
|
pcfg = bman_get_bm_portal_config(p);
|
||||||
if (!pcfg)
|
if (!pcfg)
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
irq_set_affinity(pcfg->irq, cpumask_of(0));
|
irq_set_affinity(pcfg->irq, cpumask_of(0));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bman_online_cpu(unsigned int cpu)
|
static int bman_online_cpu(unsigned int cpu)
|
||||||
{
|
{
|
||||||
struct bman_portal *p = affine_bportals[cpu];
|
struct bman_portal *p = affine_bportals[cpu];
|
||||||
const struct bm_portal_config *pcfg;
|
const struct bm_portal_config *pcfg;
|
||||||
|
|
||||||
if (!p)
|
if (!p)
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
pcfg = bman_get_bm_portal_config(p);
|
pcfg = bman_get_bm_portal_config(p);
|
||||||
if (!pcfg)
|
if (!pcfg)
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
irq_set_affinity(pcfg->irq, cpumask_of(cpu));
|
irq_set_affinity(pcfg->irq, cpumask_of(cpu));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bman_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:
|
|
||||||
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 = {
|
|
||||||
.notifier_call = bman_hotplug_cpu_callback,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int bman_portal_probe(struct platform_device *pdev)
|
static int bman_portal_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
@ -210,8 +190,14 @@ static int __init bman_portal_driver_register(struct platform_driver *drv)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
register_hotcpu_notifier(&bman_hotplug_cpu_notifier);
|
ret = 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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user