mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Genoud <richard.genoud@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>,
	Stephen Warren <swarren@nvidia.com>
Cc: linux-kernel@vger.kernel.org, Richard Genoud <richard.genoud@gmail.com>
Subject: [PATCH 2/3] pinctrl: remove superfluous optimization in pinctrl_select_state_locked
Date: Thu, 28 Mar 2013 12:55:47 +0100	[thread overview]
Message-ID: <1364471748-23192-2-git-send-email-richard.genoud@gmail.com> (raw)
In-Reply-To: <1364471748-23192-1-git-send-email-richard.genoud@gmail.com>

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>
---
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


  reply	other threads:[~2013-03-28 11:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-28 11:55 [PATCH 1/3] pinctrl: use dev_info instead of pr_info " Richard Genoud
2013-03-28 11:55 ` Richard Genoud [this message]
2013-03-28 14:58   ` [PATCH 2/3] pinctrl: remove superfluous optimization " Stephen Warren
2013-04-03 12:26   ` Linus Walleij
2013-03-28 11:55 ` [PATCH 3/3] pinctrl: pinctrl_select_state: set the old_state back on error Richard Genoud
2013-03-28 14:58   ` Stephen Warren
2013-04-03 12:28   ` Linus Walleij
2013-03-28 14:57 ` [PATCH 1/3] pinctrl: use dev_info instead of pr_info in pinctrl_select_state_locked Stephen Warren
2013-04-03 12:21 ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1364471748-23192-2-git-send-email-richard.genoud@gmail.com \
    --to=richard.genoud@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=swarren@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome