aboutsummaryrefslogtreecommitdiff
path: root/cmd/gpio.c
diff options
context:
space:
mode:
authorAlex Kiernan <alex.kiernan@gmail.com>2020-03-11 08:46:29 +0000
committerTom Rini <trini@konsulko.com>2020-03-13 09:30:30 -0400
commit4af2a33ee5b91223f993af9bb0de1a081090634b (patch)
tree0df4c0755bfc29e427d76f9cca984464276ebbb8 /cmd/gpio.c
parentdde1b75e9526d887a9aba9d4b30eb62ad2f22013 (diff)
downloadu-boot-4af2a33ee5b91223f993af9bb0de1a081090634b.zip
u-boot-4af2a33ee5b91223f993af9bb0de1a081090634b.tar.gz
u-boot-4af2a33ee5b91223f993af9bb0de1a081090634b.tar.bz2
cmd: gpio: Make `gpio input` return pin value again
4dbc107f4683 ("cmd: gpio: Correct do_gpio() return value") correctly changed the behaviour of the gpio command to return CMD_RET_SUCCESS or CMD_RET_FAILURE, but any existing script which expects the return value to be the pin value is broken by this change. Reinstate the legacy behaviour for `gpio input` only. Fixes: 4dbc107f4683 ("cmd: gpio: Correct do_gpio() return value") Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Signed-off-by: Alex Kiernan <alex.kiernan@hivehome.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd/gpio.c')
-rw-r--r--cmd/gpio.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/cmd/gpio.c b/cmd/gpio.c
index 16c2ceb..408a942 100644
--- a/cmd/gpio.c
+++ b/cmd/gpio.c
@@ -248,7 +248,12 @@ static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (ret != -EBUSY)
gpio_free(gpio);
- return CMD_RET_SUCCESS;
+ /*
+ * Whilst wrong, the legacy gpio input command returns the pin
+ * value, or CMD_RET_FAILURE (which is indistinguishable from a
+ * valid pin value).
+ */
+ return (sub_cmd == GPIOC_INPUT) ? value : CMD_RET_SUCCESS;
err:
if (ret != -EBUSY)