Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 362989
b: refs/heads/master
c: 3102a76
h: refs/heads/master
i:
  362987: e54269c
v: v3
  • Loading branch information
Richard Genoud authored and Linus Walleij committed Mar 27, 2013
1 parent 99a0d8b commit d8e63b8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d3cee8305b48316ea416a73c763be3cb04bbc82b
refs/heads/master: 3102a76cfbf9ac4ae0cf54c7452f7ba4292a4760
28 changes: 25 additions & 3 deletions trunk/drivers/pinctrl/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ static int pinctrl_select_state_locked(struct pinctrl *p,
}
}

p->state = state;
p->state = NULL;

/* Apply all the settings for the new state */
list_for_each_entry(setting, &state->settings, node) {
Expand All @@ -946,13 +946,35 @@ static int pinctrl_select_state_locked(struct pinctrl *p,
ret = -EINVAL;
break;
}

if (ret < 0) {
/* FIXME: Difficult to return to prev state */
return ret;
goto unapply_new_state;
}
}

p->state = state;

return 0;

unapply_new_state:
pr_info("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:
/* FIXME: re-enable old setting */
return ret;
}

/**
Expand Down

0 comments on commit d8e63b8

Please sign in to comment.