X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=common%2Fcmd_gpio.c;h=11f4e4031daddca8570892c53c47e16a198cee8a;hb=6126c8e88609286c04600da9dce7a7537f568845;hp=b97533f313d3960c0b22f03108b779946a533724;hpb=89e6405425c7b52fd1330c61b6f5526612b87516;p=karo-tx-uboot.git diff --git a/common/cmd_gpio.c b/common/cmd_gpio.c index b97533f313..11f4e4031d 100644 --- a/common/cmd_gpio.c +++ b/common/cmd_gpio.c @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -135,9 +136,9 @@ static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) enum gpio_cmd sub_cmd; ulong value; const char *str_cmd, *str_gpio = NULL; + int ret; #ifdef CONFIG_DM_GPIO bool all = false; - int ret; #endif if (argc < 2) @@ -197,7 +198,8 @@ static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) goto show_usage; #endif /* grab the pin before we tweak it */ - if (gpio_request(gpio, "cmd_gpio")) { + ret = gpio_request(gpio, "cmd_gpio"); + if (ret && ret != -EBUSY) { printf("gpio: requesting pin %u failed\n", gpio); return -1; } @@ -218,7 +220,8 @@ static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) printf("gpio: pin %s (gpio %i) value is %lu\n", str_gpio, gpio, value); - gpio_free(gpio); + if (ret != -EBUSY) + gpio_free(gpio); return value; }