mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-09 03:21:51 +00:00
stdio: Pass device pointer to stdio methods
At present stdio device functions do not get any clue as to which stdio device is being acted on. Some implementations go to great lengths to work around this, such as defining a whole separate set of functions for each possible device. For driver model we need to associate a stdio_dev with a device. It doesn't seem possible to continue with this work-around approach. Instead, add a stdio_dev pointer to each of the stdio member functions. Note: The serial drivers have the same problem, but it is not strictly necessary to fix that to get driver model running. Also, if we convert serial over to driver model the problem will go away. Code size increases by 244 bytes for Thumb2 and 428 for PowerPC. 22: stdio: Pass device pointer to stdio methods arm: (for 2/2 boards) all +244.0 bss -4.0 text +248.0 powerpc: (for 1/1 boards) all +428.0 text +428.0 Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Marek Vasut <marex@denx.de> Reviewed-by: Marek Vasut <marex@denx.de>
This commit is contained in:
parent
91d0be1dd8
commit
709ea543b9
30 changed files with 189 additions and 101 deletions
|
@ -33,8 +33,8 @@
|
|||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
/* Local prototypes */
|
||||
static void logbuff_putc(const char c);
|
||||
static void logbuff_puts(const char *s);
|
||||
static void logbuff_putc(struct stdio_dev *dev, const char c);
|
||||
static void logbuff_puts(struct stdio_dev *dev, const char *s);
|
||||
static int logbuff_printk(const char *line);
|
||||
|
||||
static char buf[1024];
|
||||
|
@ -143,7 +143,7 @@ int drv_logbuff_init(void)
|
|||
return (rc == 0) ? 1 : rc;
|
||||
}
|
||||
|
||||
static void logbuff_putc(const char c)
|
||||
static void logbuff_putc(struct stdio_dev *dev, const char c)
|
||||
{
|
||||
char buf[2];
|
||||
buf[0] = c;
|
||||
|
@ -151,7 +151,7 @@ static void logbuff_putc(const char c)
|
|||
logbuff_printk(buf);
|
||||
}
|
||||
|
||||
static void logbuff_puts(const char *s)
|
||||
static void logbuff_puts(struct stdio_dev *dev, const char *s)
|
||||
{
|
||||
logbuff_printk (s);
|
||||
}
|
||||
|
@ -181,6 +181,7 @@ void logbuff_log(char *msg)
|
|||
*/
|
||||
int do_log(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||
{
|
||||
struct stdio_dev *sdev = NULL;
|
||||
char *s;
|
||||
unsigned long i, start, size;
|
||||
|
||||
|
@ -188,7 +189,7 @@ int do_log(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|||
/* Log concatenation of all arguments separated by spaces */
|
||||
for (i = 2; i < argc; i++) {
|
||||
logbuff_printk(argv[i]);
|
||||
logbuff_putc((i < argc - 1) ? ' ' : '\n');
|
||||
logbuff_putc(sdev, (i < argc - 1) ? ' ' : '\n');
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue