提交 8009d5ff 编写于 作者: R Richard Genoud 提交者: Linus Walleij

pinctrl: remove superfluous optimization in pinctrl_select_state_locked

As Stephen Warren suggested, checking first if the setting->node entry
is the first in the list or not is superfluous, as it is checked again
in the list_for_each_entry bellow.
So, remove it, the code will be simpler and lighter !
Signed-off-by: NRichard Genoud <richard.genoud@gmail.com>
Reviewed-by: NStephen Warren <swarren@nvidia.com>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 da58751c
......@@ -967,20 +967,12 @@ static int pinctrl_select_state_locked(struct pinctrl *p,
unapply_new_state:
dev_err(p->dev, "Error applying setting, reverse things back\n");
/*
* If the loop stopped on the 1st entry, nothing has been enabled,
* so jump directly to the 2nd phase
*/
if (list_entry(&setting->node, typeof(*setting), node) ==
list_first_entry(&state->settings, typeof(*setting), node))
goto reapply_old_state;
list_for_each_entry(setting2, &state->settings, node) {
if (&setting2->node == &setting->node)
break;
pinctrl_free_setting(true, setting2);
}
reapply_old_state:
if (old_state) {
list_for_each_entry(setting, &old_state->settings, node) {
bool found = false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册