diff mbox series

[v4,1/5] command: Use a constant pointer for the help

Message ID 20210919214937.3829422-2-sjg@chromium.org
State Accepted
Commit 6b03448713c20dd71ab6cc8e2c1c326db0148169
Delegated to: Simon Glass
Headers show
Series sf: Add documentation and an 'sf mmap' command | expand

Commit Message

Simon Glass Sept. 19, 2021, 9:49 p.m. UTC
This text should never change during execution, so it makes sense to
use a const char * so that it can be declared as const in the code.
Update struct cmd_tbl with a const char * pointer for 'help'.

We cannot make usage const because of the bmode command, used on mx53ppd
for example.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v2)

Changes in v2:
- Explain why 'usage' cannot be const

 include/command.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jagan Teki Oct. 8, 2021, 12:40 p.m. UTC | #1
On Mon, Sep 20, 2021 at 3:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> This text should never change during execution, so it makes sense to
> use a const char * so that it can be declared as const in the code.
> Update struct cmd_tbl with a const char * pointer for 'help'.
>
> We cannot make usage const because of the bmode command, used on mx53ppd
> for example.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> (no changes since v2)
>
> Changes in v2:
> - Explain why 'usage' cannot be const

Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Heinrich Schuchardt Nov. 13, 2021, 11:13 a.m. UTC | #2
On 9/19/21 23:49, Simon Glass wrote:
> This text should never change during execution, so it makes sense to
> use a const char * so that it can be declared as const in the code.
> Update struct cmd_tbl with a const char * pointer for 'help'.
>
> We cannot make usage const because of the bmode command, used on mx53ppd
> for example.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

> ---
>
> (no changes since v2)
>
> Changes in v2:
> - Explain why 'usage' cannot be const
>
>   include/command.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/command.h b/include/command.h
> index 137cfbc3231..f8e07a591c6 100644
> --- a/include/command.h
> +++ b/include/command.h
> @@ -45,7 +45,7 @@ struct cmd_tbl {
>   			       char *const argv[]);
>   	char		*usage;		/* Usage message	(short)	*/
>   #ifdef	CONFIG_SYS_LONGHELP
> -	char		*help;		/* Help  message	(long)	*/
> +	const char	*help;		/* Help  message	(long)	*/
>   #endif
>   #ifdef CONFIG_AUTO_COMPLETE
>   	/* do auto completion on the arguments */
>
Simon Glass Nov. 24, 2021, 5:47 p.m. UTC | #3
On 9/19/21 23:49, Simon Glass wrote:
> This text should never change during execution, so it makes sense to
> use a const char * so that it can be declared as const in the code.
> Update struct cmd_tbl with a const char * pointer for 'help'.
>
> We cannot make usage const because of the bmode command, used on mx53ppd
> for example.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

> ---
>
> (no changes since v2)
>
> Changes in v2:
> - Explain why 'usage' cannot be const
>
>   include/command.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
Applied to u-boot-dm, thanks!
Simon Glass Nov. 24, 2021, 5:47 p.m. UTC | #4
On 9/19/21 23:49, Simon Glass wrote:
> This text should never change during execution, so it makes sense to
> use a const char * so that it can be declared as const in the code.
> Update struct cmd_tbl with a const char * pointer for 'help'.
>
> We cannot make usage const because of the bmode command, used on mx53ppd
> for example.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

> ---
>
> (no changes since v2)
>
> Changes in v2:
> - Explain why 'usage' cannot be const
>
>   include/command.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
Applied to u-boot-dm, thanks!
Applied to u-boot-dm/next, thanks!
diff mbox series

Patch

diff --git a/include/command.h b/include/command.h
index 137cfbc3231..f8e07a591c6 100644
--- a/include/command.h
+++ b/include/command.h
@@ -45,7 +45,7 @@  struct cmd_tbl {
 			       char *const argv[]);
 	char		*usage;		/* Usage message	(short)	*/
 #ifdef	CONFIG_SYS_LONGHELP
-	char		*help;		/* Help  message	(long)	*/
+	const char	*help;		/* Help  message	(long)	*/
 #endif
 #ifdef CONFIG_AUTO_COMPLETE
 	/* do auto completion on the arguments */