aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/core.c
diff options
context:
space:
mode:
authorRichard Genoud <richard.genoud@gmail.com>2013-03-28 07:55:47 -0400
committerLinus Walleij <linus.walleij@linaro.org>2013-04-03 08:22:39 -0400
commit8009d5ff00df6ad595f2d389f2e32bd4b97aebf5 (patch)
tree57f7f3e21441f5865cda5700a519c3c8beda111e /drivers/pinctrl/core.c
parentda58751ca2490d5de3a0f7753fd7078c4285c2bc (diff)
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: 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.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 986d0e02761c..f04f7d3d9a94 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -967,20 +967,12 @@ static int pinctrl_select_state_locked(struct pinctrl *p,
967unapply_new_state: 967unapply_new_state:
968 dev_err(p->dev, "Error applying setting, reverse things back\n"); 968 dev_err(p->dev, "Error applying setting, reverse things back\n");
969 969
970 /*
971 * If the loop stopped on the 1st entry, nothing has been enabled,
972 * so jump directly to the 2nd phase
973 */
974 if (list_entry(&setting->node, typeof(*setting), node) ==
975 list_first_entry(&state->settings, typeof(*setting), node))
976 goto reapply_old_state;
977
978 list_for_each_entry(setting2, &state->settings, node) { 970 list_for_each_entry(setting2, &state->settings, node) {
979 if (&setting2->node == &setting->node) 971 if (&setting2->node == &setting->node)
980 break; 972 break;
981 pinctrl_free_setting(true, setting2); 973 pinctrl_free_setting(true, setting2);
982 } 974 }
983reapply_old_state: 975
984 if (old_state) { 976 if (old_state) {
985 list_for_each_entry(setting, &old_state->settings, node) { 977 list_for_each_entry(setting, &old_state->settings, node) {
986 bool found = false; 978 bool found = false;