All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] pinctrl: use dev_info instead of pr_info in pinctrl_select_state_locked
@ 2013-03-28 11:55 Richard Genoud
  2013-03-28 11:55 ` [PATCH 2/3] pinctrl: remove superfluous optimization " Richard Genoud
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Richard Genoud @ 2013-03-28 11:55 UTC (permalink / raw)
  To: Linus Walleij, Stephen Warren; +Cc: linux-kernel, Richard Genoud

And remove superfluous brackets.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
If it's not too late, it can be squashed with commit:
3102a76cfbf9ac4ae0cf54c7452f7ba4292a4760
"pinctrl: disable and free setting in select_state in case of error"

 drivers/pinctrl/core.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 9b505acc..b98a275 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -912,9 +912,8 @@ static int pinctrl_select_state_locked(struct pinctrl *p,
 			break;
 		}
 
-		if (ret < 0) {
+		if (ret < 0)
 			goto unapply_new_state;
-		}
 	}
 
 	p->state = state;
@@ -922,7 +921,7 @@ static int pinctrl_select_state_locked(struct pinctrl *p,
 	return 0;
 
 unapply_new_state:
-	pr_info("Error applying setting, reverse things back\n");
+	dev_err(p->dev, "Error applying setting, reverse things back\n");
 
 	/*
 	 * If the loop stopped on the 1st entry, nothing has been enabled,
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] pinctrl: remove superfluous optimization in pinctrl_select_state_locked
  2013-03-28 11:55 [PATCH 1/3] pinctrl: use dev_info instead of pr_info in pinctrl_select_state_locked Richard Genoud
@ 2013-03-28 11:55 ` Richard Genoud
  2013-03-28 14:58   ` 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
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 9+ messages in thread
From: Richard Genoud @ 2013-03-28 11:55 UTC (permalink / raw)
  To: Linus Walleij, Stephen Warren; +Cc: linux-kernel, Richard Genoud

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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] pinctrl: pinctrl_select_state: set the old_state back on error
  2013-03-28 11:55 [PATCH 1/3] pinctrl: use dev_info instead of pr_info in pinctrl_select_state_locked Richard Genoud
  2013-03-28 11:55 ` [PATCH 2/3] pinctrl: remove superfluous optimization " Richard Genoud
@ 2013-03-28 11:55 ` 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
  3 siblings, 2 replies; 9+ messages in thread
From: Richard Genoud @ 2013-03-28 11:55 UTC (permalink / raw)
  To: Linus Walleij, Stephen Warren; +Cc: linux-kernel, Richard Genoud

In unapply_new_state, the old state is re-applied, but p->state is not
set back as it should.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
This one can be squshed with commit:
50cf7c8ab324de348990bb028ad9ed10872d527a
pinctrl: re-enable old state in case of error in pinctrl_select_state
If needed.

 drivers/pinctrl/core.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 7c34937..714cf74 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -947,6 +947,8 @@ unapply_new_state:
 				pinmux_enable_setting(setting);
 		}
 	}
+
+	p->state = old_state;
 	return ret;
 }
 
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] pinctrl: use dev_info instead of pr_info in pinctrl_select_state_locked
  2013-03-28 11:55 [PATCH 1/3] pinctrl: use dev_info instead of pr_info in pinctrl_select_state_locked Richard Genoud
  2013-03-28 11:55 ` [PATCH 2/3] pinctrl: remove superfluous optimization " Richard Genoud
  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:57 ` Stephen Warren
  2013-04-03 12:21 ` Linus Walleij
  3 siblings, 0 replies; 9+ messages in thread
From: Stephen Warren @ 2013-03-28 14:57 UTC (permalink / raw)
  To: Richard Genoud; +Cc: Linus Walleij, linux-kernel

On 03/28/2013 05:55 AM, Richard Genoud wrote:
> And remove superfluous brackets.

(Seems like those unrelated changes might have benefited from being two
separate patches, but not a big deal, especially if this actually gets
squashed)

