Skip to content

Commit 72b8c6d

Browse files
mwalletrini
authored andcommitted
pinctrl: don't fall back to pinctrl_select_state_simple()
If CONFIG_PINCTRL_FULL is enabled, never fall back to the simple implementation. pinctrl_select_state() is called for each device and it is expected to fail. A fallback to the simple imeplementation doesn't make much sense. To keep the return code consistent, we need to change the -EINVAL (which was ignored before) to -ENOSYS. Signed-off-by: Michael Walle <[email protected]> Reviewed-by: Marek Vasut <[email protected]> Reviewed-by: Simon Glass <[email protected]>
1 parent 337bc26 commit 72b8c6d

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

drivers/pinctrl/pinctrl-uclass.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
7171
*/
7272
state = dectoul(statename, &end);
7373
if (*end)
74-
return -EINVAL;
74+
return -ENOSYS;
7575
}
7676

7777
snprintf(propname, sizeof(propname), "pinctrl-%d", state);
7878
list = dev_read_prop(dev, propname, &size);
7979
if (!list)
80-
return -EINVAL;
80+
return -ENOSYS;
8181

8282
size /= sizeof(*list);
8383
for (i = 0; i < size; i++) {
@@ -162,11 +162,6 @@ U_BOOT_DRIVER(pinconfig_generic) = {
162162
};
163163

164164
#else
165-
static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
166-
{
167-
return -ENODEV;
168-
}
169-
170165
static int pinconfig_post_bind(struct udevice *dev)
171166
{
172167
return 0;
@@ -317,10 +312,10 @@ int pinctrl_select_state(struct udevice *dev, const char *statename)
317312
* Try full-implemented pinctrl first.
318313
* If it fails or is not implemented, try simple one.
319314
*/
320-
if (pinctrl_select_state_full(dev, statename))
321-
return pinctrl_select_state_simple(dev);
315+
if (CONFIG_IS_ENABLED(PINCTRL_FULL))
316+
return pinctrl_select_state_full(dev, statename);
322317

323-
return 0;
318+
return pinctrl_select_state_simple(dev);
324319
}
325320

326321
int pinctrl_request(struct udevice *dev, int func, int flags)

0 commit comments

Comments
 (0)