console_simple: add fprintf / console_list for commands/loadb.c
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> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
adcebd48f6
commit
1945936991
|
@ -3,6 +3,8 @@
|
||||||
#include <fs.h>
|
#include <fs.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
LIST_HEAD(console_list);
|
||||||
|
EXPORT_SYMBOL(console_list);
|
||||||
static struct console_device *console;
|
static struct console_device *console;
|
||||||
|
|
||||||
int printf (const char *fmt, ...)
|
int printf (const char *fmt, ...)
|
||||||
|
@ -43,6 +45,25 @@ int vprintf (const char *fmt, va_list args)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(vprintf);
|
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)
|
void console_puts(unsigned int ch, const char *str)
|
||||||
{
|
{
|
||||||
const char *s = str;
|
const char *s = str;
|
||||||
|
@ -127,7 +148,10 @@ EXPORT_SYMBOL(ctrlc);
|
||||||
|
|
||||||
int console_register(struct console_device *newcdev)
|
int console_register(struct console_device *newcdev)
|
||||||
{
|
{
|
||||||
if (!console)
|
if (!console) {
|
||||||
console = newcdev;
|
console = newcdev;
|
||||||
|
console_list.prev = console_list.next = &newcdev->list;
|
||||||
|
newcdev->list.prev = newcdev->list.next = &console_list;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue