Skip to content

Commit

Permalink
pinctrl: simplify the re-enable old state code in pinctrl_select_state
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Richard Genoud authored and Linus Walleij committed Apr 3, 2013
1 parent af60617 commit 385d942
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions drivers/pinctrl/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -981,26 +981,10 @@ static int pinctrl_select_state_locked(struct pinctrl *p,
pinmux_disable_setting(setting2);
}

if (old_state) {
list_for_each_entry(setting, &old_state->settings, node) {
bool found = false;
if (setting->type != PIN_MAP_TYPE_MUX_GROUP)
continue;
list_for_each_entry(setting2, &state->settings, node) {
if (setting2->type != PIN_MAP_TYPE_MUX_GROUP)
continue;
if (setting2->data.mux.group ==
setting->data.mux.group) {
found = true;
break;
}
}
if (!found)
pinmux_enable_setting(setting);
}
}
/* There's no infinite recursive loop here because p->state is NULL */
if (old_state)
pinctrl_select_state_locked(p, old_state);

p->state = old_state;
return ret;
}

Expand Down

0 comments on commit 385d942

Please sign in to comment.