Reviewed-by: Stephen Warren <swarren@nvidia.com>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] pinctrl: remove superfluous optimization in pinctrl_select_state_locked
  2013-03-28 11:55 ` [PATCH 2/3] pinctrl: remove superfluous optimization " Richard Genoud
@ 2013-03-28 14:58   ` Stephen Warren
  2013-04-03 12:26   ` Linus Walleij
  1 sibling, 0 replies; 9+ messages in thread
From: Stephen Warren @ 2013-03-28 14:58 UTC (permalink / raw)
  To: Richard Genoud; +Cc: Linus Walleij, linux-kernel

On 03/28/2013 05:55 AM, Richard Genoud wrote:
> 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 !

Reviewed-by: Stephen Warren <swarren@nvidia.com>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] pinctrl: pinctrl_select_state: set the old_state back on error
  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
  1 sibling, 0 replies; 9+ messages in thread
From: Stephen Warren @ 2013-03-28 14:58 UTC (permalink / raw)
  To: Richard Genoud; +Cc: Linus Walleij, linux-kernel

On 03/28/2013 05:55 AM, Richard Genoud wrote:
> In unapply_new_state, the old state is re-applied, but p->state is not
> set back as it should.

Reviewed-by: Stephen Warren <swarren@nvidia.com>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] pinctrl: use dev_info instead of pr_info in pinctrl_select_state_locked
  2013-03-28 11:55 [PATCH 1/3] pinctrl: use dev_info instead of pr_info in pinctrl_select_state_locked Richard Genoud
                   ` (2 preceding siblings ...)
  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
  3 siblings, 0 replies; 9+ messages in thread
From: Linus Walleij @ 2013-04-03 12:21 UTC (permalink / raw)
  To: Richard Genoud; +Cc: Stephen Warren, linux-kernel

On Thu, Mar 28, 2013 at 12:55 PM, Richard Genoud
<richard.genoud@gmail.com> wrote:

> And remove superfluous brackets.
>
> Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
> ---
> If it's not too late, it can be squashed with commit:
> 3102a76cfbf9ac4ae0cf54c7452f7ba4292a4760
> "pinctrl: disable and free setting in select_state in case of error"

Bah, applied as-is with Stephen's Review-tag.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] pinctrl: remove superfluous optimization in pinctrl_select_state_locked
  2013-03-28 11:55 ` [PATCH 2/3] pinctrl: remove superfluous optimization " Richard Genoud
  2013-03-28 14:58   ` Stephen Warren
@ 2013-04-03 12:26   ` Linus Walleij
  1 sibling, 0 replies; 9+ messages in thread
From: Linus Walleij @ 2013-04-03 12:26 UTC (permalink / raw)
  To: Richard Genoud; +Cc: Stephen Warren, linux-kernel

On Thu, Mar 28, 2013 at 12:55 PM, Richard Genoud
<richard.genoud@gmail.com> wrote:

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

Applied with Stephen's Reviewed tag.

Thanks,
Linus Walleij

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] pinctrl: pinctrl_select_state: set the old_state back on error
  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
  1 sibling, 0 replies; 9+ messages in thread
From: Linus Walleij @ 2013-04-03 12:28 UTC (permalink / raw)
  To: Richard Genoud; +Cc: Stephen Warren, linux-kernel

On Thu, Mar 28, 2013 at 12:55 PM, Richard Genoud
<richard.genoud@gmail.com> wrote:

> In unapply_new_state, the old state is re-applied, but p->state is not
> set back as it should.
>
> Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
> ---
> This one can be squshed with commit:
> 50cf7c8ab324de348990bb028ad9ed10872d527a
> pinctrl: re-enable old state in case of error in pinctrl_select_state
> If needed.

Applied with Stepgen's Review-tag.

Thanks,
Linus Walleij

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-04-03 12:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-28 11:55 [PATCH 1/3] pinctrl: use dev_info instead of pr_info in pinctrl_select_state_locked Richard Genoud
2013-03-28 11:55 ` [PATCH 2/3] pinctrl: remove superfluous optimization " Richard Genoud
2013-03-28 14:58   ` 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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.