mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] commands: readline: sort includes
@ 2021-02-10 11:58 Rouven Czerwinski
  2021-02-10 11:58 ` [PATCH 2/3] commands: readline: use exit code macros Rouven Czerwinski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rouven Czerwinski @ 2021-02-10 11:58 UTC (permalink / raw)
  To: barebox; +Cc: Rouven Czerwinski

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
 commands/readline.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/commands/readline.c b/commands/readline.c
index ef54b5e92f..426f579ee4 100644
--- a/commands/readline.c
+++ b/commands/readline.c
@@ -1,11 +1,11 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 // SPDX-FileCopyrightText: © 2000-2003 Wolfgang Denk <wd@denx.de>, DENX Software Engineering
 
-#include <common.h>
 #include <command.h>
+#include <common.h>
+#include <environment.h>
 #include <malloc.h>
 #include <xfuncs.h>
-#include <environment.h>
 
 static int do_readline(int argc, char *argv[])
 {
-- 
2.30.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 2/3] commands: readline: use exit code macros
  2021-02-10 11:58 [PATCH 1/3] commands: readline: sort includes Rouven Czerwinski
@ 2021-02-10 11:58 ` Rouven Czerwinski
  2021-02-10 11:58 ` [PATCH 3/3] commands: readline: release command slice Rouven Czerwinski
  2021-02-12  9:06 ` [PATCH 1/3] commands: readline: sort includes Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Rouven Czerwinski @ 2021-02-10 11:58 UTC (permalink / raw)
  To: barebox; +Cc: Rouven Czerwinski

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
 commands/readline.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/commands/readline.c b/commands/readline.c
index 426f579ee4..796b4def95 100644
--- a/commands/readline.c
+++ b/commands/readline.c
@@ -16,13 +16,13 @@ static int do_readline(int argc, char *argv[])
 
 	if (readline(argv[1], buf, CONFIG_CBSIZE) < 0) {
 		free(buf);
-		return 1;
+		return COMMAND_ERROR;
 	}
 
 	setenv(argv[2], buf);
 	free(buf);
 
-	return 0;
+	return COMMAND_SUCCESS;
 }
 
 BAREBOX_CMD_HELP_START(readline)
-- 
2.30.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 3/3] commands: readline: release command slice
  2021-02-10 11:58 [PATCH 1/3] commands: readline: sort includes Rouven Czerwinski
  2021-02-10 11:58 ` [PATCH 2/3] commands: readline: use exit code macros Rouven Czerwinski
@ 2021-02-10 11:58 ` Rouven Czerwinski
  2021-02-12  9:06 ` [PATCH 1/3] commands: readline: sort includes Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Rouven Czerwinski @ 2021-02-10 11:58 UTC (permalink / raw)
  To: barebox; +Cc: Rouven Czerwinski

Release the command slice around readline to let the workqueues run
while waiting for input.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
 commands/readline.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/commands/readline.c b/commands/readline.c
index 796b4def95..ece25d12f5 100644
--- a/commands/readline.c
+++ b/commands/readline.c
@@ -5,6 +5,7 @@
 #include <common.h>
 #include <environment.h>
 #include <malloc.h>
+#include <slice.h>
 #include <xfuncs.h>
 
 static int do_readline(int argc, char *argv[])
@@ -14,11 +15,16 @@ static int do_readline(int argc, char *argv[])
 	if (argc < 3)
 		return COMMAND_ERROR_USAGE;
 
+	command_slice_release();
+
 	if (readline(argv[1], buf, CONFIG_CBSIZE) < 0) {
+		command_slice_acquire();
 		free(buf);
 		return COMMAND_ERROR;
 	}
 
+	command_slice_acquire();
+
 	setenv(argv[2], buf);
 	free(buf);
 
-- 
2.30.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/3] commands: readline: sort includes
  2021-02-10 11:58 [PATCH 1/3] commands: readline: sort includes Rouven Czerwinski
  2021-02-10 11:58 ` [PATCH 2/3] commands: readline: use exit code macros Rouven Czerwinski
  2021-02-10 11:58 ` [PATCH 3/3] commands: readline: release command slice Rouven Czerwinski
@ 2021-02-12  9:06 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2021-02-12  9:06 UTC (permalink / raw)
  To: Rouven Czerwinski; +Cc: barebox

On Wed, Feb 10, 2021 at 12:58:06PM +0100, Rouven Czerwinski wrote:
> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
> ---
>  commands/readline.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/commands/readline.c b/commands/readline.c
> index ef54b5e92f..426f579ee4 100644
> --- a/commands/readline.c
> +++ b/commands/readline.c
> @@ -1,11 +1,11 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later
>  // SPDX-FileCopyrightText: © 2000-2003 Wolfgang Denk <wd@denx.de>, DENX Software Engineering
>  
> -#include <common.h>
>  #include <command.h>
> +#include <common.h>
> +#include <environment.h>
>  #include <malloc.h>
>  #include <xfuncs.h>
> -#include <environment.h>

I don't see much value in sorting includes, so I won't take this.
Applied the other ones, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2021-02-12  9:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-10 11:58 [PATCH 1/3] commands: readline: sort includes Rouven Czerwinski
2021-02-10 11:58 ` [PATCH 2/3] commands: readline: use exit code macros Rouven Czerwinski
2021-02-10 11:58 ` [PATCH 3/3] commands: readline: release command slice Rouven Czerwinski
2021-02-12  9:06 ` [PATCH 1/3] commands: readline: sort includes Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox