summaryrefslogtreecommitdiff
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorMichael Walle <michael@walle.cc>2023-01-18 13:12:22 +0100
committerTom Rini <trini@konsulko.com>2023-01-27 12:51:26 -0500
commit72b8c6d1ebfd40a6ee6be0345ff7abb30c9f9e3d (patch)
treee9151f4fdda807982c521eade2078c0e6f5d1fc9 /drivers/pinctrl
parent337bc26f05e85bf06647a17bad9485a3428c9a2b (diff)
downloadu-boot-72b8c6d1ebfd40a6ee6be0345ff7abb30c9f9e3d.tar.gz
u-boot-72b8c6d1ebfd40a6ee6be0345ff7abb30c9f9e3d.tar.bz2
u-boot-72b8c6d1ebfd40a6ee6be0345ff7abb30c9f9e3d.zip
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 <michael@walle.cc> Reviewed-by: Marek Vasut <marex@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/pinctrl-uclass.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c
index a1b85ca87e..6978a93ef8 100644
--- a/drivers/pinctrl/pinctrl-uclass.c
+++ b/drivers/pinctrl/pinctrl-uclass.c
@@ -71,13 +71,13 @@ static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
*/
state = dectoul(statename, &end);
if (*end)
- return -EINVAL;
+ return -ENOSYS;
}
snprintf(propname, sizeof(propname), "pinctrl-%d", state);
list = dev_read_prop(dev, propname, &size);
if (!list)
- return -EINVAL;
+ return -ENOSYS;
size /= sizeof(*list);
for (i = 0; i < size; i++) {
@@ -162,11 +162,6 @@ U_BOOT_DRIVER(pinconfig_generic) = {
};
#else
-static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
-{
- return -ENODEV;
-}
-
static int pinconfig_post_bind(struct udevice *dev)
{
return 0;
@@ -317,10 +312,10 @@ int pinctrl_select_state(struct udevice *dev, const char *statename)
* Try full-implemented pinctrl first.
* If it fails or is not implemented, try simple one.
*/
- if (pinctrl_select_state_full(dev, statename))
- return pinctrl_select_state_simple(dev);
+ if (CONFIG_IS_ENABLED(PINCTRL_FULL))
+ return pinctrl_select_state_full(dev, statename);
- return 0;
+ return pinctrl_select_state_simple(dev);
}
int pinctrl_request(struct udevice *dev, int func, int flags)