staticint pd_parse_state_nodes( int (*parse_state)(struct device_node *, u32 *), struct genpd_power_state *states, int state_count)
{ int i, ret;
u32 state, *state_buf;
for (i = 0; i < state_count; i++) {
ret = parse_state(to_of_node(states[i].fwnode), &state); if (ret) goto free_state;
state_buf = kmalloc(sizeof(u32), GFP_KERNEL); if (!state_buf) {
ret = -ENOMEM; goto free_state;
}
*state_buf = state;
states[i].data = state_buf;
}
return 0;
free_state:
i--; for (; i >= 0; i--)
kfree(states[i].data); return ret;
}
staticint pd_parse_states(struct device_node *np, int (*parse_state)(struct device_node *, u32 *), struct genpd_power_state **states, int *state_count)
{ int ret;
/* Parse the domain idle states. */
ret = of_genpd_parse_idle_states(np, states, state_count); if (ret) return ret;
/* Fill out the dt specifics for each found state. */
ret = pd_parse_state_nodes(parse_state, *states, *state_count); if (ret)
kfree(*states);
return ret;
}
staticvoid pd_free_states(struct genpd_power_state *states, unsignedint state_count)
{ int i;
for (i = 0; i < state_count; i++)
kfree(states[i].data);
kfree(states);
}
pd = kzalloc(sizeof(*pd), GFP_KERNEL); if (!pd) goto out;
pd->name = kasprintf(GFP_KERNEL, "%pOF", np); if (!pd->name) goto free_pd;
/* * Parse the domain idle states and let genpd manage the state selection * for those being compatible with "domain-idle-state".
*/
ret = pd_parse_states(np, parse_state, &states, &state_count); if (ret) goto free_name;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.