Commit d3cee830 authored by Richard Genoud's avatar Richard Genoud Committed by Linus Walleij

pinctrl: create pinctrl_free_setting function

This prepares the implementation of pinctrl_select_state_locked() free code.

No functionnal change.
Signed-off-by: default avatarRichard Genoud <richard.genoud@gmail.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 2c9abf80
...@@ -794,6 +794,24 @@ struct pinctrl *pinctrl_get(struct device *dev) ...@@ -794,6 +794,24 @@ struct pinctrl *pinctrl_get(struct device *dev)
} }
EXPORT_SYMBOL_GPL(pinctrl_get); EXPORT_SYMBOL_GPL(pinctrl_get);
static void pinctrl_free_setting(bool disable_setting,
struct pinctrl_setting *setting)
{
switch (setting->type) {
case PIN_MAP_TYPE_MUX_GROUP:
if (disable_setting)
pinmux_disable_setting(setting);
pinmux_free_setting(setting);
break;
case PIN_MAP_TYPE_CONFIGS_PIN:
case PIN_MAP_TYPE_CONFIGS_GROUP:
pinconf_free_setting(setting);
break;
default:
break;
}
}
static void pinctrl_put_locked(struct pinctrl *p, bool inlist) static void pinctrl_put_locked(struct pinctrl *p, bool inlist)
{ {
struct pinctrl_state *state, *n1; struct pinctrl_state *state, *n1;
...@@ -801,19 +819,7 @@ static void pinctrl_put_locked(struct pinctrl *p, bool inlist) ...@@ -801,19 +819,7 @@ static void pinctrl_put_locked(struct pinctrl *p, bool inlist)
list_for_each_entry_safe(state, n1, &p->states, node) { list_for_each_entry_safe(state, n1, &p->states, node) {
list_for_each_entry_safe(setting, n2, &state->settings, node) { list_for_each_entry_safe(setting, n2, &state->settings, node) {
switch (setting->type) { pinctrl_free_setting(state == p->state, setting);
case PIN_MAP_TYPE_MUX_GROUP:
if (state == p->state)
pinmux_disable_setting(setting);
pinmux_free_setting(setting);
break;
case PIN_MAP_TYPE_CONFIGS_PIN:
case PIN_MAP_TYPE_CONFIGS_GROUP:
pinconf_free_setting(setting);
break;
default:
break;
}
list_del(&setting->node); list_del(&setting->node);
kfree(setting); kfree(setting);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment