summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-11-22 09:41:24 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-11-27 12:07:07 +0100
commit17a517c0fcf21cbd1882108c18fa845930927563 (patch)
treee51784330e1f1318709eba4a573493c2cef1c8d5 /commands
parent6441dfa8307a564f797b868a74205fe9c2f42eb0 (diff)
downloadbarebox-17a517c0fcf21cbd1882108c18fa845930927563.tar.gz
barebox-17a517c0fcf21cbd1882108c18fa845930927563.tar.xz
gpio: Introduce GPIO names
This introduces GPIO names. So far we only have labels which are given by the requester. In contrast names are given by the provider and do not change depending on whoever requests a GPIO. The gpio commands now also accept to reference a GPIO by name. The printing of the gpioinfo command is adjusted to nicely print both the label and the name. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/gpio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/commands/gpio.c b/commands/gpio.c
index 951ad2c285..6d88ab6bbe 100644
--- a/commands/gpio.c
+++ b/commands/gpio.c
@@ -25,7 +25,9 @@ static int get_gpio_and_value(int argc, char *argv[],
if (argc < count)
return COMMAND_ERROR_USAGE;
- *gpio = gpio_find_by_label(argv[1]);
+ *gpio = gpio_find_by_name(argv[1]);
+ if (*gpio < 0)
+ *gpio = gpio_find_by_label(argv[1]);
if (*gpio < 0) {
ret = kstrtoint(argv[1], 0, gpio);
if (ret < 0)