From ee0522f52006cf6722dc783fe57ce86bbeda7aa2 Mon Sep 17 00:00:00 2001 From: Paul Barker Date: Mon, 16 Oct 2023 10:25:31 +0100 Subject: cmd: gpio: Skip output on -ENOENT On the Renesas RZ/G2L SoC family, valid GPIO numbers are not contiguous. This is determined by the device tree, where a fixed number of bits are used for the 'pin' number within a 'port', even though not all ports have the same number of pins. The device tree can't be changed here without breaking backwards compatibility in Linux, which we don't want to do. To avoid printing a status for each of these invalid GPIO numbers when a user executes `gpio status -a`, we allow gpio_get_function() to return -ENOENT when the given offset does not refer to a valid GPIO pin and we skip printing anything if this occurs. Signed-off-by: Paul Barker Reviewed-by: Marek Vasut --- cmd/gpio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/gpio.c b/cmd/gpio.c index f4565982ec..dab6f7097a 100644 --- a/cmd/gpio.c +++ b/cmd/gpio.c @@ -17,6 +17,7 @@ #endif #include #include +#include __weak int name_to_gpio(const char *name) { @@ -69,7 +70,8 @@ static void gpio_get_description(struct udevice *dev, const char *bank_name, printf("%s\n", buf); return; err: - printf("Error %d\n", ret); + if (ret != -ENOENT) + printf("Error %d\n", ret); } static int do_gpio_status(bool all, const char *gpio_name) -- cgit v1.2.3