diff options
author | Richard Genoud <richard.genoud@gmail.com> | 2013-03-25 15:47:21 +0100 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-03-27 23:14:52 +0100 |
commit | d3cee8305b48316ea416a73c763be3cb04bbc82b (patch) | |
tree | 8394a763e89d8e423032f83d8e6794d7f7c90b98 /drivers/pinctrl/core.c | |
parent | 2c9abf808a81e2b2b61f6e05ec1554669aab3b19 (diff) |
pinctrl: create pinctrl_free_setting function
This prepares the implementation of pinctrl_select_state_locked() free code.
No functionnal change.
Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/core.c')
-rw-r--r-- | drivers/pinctrl/core.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index f8a632dc877b..971234599d72 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -794,6 +794,24 @@ struct pinctrl *pinctrl_get(struct device *dev) } 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) { struct pinctrl_state *state, *n1; @@ -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(setting, n2, &state->settings, node) { - switch (setting->type) { - 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; - } + pinctrl_free_setting(state == p->state, setting); list_del(&setting->node); kfree(setting); } |