Commit 385d9424 authored by Richard Genoud's avatar Richard Genoud Committed by Linus Walleij

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: default avatarRichard Genoud <richard.genoud@gmail.com>
Reviewed-by: default avatarStephen Warren <swarren@nvidia.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent af606177
...@@ -981,26 +981,10 @@ static int pinctrl_select_state_locked(struct pinctrl *p, ...@@ -981,26 +981,10 @@ static int pinctrl_select_state_locked(struct pinctrl *p,
pinmux_disable_setting(setting2); pinmux_disable_setting(setting2);
} }
if (old_state) { /* There's no infinite recursive loop here because p->state is NULL */
list_for_each_entry(setting, &old_state->settings, node) { if (old_state)
bool found = false; pinctrl_select_state_locked(p, old_state);
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);
}
}
p->state = old_state;
return ret; return ret;
} }
......
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