Commit 7864d926 authored by Sebastian Hesselbarth's avatar Sebastian Hesselbarth Committed by Linus Walleij

pinctrl: mvebu: fix num_settings in mpp group assignment

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: 0581b16b ("pinctrl: mvebu: complain about missing group after checking variant")
Reported-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
Tested-by: default avatarAaro 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: default avatarSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 111f2b87
...@@ -666,16 +666,19 @@ int mvebu_pinctrl_probe(struct platform_device *pdev) ...@@ -666,16 +666,19 @@ int mvebu_pinctrl_probe(struct platform_device *pdev)
struct mvebu_mpp_ctrl_setting *set = &mode->settings[0]; struct mvebu_mpp_ctrl_setting *set = &mode->settings[0];
struct mvebu_pinctrl_group *grp; struct mvebu_pinctrl_group *grp;
unsigned num_settings; unsigned num_settings;
unsigned supp_settings;
for (num_settings = 0; ; set++) { for (num_settings = 0, supp_settings = 0; ; set++) {
if (!set->name) if (!set->name)
break; break;
num_settings++;
/* skip unsupported settings for this variant */ /* skip unsupported settings for this variant */
if (pctl->variant && !(pctl->variant & set->variant)) if (pctl->variant && !(pctl->variant & set->variant))
continue; continue;
num_settings++; supp_settings++;
/* find gpio/gpo/gpi settings */ /* find gpio/gpo/gpi settings */
if (strcmp(set->name, "gpio") == 0) if (strcmp(set->name, "gpio") == 0)
...@@ -688,7 +691,7 @@ int mvebu_pinctrl_probe(struct platform_device *pdev) ...@@ -688,7 +691,7 @@ int mvebu_pinctrl_probe(struct platform_device *pdev)
} }
/* skip modes with no settings for this variant */ /* skip modes with no settings for this variant */
if (!num_settings) if (!supp_settings)
continue; continue;
grp = mvebu_pinctrl_find_group_by_pid(pctl, mode->pid); grp = mvebu_pinctrl_find_group_by_pid(pctl, mode->pid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment