diff mbox

[U-Boot] gpio: Correct handling of 'gpio status'

Message ID 1455492539-24868-1-git-send-email-sjg@chromium.org
State Accepted
Commit 4c80c53c00ac6583f22938fc98e4df688acdf4ce
Delegated to: Tom Rini
Headers show

Commit Message

Simon Glass Feb. 14, 2016, 11:28 p.m. UTC
This is broken - we need to look at the first two characters to distinguish
'gpio status' from 'gpio set'.

Fixes: 0ffe6ab5 (gpio: Allow 's' as an abbreviation for 'status')
Reported-by: Soeren Moch <smoch@web.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
---

 cmd/gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sören Moch Feb. 15, 2016, 7:36 a.m. UTC | #1
On 15.02.2016 00:28, Simon Glass wrote:
> This is broken - we need to look at the first two characters to distinguish
> 'gpio status' from 'gpio set'.
> 
> Fixes: 0ffe6ab5 (gpio: Allow 's' as an abbreviation for 'status')
> Reported-by: Soeren Moch <smoch@web.de>
> Signed-off-by: Simon Glass <sjg@chromium.org>

Tested-by: Soeren Moch <smoch@web.de>

With this patch 'gpio set' works again.

Thanks,
Soeren

> ---
> 
>  cmd/gpio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/cmd/gpio.c b/cmd/gpio.c
> index 2b78b16..693998e 100644
> --- a/cmd/gpio.c
> +++ b/cmd/gpio.c
> @@ -141,7 +141,7 @@ static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  #endif
>  	if (argc > 0)
>  		str_gpio = *argv;
> -	if (!strncmp(str_cmd, "status", 1)) {
> +	if (!strncmp(str_cmd, "status", 2)) {
>  		/* Support deprecated gpio_status() */
>  #ifdef gpio_status
>  		gpio_status();
>
Bin Meng Feb. 15, 2016, 11:02 a.m. UTC | #2
On Mon, Feb 15, 2016 at 7:28 AM, Simon Glass <sjg@chromium.org> wrote:
> This is broken - we need to look at the first two characters to distinguish
> 'gpio status' from 'gpio set'.
>
> Fixes: 0ffe6ab5 (gpio: Allow 's' as an abbreviation for 'status')
> Reported-by: Soeren Moch <smoch@web.de>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  cmd/gpio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Hannes Schmelzer Feb. 15, 2016, 11:03 a.m. UTC | #3
On 15.02.2016 00:28, Simon Glass wrote:
> This is broken - we need to look at the first two characters to distinguish
> 'gpio status' from 'gpio set'.
>
> Fixes: 0ffe6ab5 (gpio: Allow 's' as an abbreviation for 'status')
> Reported-by: Soeren Moch <smoch@web.de>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>   cmd/gpio.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/cmd/gpio.c b/cmd/gpio.c
> index 2b78b16..693998e 100644
> --- a/cmd/gpio.c
> +++ b/cmd/gpio.c
> @@ -141,7 +141,7 @@ static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>   #endif
>   	if (argc > 0)
>   		str_gpio = *argv;
> -	if (!strncmp(str_cmd, "status", 1)) {
> +	if (!strncmp(str_cmd, "status", 2)) {
>   		/* Support deprecated gpio_status() */
>   #ifdef gpio_status
>   		gpio_status();
Tested-by: Hannes Schmelzer <oe5hpm@oevsv.at>
Tom Rini Feb. 15, 2016, 10:36 p.m. UTC | #4
On Sun, Feb 14, 2016 at 04:28:59PM -0700, Simon Glass wrote:

> This is broken - we need to look at the first two characters to distinguish
> 'gpio status' from 'gpio set'.
> 
> Fixes: 0ffe6ab5 (gpio: Allow 's' as an abbreviation for 'status')
> Reported-by: Soeren Moch <smoch@web.de>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Tested-by: Soeren Moch <smoch@web.de>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> Tested-by: Hannes Schmelzer <oe5hpm@oevsv.at>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/cmd/gpio.c b/cmd/gpio.c
index 2b78b16..693998e 100644
--- a/cmd/gpio.c
+++ b/cmd/gpio.c
@@ -141,7 +141,7 @@  static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 #endif
 	if (argc > 0)
 		str_gpio = *argv;
-	if (!strncmp(str_cmd, "status", 1)) {
+	if (!strncmp(str_cmd, "status", 2)) {
 		/* Support deprecated gpio_status() */
 #ifdef gpio_status
 		gpio_status();