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/4] pinctrl: create pinctrl_free_setting function
Date: Mon, 25 Mar 2013 15:47:21 +0100	[thread overview]
Message-ID: <1364222843-30305-3-git-send-email-richard.genoud@gmail.com> (raw)
In-Reply-To: <1364222843-30305-1-git-send-email-richard.genoud@gmail.com>

This prepares the implementation of pinctrl_select_state_locked() free code.

No functionnal change.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 drivers/pinctrl/core.c |   32 +++++++++++++++++++-------------
 1 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index b0de6e7..a28dcca 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -758,6 +758,24 @@ struct pinctrl *pinctrl_get(struct device *dev)
 }
 EXPORT_SYMBOL_GPL(pinctrl_get);
 
+static void pinctrl_free_setting(bool disable_setting,
+				 struct pinctrl_setting *setting)
+{
+	switch (setting->type) {
+	case PIN_MAP_TYPE_MUX_GROUP:
+		if (disable_setting)
+			pinmux_disable_setting(setting);
+		pinmux_free_setting(setting);
+		break;
+	case PIN_MAP_TYPE_CONFIGS_PIN:
+	case PIN_MAP_TYPE_CONFIGS_GROUP:
+		pinconf_free_setting(setting);
+		break;
+	default:
+		break;
+	}
+}
+
 static void pinctrl_put_locked(struct pinctrl *p, bool inlist)
 {
 	struct pinctrl_state *state, *n1;
@@ -765,19 +783,7 @@ static void pinctrl_put_locked(struct pinctrl *p, bool inlist)
 
 	list_for_each_entry_safe(state, n1, &p->states, node) {
 		list_for_each_entry_safe(setting, n2, &state->settings, node) {
-			switch (setting->type) {
-			case PIN_MAP_TYPE_MUX_GROUP:
-				if (state == p->state)
-					pinmux_disable_setting(setting);
-				pinmux_free_setting(setting);
-				break;
-			case PIN_MAP_TYPE_CONFIGS_PIN:
-			case PIN_MAP_TYPE_CONFIGS_GROUP:
-				pinconf_free_setting(setting);
-				break;
-			default:
-				break;
-			}
+			pinctrl_free_setting(state == p->state, setting);
 			list_del(&setting->node);
 			kfree(setting);
 		}
-- 
1.7.2.5


  parent reply	other threads:[~2013-03-25 14:54 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-25 14:47 [PATCH 0/4] pintrcl: restore old state when pinctrl_select_state fails Richard Genoud
2013-03-25 14:47 ` [PATCH 1/4] pinctrl: fix typo in header Richard Genoud
2013-03-27 22:13   ` Linus Walleij
2013-03-25 14:47 ` Richard Genoud [this message]
2013-03-27 22:15   ` [PATCH 2/4] pinctrl: create pinctrl_free_setting function Linus Walleij
2013-03-25 14:47 ` [PATCH 3/4] pinctrl: disable and free setting in select_state in case of error Richard Genoud
2013-03-27 22:17   ` Linus Walleij
2013-03-27 23:49   ` Stephen Warren
2013-03-28 10:55     ` Richard Genoud
2013-03-28 14:53       ` Stephen Warren
2013-03-28 15:47         ` Richard Genoud
2013-04-03 12:30           ` Linus Walleij
2013-04-03 12:36             ` Richard Genoud
2013-03-25 14:47 ` [PATCH 4/4] pinctrl: re-enable old state in case of error in pinctrl_select_state Richard Genoud
2013-03-27 22:18   ` Linus Walleij
2013-03-27 23:55   ` Stephen Warren
2013-03-28 11:35     ` Richard Genoud
2013-03-28 17:34     ` Richard GENOUD
2013-03-28 17:38       ` Stephen Warren
2013-03-28 18:06         ` Richard GENOUD

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=1364222843-30305-3-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®