summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-02-08 09:04:08 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-02-08 09:04:08 +0100
commita830047442883e130b39b620168c16e0495420db (patch)
tree4cb147620222ab486fd1f3c8d073e1b59bef6827
parent0fae783beefc4ea6f201d517bcfe9dd1bd02f38b (diff)
parent8994a0aab7a204308e5c8f13612913874e49b50f (diff)
downloadbarebox-a830047442883e130b39b620168c16e0495420db.tar.gz
barebox-a830047442883e130b39b620168c16e0495420db.tar.xz
Merge branch 'for-next/ratp'
-rw-r--r--common/ratp.c26
-rw-r--r--include/ratp.h2
-rw-r--r--include/ratp_bb.h9
-rw-r--r--lib/readline.c4
4 files changed, 16 insertions, 25 deletions
diff --git a/common/ratp.c b/common/ratp.c
index 7be86d49a1..80863f81fb 100644
--- a/common/ratp.c
+++ b/common/ratp.c
@@ -54,14 +54,8 @@ struct ratp_bb_command_return {
struct ratp_ctx {
struct console_device *cdev;
struct ratp ratp;
- int ratp_status;
struct console_device ratp_console;
int have_synch;
- int in_ratp_console;
-
- u8 sendbuf[256];
- u8 sendbuf_len;
-
int old_active;
struct kfifo *console_recv_fifo;
@@ -204,7 +198,7 @@ static int ratp_bb_send_getenv_return(struct ratp_ctx *ctx, const char *val)
}
static char *ratp_command;
-static struct ratp_ctx *ratp_command_ctx;
+static struct ratp_ctx *ratp_ctx;
static int ratp_bb_dispatch(struct ratp_ctx *ctx, const void *buf, int len)
{
@@ -220,7 +214,7 @@ static int ratp_bb_dispatch(struct ratp_ctx *ctx, const void *buf, int len)
return 0;
ratp_command = xmemdup_add_zero(&rbb->data, dlen);
- ratp_command_ctx = ctx;
+ ratp_ctx = ctx;
pr_debug("got command: %s\n", ratp_command);
break;
@@ -323,7 +317,7 @@ static int ratp_console_register(struct ratp_ctx *ctx)
return 0;
}
-void ratp_run_command(void)
+void barebox_ratp_command_run(void)
{
int ret;
@@ -337,7 +331,7 @@ void ratp_run_command(void)
free(ratp_command);
ratp_command = NULL;
- ratp_bb_send_command_return(ratp_command_ctx, ret);
+ ratp_bb_send_command_return(ratp_ctx, ret);
}
static const char *ratpfs_mount_path;
@@ -400,7 +394,7 @@ out:
int barebox_ratp_fs_call(struct ratp_bb_pkt *tx, struct ratp_bb_pkt **rx)
{
- struct ratp_ctx *ctx = ratp_command_ctx;
+ struct ratp_ctx *ctx = ratp_ctx;
struct ratp_bb *rbb;
int len;
u64 start;
@@ -446,11 +440,11 @@ int barebox_ratp(struct console_device *cdev)
if (!cdev->getc || !cdev->putc)
return -EINVAL;
- if (ratp_command_ctx) {
- ctx = ratp_command_ctx;
+ if (ratp_ctx) {
+ ctx = ratp_ctx;
} else {
ctx = xzalloc(sizeof(*ctx));
- ratp_command_ctx = ctx;
+ ratp_ctx = ctx;
ctx->ratp.send = console_send;
ctx->ratp.recv = console_recv;
ctx->console_recv_fifo = kfifo_alloc(512);
@@ -494,7 +488,7 @@ out:
static void barebox_ratp_close(void)
{
- if (ratp_command_ctx && ratp_command_ctx->cdev)
- ratp_console_unregister(ratp_command_ctx);
+ if (ratp_ctx && ratp_ctx->cdev)
+ ratp_console_unregister(ratp_ctx);
}
predevshutdown_exitcall(barebox_ratp_close);
diff --git a/include/ratp.h b/include/ratp.h
index 94fd004f45..6f4cf8a6f5 100644
--- a/include/ratp.h
+++ b/include/ratp.h
@@ -17,6 +17,4 @@ int ratp_poll(struct ratp *ratp);
bool ratp_closed(struct ratp *ratp);
bool ratp_busy(struct ratp *ratp);
-void ratp_run_command(void);
-
#endif /* __RATP_H */ \ No newline at end of file
diff --git a/include/ratp_bb.h b/include/ratp_bb.h
index 52ecaff374..f485f7d8ac 100644
--- a/include/ratp_bb.h
+++ b/include/ratp_bb.h
@@ -2,14 +2,13 @@
#define __RATP_BB_H
struct ratp_bb_pkt {
- struct list_head list;
-
unsigned int len;
uint8_t data[];
};
-int barebox_ratp(struct console_device *cdev);
-int barebox_ratp_fs_call(struct ratp_bb_pkt *tx, struct ratp_bb_pkt **rx);
-int barebox_ratp_fs_mount(const char *path);
+int barebox_ratp(struct console_device *cdev);
+void barebox_ratp_command_run(void);
+int barebox_ratp_fs_call(struct ratp_bb_pkt *tx, struct ratp_bb_pkt **rx);
+int barebox_ratp_fs_mount(const char *path);
#endif /* __RATP_BB_H */
diff --git a/lib/readline.c b/lib/readline.c
index b5d99ca185..1e380abeca 100644
--- a/lib/readline.c
+++ b/lib/readline.c
@@ -3,7 +3,7 @@
#include <init.h>
#include <libbb.h>
#include <poller.h>
-#include <ratp.h>
+#include <ratp_bb.h>
#include <xfuncs.h>
#include <complete.h>
#include <linux/ctype.h>
@@ -203,7 +203,7 @@ int readline(const char *prompt, char *buf, int len)
while (!tstc()) {
poller_call();
if (IS_ENABLED(CONFIG_RATP))
- ratp_run_command();
+ barebox_ratp_command_run();
}
ichar = read_key();