mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-02 04:24:05 +00:00
cpuidle: psci: Split psci_dt_cpu_init_idle()
To make the code a bit more readable, let's move the OSI specific initialization out of the psci_dt_cpu_init_idle() and into a separate function. Reviewed-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
56cb26891e
commit
7fbee48ea0
1 changed files with 27 additions and 19 deletions
|
@ -160,6 +160,29 @@ int __init psci_dt_parse_state_node(struct device_node *np, u32 *state)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int __init psci_dt_cpu_init_topology(struct cpuidle_driver *drv,
|
||||||
|
struct psci_cpuidle_data *data,
|
||||||
|
unsigned int state_count, int cpu)
|
||||||
|
{
|
||||||
|
/* Currently limit the hierarchical topology to be used in OSI mode. */
|
||||||
|
if (!psci_has_osi_support())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
data->dev = psci_dt_attach_cpu(cpu);
|
||||||
|
if (IS_ERR_OR_NULL(data->dev))
|
||||||
|
return PTR_ERR_OR_ZERO(data->dev);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Using the deepest state for the CPU to trigger a potential selection
|
||||||
|
* of a shared state for the domain, assumes the domain states are all
|
||||||
|
* deeper states.
|
||||||
|
*/
|
||||||
|
drv->states[state_count - 1].enter = psci_enter_domain_idle_state;
|
||||||
|
psci_cpuidle_use_cpuhp = true;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int __init psci_dt_cpu_init_idle(struct cpuidle_driver *drv,
|
static int __init psci_dt_cpu_init_idle(struct cpuidle_driver *drv,
|
||||||
struct device_node *cpu_node,
|
struct device_node *cpu_node,
|
||||||
unsigned int state_count, int cpu)
|
unsigned int state_count, int cpu)
|
||||||
|
@ -193,25 +216,10 @@ static int __init psci_dt_cpu_init_idle(struct cpuidle_driver *drv,
|
||||||
goto free_mem;
|
goto free_mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Currently limit the hierarchical topology to be used in OSI mode. */
|
/* Initialize optional data, used for the hierarchical topology. */
|
||||||
if (psci_has_osi_support()) {
|
ret = psci_dt_cpu_init_topology(drv, data, state_count, cpu);
|
||||||
data->dev = psci_dt_attach_cpu(cpu);
|
if (ret < 0)
|
||||||
if (IS_ERR(data->dev)) {
|
goto free_mem;
|
||||||
ret = PTR_ERR(data->dev);
|
|
||||||
goto free_mem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Using the deepest state for the CPU to trigger a potential
|
|
||||||
* selection of a shared state for the domain, assumes the
|
|
||||||
* domain states are all deeper states.
|
|
||||||
*/
|
|
||||||
if (data->dev) {
|
|
||||||
drv->states[state_count - 1].enter =
|
|
||||||
psci_enter_domain_idle_state;
|
|
||||||
psci_cpuidle_use_cpuhp = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Idle states parsed correctly, store them in the per-cpu struct. */
|
/* Idle states parsed correctly, store them in the per-cpu struct. */
|
||||||
data->psci_states = psci_states;
|
data->psci_states = psci_states;
|
||||||
|
|
Loading…
Add table
Reference in a new issue