diff mbox

[U-Boot,1/2] hush: Pull out U-Boot prompt display and read functionality

Message ID 1453866475-6759-1-git-send-email-marex@denx.de
State Accepted
Commit 13d3046fa392625f172d55cba8eb551f47e45f3f
Delegated to: Tom Rini
Headers show

Commit Message

Marek Vasut Jan. 27, 2016, 3:47 a.m. UTC
Pull the code which displays U-Boot prompt and reads the command line
into a separate function. No functional change.

Signed-off-by: Marek Vasut <marex@denx.de>
---
 common/cli_hush.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

Comments

Heiko Schocher Jan. 27, 2016, 6:34 a.m. UTC | #1
Hello Marek,

Am 27.01.2016 um 04:47 schrieb Marek Vasut:
> Pull the code which displays U-Boot prompt and reads the command line
> into a separate function. No functional change.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
>   common/cli_hush.c | 21 ++++++++++++++++-----
>   1 file changed, 16 insertions(+), 5 deletions(-)

Reviewed-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
>
> diff --git a/common/cli_hush.c b/common/cli_hush.c
> index 2fbfdbe..cbaf22e 100644
> --- a/common/cli_hush.c
> +++ b/common/cli_hush.c
> @@ -974,6 +974,20 @@ static inline void setup_prompt_string(int promptmode, char **prompt_str)
>   }
>   #endif
>
> +#ifdef __U_BOOT__
> +static int uboot_cli_readline(struct in_str *i)
> +{
> +	char *prompt;
> +
> +	if (i->promptmode == 1)
> +		prompt = CONFIG_SYS_PROMPT;
> +	else
> +		prompt = CONFIG_SYS_PROMPT_HUSH_PS2;
> +
> +	return cli_readline(prompt);
> +}
> +#endif
> +
>   static void get_user_input(struct in_str *i)
>   {
>   #ifndef __U_BOOT__
> @@ -1003,11 +1017,8 @@ static void get_user_input(struct in_str *i)
>
>   	bootretry_reset_cmd_timeout();
>   	i->__promptme = 1;
> -	if (i->promptmode == 1) {
> -		n = cli_readline(CONFIG_SYS_PROMPT);
> -	} else {
> -		n = cli_readline(CONFIG_SYS_PROMPT_HUSH_PS2);
> -	}
> +	n = uboot_cli_readline(i);
> +
>   #ifdef CONFIG_BOOT_RETRY_TIME
>   	if (n == -2) {
>   	  puts("\nTimeout waiting for command\n");
>
Simon Glass Jan. 27, 2016, 10:53 p.m. UTC | #2
On 26 January 2016 at 20:47, Marek Vasut <marex@denx.de> wrote:
> Pull the code which displays U-Boot prompt and reads the command line
> into a separate function. No functional change.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
>  common/cli_hush.c | 21 ++++++++++++++++-----
>  1 file changed, 16 insertions(+), 5 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Tom Rini Feb. 8, 2016, 8:46 p.m. UTC | #3
On Wed, Jan 27, 2016 at 04:47:54AM +0100, Marek Vasut wrote:

> Pull the code which displays U-Boot prompt and reads the command line
> into a separate function. No functional change.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Reviewed-by: Heiko Schocher <hs@denx.de>
> Reviewed-by: Simon Glass <sjg@chromium.org>

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

Patch

diff --git a/common/cli_hush.c b/common/cli_hush.c
index 2fbfdbe..cbaf22e 100644
--- a/common/cli_hush.c
+++ b/common/cli_hush.c
@@ -974,6 +974,20 @@  static inline void setup_prompt_string(int promptmode, char **prompt_str)
 }
 #endif
 
+#ifdef __U_BOOT__
+static int uboot_cli_readline(struct in_str *i)
+{
+	char *prompt;
+
+	if (i->promptmode == 1)
+		prompt = CONFIG_SYS_PROMPT;
+	else
+		prompt = CONFIG_SYS_PROMPT_HUSH_PS2;
+
+	return cli_readline(prompt);
+}
+#endif
+
 static void get_user_input(struct in_str *i)
 {
 #ifndef __U_BOOT__
@@ -1003,11 +1017,8 @@  static void get_user_input(struct in_str *i)
 
 	bootretry_reset_cmd_timeout();
 	i->__promptme = 1;
-	if (i->promptmode == 1) {
-		n = cli_readline(CONFIG_SYS_PROMPT);
-	} else {
-		n = cli_readline(CONFIG_SYS_PROMPT_HUSH_PS2);
-	}
+	n = uboot_cli_readline(i);
+
 #ifdef CONFIG_BOOT_RETRY_TIME
 	if (n == -2) {
 	  puts("\nTimeout waiting for command\n");