From: Richard Genoud Date: Fri, 29 Mar 2013 09:03:27 +0000 (+0100) Subject: pinctrl: simplify the re-enable old state code in pinctrl_select_state X-Git-Tag: upstream/snapshot3+hdmi~5294^2~24 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=385d94246b05f7c06d7ecb5215087e5ebddbf1e6;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git 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 Reviewed-by: Stephen Warren Signed-off-by: Linus Walleij --- diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index deb3d04..8b832ce 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -981,26 +981,10 @@ unapply_new_state: 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; }