[PATCH 08/11] commands: gpio: Allow GPIOs to be specified by label

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx>
---
 commands/gpio.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/commands/gpio.c b/commands/gpio.c
index 3a2b8624f..951ad2c28 100644
--- a/commands/gpio.c
+++ b/commands/gpio.c
@@ -20,14 +20,17 @@ static int get_gpio_and_value(int argc, char *argv[],
 			      int *gpio, int *value)
 {
 	const int count = value ? 3 : 2;
-	int ret;
+	int ret = 0;
 
 	if (argc < count)
 		return COMMAND_ERROR_USAGE;
 
-	ret = kstrtoint(argv[1], 0, gpio);
-	if (ret < 0)
-		return ret;
+	*gpio = gpio_find_by_label(argv[1]);
+	if (*gpio < 0) {
+		ret = kstrtoint(argv[1], 0, gpio);
+		if (ret < 0)
+			return ret;
+	}
 
 	if (value)
 		ret = kstrtoint(argv[2], 0, value);
-- 
2.17.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux