[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1364471748-23192-2-git-send-email-richard.genoud@gmail.com>
Date: Thu, 28 Mar 2013 12:55:47 +0100
From: Richard Genoud <richard.genoud@...il.com>
To: Linus Walleij <linus.walleij@...aro.org>,
Stephen Warren <swarren@...dia.com>
Cc: linux-kernel@...r.kernel.org,
Richard Genoud <richard.genoud@...il.com>
Subject: [PATCH 2/3] 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@...il.com>
---
If can also be squashed whit commit:
3102a76cfbf9ac4ae0cf54c7452f7ba4292a4760
"pinctrl: disable and free setting in select_state in case of error"
(But there will be a conflict on "if (old_state)" vs "FIXME comment")
drivers/pinctrl/core.c | 10 +---------
1 files changed, 1 insertions(+), 9 deletions(-)
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index b98a275..7c34937 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -923,20 +923,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;
--
1.7.2.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists