mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Aleksander Morgado <aleksander@aleksander.es>
To: barebox@lists.infradead.org, s.hauer@pengutronix.de
Cc: Aleksander Morgado <aleksander@aleksander.es>
Subject: [PATCH v3 3/9] ratp: allow building without full console support
Date: Sat, 24 Feb 2018 16:01:15 +0100	[thread overview]
Message-ID: <20180224150121.28309-4-aleksander@aleksander.es> (raw)
In-Reply-To: <20180224150121.28309-1-aleksander@aleksander.es>

Make CONFIG_RATP a selectable config option, so that the user can
enable RATP support without explicitly needing to enable the full
console support over RATP (e.g. only for RATP FS or built-in command
support).

The full console can still be explicitly enabled with
CONFIG_CONSOLE_RATP.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
---
 common/Makefile    | 1 -
 common/ratp/ratp.c | 7 +++++--
 fs/Kconfig         | 2 +-
 lib/Kconfig        | 2 +-
 lib/readline.c     | 2 +-
 5 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/common/Makefile b/common/Makefile
index bc9474a3a..a9abcd1bc 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -47,7 +47,6 @@ obj-$(CONFIG_SHELL_HUSH)	+= hush.o
 obj-$(CONFIG_SHELL_SIMPLE)	+= parser.o
 obj-$(CONFIG_STATE)		+= state/
 obj-$(CONFIG_RATP)		+= ratp/
-obj-$(CONFIG_CONSOLE_RATP)	+= ratp/
 obj-$(CONFIG_BOOTCHOOSER)	+= bootchooser.o
 obj-$(CONFIG_UIMAGE)		+= image.o uimage.o
 obj-$(CONFIG_FITIMAGE)		+= image-fit.o
diff --git a/common/ratp/ratp.c b/common/ratp/ratp.c
index b051fdee4..7c8a2f6f5 100644
--- a/common/ratp/ratp.c
+++ b/common/ratp/ratp.c
@@ -260,7 +260,7 @@ static int ratp_bb_dispatch(struct ratp_ctx *ctx, const void *buf, int len)
 
 	switch (type) {
 	case BB_RATP_TYPE_COMMAND:
-		if (ratp_command)
+		if (!IS_ENABLED(CONFIG_CONSOLE_RATP) || ratp_command)
 			return 0;
 
 		ratp_command = xmemdup_add_zero(&rbb->data, dlen);
@@ -274,6 +274,8 @@ static int ratp_bb_dispatch(struct ratp_ctx *ctx, const void *buf, int len)
 		break;
 
 	case BB_RATP_TYPE_CONSOLEMSG:
+		if (!IS_ENABLED(CONFIG_CONSOLE_RATP))
+			return 0;
 
 		kfifo_put(ctx->console_recv_fifo, rbb->data, dlen);
 		break;
@@ -420,7 +422,8 @@ static void ratp_poller(struct poller_struct *poller)
 	size_t len;
 	void *buf;
 
-	ratp_queue_console_tx(ctx);
+	if (IS_ENABLED(CONFIG_CONSOLE_RATP))
+		ratp_queue_console_tx(ctx);
 
 	ret = ratp_poll(&ctx->ratp);
 	if (ret == -EINTR)
diff --git a/fs/Kconfig b/fs/Kconfig
index 57f2676f4..351200055 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -94,7 +94,7 @@ source fs/squashfs/Kconfig
 
 config FS_RATP
 	bool
-	depends on CONSOLE_RATP
+	depends on RATP
 	prompt "RATP filesystem support"
 	help
 	  This enables support for transferring files over RATP. A host can
diff --git a/lib/Kconfig b/lib/Kconfig
index dca93b80d..4e9213f3e 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -95,7 +95,7 @@ config STMP_DEVICE
 
 config RATP
 	select CRC16
-	bool
+	bool "RATP protocol support"
 	help
 	  Reliable Asynchronous Transfer Protocol (RATP) is a protocol for reliably
 	  transferring packets over serial links described in RFC916. This implementation
diff --git a/lib/readline.c b/lib/readline.c
index 1e380abec..904a77639 100644
--- a/lib/readline.c
+++ b/lib/readline.c
@@ -202,7 +202,7 @@ int readline(const char *prompt, char *buf, int len)
 	while (1) {
 		while (!tstc()) {
 			poller_call();
-			if (IS_ENABLED(CONFIG_RATP))
+			if (IS_ENABLED(CONFIG_CONSOLE_RATP))
 				barebox_ratp_command_run();
 		}
 
-- 
2.15.1


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

  parent reply	other threads:[~2018-02-24 15:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-24 15:01 [PATCH v3 0/9] ratp: new generic RATP command support Aleksander Morgado
2018-02-24 15:01 ` [PATCH v3 1/9] ratp: implement generic " Aleksander Morgado
2018-02-24 15:01 ` [PATCH v3 2/9] ratp: moved logic to its own subdirectory Aleksander Morgado
2018-02-24 15:01 ` Aleksander Morgado [this message]
2018-02-24 15:01 ` [PATCH v3 4/9] ratp: implement ping as a standard ratp command Aleksander Morgado
2018-02-24 15:01 ` [PATCH v3 5/9] ratp: implement getenv " Aleksander Morgado
2018-02-24 15:01 ` [PATCH v3 6/9] ratp: use xstrndup() instead of a custom xmemdup_add_zero() Aleksander Morgado
2018-02-24 15:01 ` [PATCH v3 7/9] ratp: new md and mw commands Aleksander Morgado
2018-02-24 15:01 ` [PATCH v3 8/9] ratp: new reset command Aleksander Morgado
2018-02-24 15:01 ` [PATCH v3 9/9] docs: add reference to libratp-barebox in the remote-control docs Aleksander Morgado
2018-03-01  8:48 ` [PATCH v3 0/9] ratp: new generic RATP command support Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180224150121.28309-4-aleksander@aleksander.es \
    --to=aleksander@aleksander.es \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox