mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Peter Korsgaard <jacmet@sunsite.dk>
To: barebox@lists.infradead.org
Subject: [PATCH] console_simple: add fprintf / console_list for commands/loadb.c
Date: Fri, 10 Dec 2010 13:50:12 +0100	[thread overview]
Message-ID: <1291985412-7645-1-git-send-email-jacmet@sunsite.dk> (raw)

commands/loadb.c doesn't build with CONFIG_CONSOLE_SIMPLE, because it uses
fprintf / for_each_console (which uses console_list).

Fix it by adding trivial implementations of both in console_simple.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
---
 common/console_simple.c |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/common/console_simple.c b/common/console_simple.c
index 7695e05..1b58dea 100644
--- a/common/console_simple.c
+++ b/common/console_simple.c
@@ -3,6 +3,8 @@
 #include <fs.h>
 #include <errno.h>
 
+LIST_HEAD(console_list);
+EXPORT_SYMBOL(console_list);
 static struct console_device *console;
 
 int printf (const char *fmt, ...)
@@ -43,6 +45,25 @@ int vprintf (const char *fmt, va_list args)
 }
 EXPORT_SYMBOL(vprintf);
 
+void fprintf (int file, const char *fmt, ...)
+{
+	va_list args;
+	uint i;
+	char printbuffer[CFG_PBSIZE];
+
+	va_start (args, fmt);
+
+	/* For this to work, printbuffer must be larger than
+	 * anything we ever want to print.
+	 */
+	i = vsprintf (printbuffer, fmt, args);
+	va_end (args);
+
+	/* Print the string */
+	fputs(file, printbuffer);
+}
+EXPORT_SYMBOL(fprintf);
+
 void console_puts(unsigned int ch, const char *str)
 {
 	const char *s = str;
@@ -127,7 +148,10 @@ EXPORT_SYMBOL(ctrlc);
 
 int console_register(struct console_device *newcdev)
 {
-	if (!console)
+	if (!console) {
 		console = newcdev;
+		console_list.prev = console_list.next = &newcdev->list;
+		newcdev->list.prev = newcdev->list.next = &console_list;
+	}
 	return 0;
 }
-- 
1.7.1


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

                 reply	other threads:[~2010-12-10 12:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1291985412-7645-1-git-send-email-jacmet@sunsite.dk \
    --to=jacmet@sunsite.dk \
    --cc=barebox@lists.infradead.org \
    /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