Skip to content

Commit

Permalink
pinctrl: mvebu: fix num_settings in mpp group assignment
Browse files Browse the repository at this point in the history
When assigning mpp settings from static mpp modes to mpp groups,
we do not want any groups that have no supported setting for a
specific Kirkwood variant. However, when there is at least a
single supported setting, we need to assign the number of all
settings in this mode to grp->num_settings as we are reusing
the static modes table.

Fixes: 0581b16 ("pinctrl: mvebu: complain about missing group after checking variant")
Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Gregory Clement <gregory.clement@free-electrons.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
shesselba authored and linusw committed Feb 13, 2016
1 parent 111f2b8 commit 7864d92
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/pinctrl/mvebu/pinctrl-mvebu.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,16 +666,19 @@ int mvebu_pinctrl_probe(struct platform_device *pdev)
struct mvebu_mpp_ctrl_setting *set = &mode->settings[0];
struct mvebu_pinctrl_group *grp;
unsigned num_settings;
unsigned supp_settings;

for (num_settings = 0; ; set++) {
for (num_settings = 0, supp_settings = 0; ; set++) {
if (!set->name)
break;

num_settings++;

/* skip unsupported settings for this variant */
if (pctl->variant && !(pctl->variant & set->variant))
continue;

num_settings++;
supp_settings++;

/* find gpio/gpo/gpi settings */
if (strcmp(set->name, "gpio") == 0)
Expand All @@ -688,7 +691,7 @@ int mvebu_pinctrl_probe(struct platform_device *pdev)
}

/* skip modes with no settings for this variant */
if (!num_settings)
if (!supp_settings)
continue;

grp = mvebu_pinctrl_find_group_by_pid(pctl, mode->pid);
Expand Down

0 comments on commit 7864d92

Please sign in to comment.