diff options
author | Richard Genoud <richard.genoud@gmail.com> | 2013-03-29 05:03:27 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-04-03 08:38:27 -0400 |
commit | 385d94246b05f7c06d7ecb5215087e5ebddbf1e6 (patch) | |
tree | 955f0a8ea94bba509781448392fd85f1f085157e /drivers/pinctrl/core.c | |
parent | af6061777131639d7d2687ce542b6052a6510c25 (diff) |
pinctrl: simplify the re-enable old state code in pinctrl_select_state
Instead of just enabling the settings that were disabled in the 1st
loop, it's simpler to recall pinctrl_select_state with the old state.
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>
Diffstat (limited to 'drivers/pinctrl/core.c')
-rw-r--r-- | drivers/pinctrl/core.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index deb3d04323b0..8b832ce6a8e3 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c | |||
@@ -981,26 +981,10 @@ unapply_new_state: | |||
981 | pinmux_disable_setting(setting2); | 981 | pinmux_disable_setting(setting2); |
982 | } | 982 | } |
983 | 983 | ||
984 | if (old_state) { | 984 | /* There's no infinite recursive loop here because p->state is NULL */ |
985 | list_for_each_entry(setting, &old_state->settings, node) { | 985 | if (old_state) |
986 | bool found = false; | 986 | pinctrl_select_state_locked(p, old_state); |
987 | if (setting->type != PIN_MAP_TYPE_MUX_GROUP) | ||
988 | continue; | ||
989 | list_for_each_entry(setting2, &state->settings, node) { | ||
990 | if (setting2->type != PIN_MAP_TYPE_MUX_GROUP) | ||
991 | continue; | ||
992 | if (setting2->data.mux.group == | ||
993 | setting->data.mux.group) { | ||
994 | found = true; | ||
995 | break; | ||
996 | } | ||
997 | } | ||
998 | if (!found) | ||
999 | pinmux_enable_setting(setting); | ||
1000 | } | ||
1001 | } | ||
1002 | 987 | ||
1003 | p->state = old_state; | ||
1004 | return ret; | 988 | return ret; |
1005 | } | 989 | } |
1006 | 990 | ||