summaryrefslogtreecommitdiffstats
path: root/commands/loadxy.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-06-08 14:12:01 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-06-09 09:22:14 +0200
commitc6fe3cd6bec591c6f49af2a95ca8b81226c8b31a (patch)
treee891cf1eee1a45518cde860a0b9ee5eb46b8d59b /commands/loadxy.c
parentd9fbe905a64215084e6f1668ac1dc96cd69989d5 (diff)
downloadbarebox-c6fe3cd6bec591c6f49af2a95ca8b81226c8b31a.tar.gz
barebox-c6fe3cd6bec591c6f49af2a95ca8b81226c8b31a.tar.xz
loadxy: Use console_get_by_name
Use console_get_by_name rather than iterating over the console list in the loadxy code. The code in loadxy.c used to test whether a console is active before using it. This check is dropped along the way since there's no reason to not being able to use a disabled console for loadxy. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/loadxy.c')
-rw-r--r--commands/loadxy.c26
1 files changed, 2 insertions, 24 deletions
diff --git a/commands/loadxy.c b/commands/loadxy.c
index 1e65cb6221..62b395626d 100644
--- a/commands/loadxy.c
+++ b/commands/loadxy.c
@@ -57,28 +57,6 @@ static int console_change_speed(struct console_device *cdev, int baudrate)
return current_baudrate;
}
-static struct console_device *get_named_console(const char *cname)
-{
- struct console_device *cdev;
- const char *target;
-
- /*
- * Assumption to have BOTH CONSOLE_STDIN AND STDOUT in the
- * same output console
- */
- for_each_console(cdev) {
- target = dev_id(&cdev->class_dev);
- if (strlen(target) != strlen(cname))
- continue;
- printf("RJK: looking for %s in console name %s\n",
- cname, target);
- if ((cdev->f_active & (CONSOLE_STDIN | CONSOLE_STDOUT))
- && !strcmp(cname, target))
- return cdev;
- }
- return NULL;
-}
-
/**
* @brief provide the loady(Y-Modem or Y-Modem/G) support
*
@@ -112,7 +90,7 @@ static int do_loady(int argc, char *argv[])
}
if (cname)
- cdev = get_named_console(cname);
+ cdev = console_get_by_name(cname);
else
cdev = console_get_first_active();
if (!cdev) {
@@ -196,7 +174,7 @@ static int do_loadx(int argc, char *argv[])
}
if (cname)
- cdev = get_named_console(cname);
+ cdev = console_get_by_name(cname);
else
cdev = console_get_first_active();
if (!cdev) {