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/2] pinctrl: simplify the re-enable old state code in pinctrl_select_state
Date: Fri, 29 Mar 2013 10:03:27 +0100	[thread overview]
Message-ID: <1364547807-22370-2-git-send-email-richard.genoud@gmail.com> (raw)
In-Reply-To: <1364547807-22370-1-git-send-email-richard.genoud@gmail.com>

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 <richard.genoud@gmail.com>
---
 drivers/pinctrl/core.c |   22 +++-------------------
 1 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index ddd9a150..caf9bf9 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -937,26 +937,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;
 }
 
-- 
1.7.2.5


  reply	other threads:[~2013-03-29  9:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-29  9:03 [PATCH 1/2] pinctrl: select_state: don't call pinctrl_free_setting on error Richard Genoud
2013-03-29  9:03 ` Richard Genoud [this message]
2013-03-29 16:10   ` [PATCH 2/2] pinctrl: simplify the re-enable old state code in pinctrl_select_state Stephen Warren
2013-04-03 12:39   ` Linus Walleij
2013-03-29 16:09 ` [PATCH 1/2] pinctrl: select_state: don't call pinctrl_free_setting on error Stephen Warren
2013-04-03 12:37 ` 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=1364547807-22370-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

all inboxes | Powered by JetHome®