Skip to content

Commit

Permalink
pinctrl: select_state: don't call pinctrl_free_setting on error
Browse files Browse the repository at this point in the history
As Stephen Warren pointed out, pinctrl_free_setting() was called instead
of pinmux_disable_setting() on error.
In this error code, we want to call pinmux_disable_setting() where
pinmux_enable_setting() was called.
And when pinconf_apply_setting() was called, we can't do much to undo
the pin muxing (the closest thing I can think about for "unmuxing" a pin
is muxing it as GPIO input).

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Richard Genoud authored and Linus Walleij committed Apr 3, 2013
1 parent 28d0c14 commit af60617
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion drivers/pinctrl/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,15 @@ static int pinctrl_select_state_locked(struct pinctrl *p,
list_for_each_entry(setting2, &state->settings, node) {
if (&setting2->node == &setting->node)
break;
pinctrl_free_setting(true, setting2);
/*
* All we can do here is pinmux_disable_setting.
* That means that some pins are muxed differently now
* than they were before applying the setting (We can't
* "unmux a pin"!), but it's not a big deal since the pins
* are free to be muxed by another apply_setting.
*/
if (setting2->type == PIN_MAP_TYPE_MUX_GROUP)
pinmux_disable_setting(setting2);
}

if (old_state) {
Expand Down

0 comments on commit af60617

Please sign in to comment.