All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cmd: gpt: remove redundant print messages
@ 2021-03-30 21:34 Ravik Hasija
  2021-03-31  8:46 ` Patrick DELAUNAY
  2021-03-31 18:15 ` [PATCH v2] " Ravik Hasija
  0 siblings, 2 replies; 4+ messages in thread
From: Ravik Hasija @ 2021-03-30 21:34 UTC (permalink / raw)
  To: u-boot

Removing printfs from do_gpt API as the messages are generic and does not
specify error codes for failure cases.

Signed-off-by: Ravik Hasija <rahasij@linux.microsoft.com>
---
 cmd/gpt.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/cmd/gpt.c b/cmd/gpt.c
index 76a95ade6c..2c516745b0 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -992,11 +992,9 @@ static int do_gpt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 	}
 
 	if (ret) {
-		printf("error!\n");
 		return CMD_RET_FAILURE;
 	}
 
-	printf("success!\n");
 	return CMD_RET_SUCCESS;
 }
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] cmd: gpt: remove redundant print messages
  2021-03-30 21:34 [PATCH] cmd: gpt: remove redundant print messages Ravik Hasija
@ 2021-03-31  8:46 ` Patrick DELAUNAY
  2021-03-31 18:15 ` [PATCH v2] " Ravik Hasija
  1 sibling, 0 replies; 4+ messages in thread
From: Patrick DELAUNAY @ 2021-03-31  8:46 UTC (permalink / raw)
  To: u-boot

Hi,

On 3/30/21 11:34 PM, Ravik Hasija wrote:
> Removing printfs from do_gpt API as the messages are generic and does not
> specify error codes for failure cases.
>
> Signed-off-by: Ravik Hasija <rahasij@linux.microsoft.com>
> ---
>   cmd/gpt.c | 2 --
>   1 file changed, 2 deletions(-)
>
> diff --git a/cmd/gpt.c b/cmd/gpt.c
> index 76a95ade6c..2c516745b0 100644
> --- a/cmd/gpt.c
> +++ b/cmd/gpt.c
> @@ -992,11 +992,9 @@ static int do_gpt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
>   	}
>   
>   	if (ret) {
> -		printf("error!\n");
>   		return CMD_RET_FAILURE;
>   	}
>   
> -	printf("success!\n");
>   	return CMD_RET_SUCCESS;
>   }
>   


Before the patch the output of the gpt write command is

 ??? printf("Writing GPT: ");

 ??? printf("error!\n");

or

 ??? printf("success!\n");

=> I think if you remove only the result string and "\n" it is strange...

Same for Verify with

printf("Verify GPT: ");
And the user have no more information of the command result
of the console except by testing the command result...
I think this patch should done only for few sub-command used for scripting
(gpt setenv mmc 0 $name / gpt enumerate mmc /...)
or add a quiet option (-q) to avoid any printf)
Regards
Patrick

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] cmd: gpt: remove redundant print messages
  2021-03-30 21:34 [PATCH] cmd: gpt: remove redundant print messages Ravik Hasija
  2021-03-31  8:46 ` Patrick DELAUNAY
@ 2021-03-31 18:15 ` Ravik Hasija
  2021-04-19 15:10   ` Tom Rini
  1 sibling, 1 reply; 4+ messages in thread
From: Ravik Hasija @ 2021-03-31 18:15 UTC (permalink / raw)
  To: u-boot

Removing printfs from do_gpt API as the messages are generic and does not
specify error codes for failure cases.

Signed-off-by: Ravik Hasija <rahasij@linux.microsoft.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
---
Changes for v2:
  - Updated usage message for gpt read
  - Added removed printfs for write & verify
  - Rearranged verify printf
---
 cmd/gpt.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/cmd/gpt.c b/cmd/gpt.c
index 76a95ade6c..ba0fa4c69c 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -971,9 +971,11 @@ static int do_gpt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 	if ((strcmp(argv[1], "write") == 0) && (argc == 5)) {
 		printf("Writing GPT: ");
 		ret = gpt_default(blk_dev_desc, argv[4]);
+		ret ? printf("error!\n") : printf("success!\n");
 	} else if ((strcmp(argv[1], "verify") == 0)) {
-		ret = gpt_verify(blk_dev_desc, argv[4]);
 		printf("Verify GPT: ");
+		ret = gpt_verify(blk_dev_desc, argv[4]);
+		ret ? printf("error!\n") : printf("success!\n");
 	} else if ((strcmp(argv[1], "setenv") == 0)) {
 		ret = gpt_setenv(blk_dev_desc, argv[4]);
 	} else if ((strcmp(argv[1], "enumerate") == 0)) {
@@ -992,11 +994,9 @@ static int do_gpt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 	}
 
 	if (ret) {
-		printf("error!\n");
 		return CMD_RET_FAILURE;
 	}
 
-	printf("success!\n");
 	return CMD_RET_SUCCESS;
 }
 
@@ -1017,7 +1017,7 @@ U_BOOT_CMD(gpt, CONFIG_SYS_MAXARGS, 1, do_gpt,
 	"      gpt_partition_name, gpt_partition_entry\n"
 	" gpt enumerate mmc 0\n"
 	"    - store list of partitions to gpt_partition_list environment variable\n"
-	" read <interface> <dev>\n"
+	" gpt read <interface> <dev>\n"
 	"    - read GPT into a data structure for manipulation\n"
 	" gpt guid <interface> <dev>\n"
 	"    - print disk GUID\n"
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2] cmd: gpt: remove redundant print messages
  2021-03-31 18:15 ` [PATCH v2] " Ravik Hasija
@ 2021-04-19 15:10   ` Tom Rini
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2021-04-19 15:10 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 31, 2021 at 11:15:49AM -0700, Ravik Hasija wrote:

> Removing printfs from do_gpt API as the messages are generic and does not
> specify error codes for failure cases.
> 
> Signed-off-by: Ravik Hasija <rahasij@linux.microsoft.com>
> Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
> Changes for v2:
>   - Updated usage message for gpt read
>   - Added removed printfs for write & verify
>   - Rearranged verify printf

This change in output breaks test_gpt_verify (see
test/py/tests/test_gpt.py) so that needs to be updated at the same time,
thanks.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210419/022a784d/attachment.sig>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-19 15:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-30 21:34 [PATCH] cmd: gpt: remove redundant print messages Ravik Hasija
2021-03-31  8:46 ` Patrick DELAUNAY
2021-03-31 18:15 ` [PATCH v2] " Ravik Hasija
2021-04-19 15:10   ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.