mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-23 13:56:20 +00:00
console: add function console_devices_set
Add a new function to access to console_devices only defined if CONFIG_IS_ENABLED(CONSOLE_MUX). This path allows to remove #if CONFIG_IS_ENABLED(CONSOLE_MUX) in console_getc function. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
This commit is contained in:
parent
c04f856822
commit
45375adc97
1 changed files with 13 additions and 7 deletions
|
@ -177,6 +177,11 @@ static struct stdio_dev *tstcdev;
|
||||||
struct stdio_dev **console_devices[MAX_FILES];
|
struct stdio_dev **console_devices[MAX_FILES];
|
||||||
int cd_count[MAX_FILES];
|
int cd_count[MAX_FILES];
|
||||||
|
|
||||||
|
static void __maybe_unused console_devices_set(int file, struct stdio_dev *dev)
|
||||||
|
{
|
||||||
|
console_devices[file][0] = dev;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This depends on tstc() always being called before getchar().
|
* This depends on tstc() always being called before getchar().
|
||||||
* This is guaranteed to be true because this routine is called
|
* This is guaranteed to be true because this routine is called
|
||||||
|
@ -275,6 +280,11 @@ static inline void console_doenv(int file, struct stdio_dev *dev)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
static void __maybe_unused console_devices_set(int file, struct stdio_dev *dev)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static inline int console_getc(int file)
|
static inline int console_getc(int file)
|
||||||
{
|
{
|
||||||
return stdio_devices[file]->getc(stdio_devices[file]);
|
return stdio_devices[file]->getc(stdio_devices[file]);
|
||||||
|
@ -958,18 +968,14 @@ int console_init_r(void)
|
||||||
if (outputdev != NULL) {
|
if (outputdev != NULL) {
|
||||||
console_setfile(stdout, outputdev);
|
console_setfile(stdout, outputdev);
|
||||||
console_setfile(stderr, outputdev);
|
console_setfile(stderr, outputdev);
|
||||||
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
|
console_devices_set(stdout, outputdev);
|
||||||
console_devices[stdout][0] = outputdev;
|
console_devices_set(stderr, outputdev);
|
||||||
console_devices[stderr][0] = outputdev;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initializes input console */
|
/* Initializes input console */
|
||||||
if (inputdev != NULL) {
|
if (inputdev != NULL) {
|
||||||
console_setfile(stdin, inputdev);
|
console_setfile(stdin, inputdev);
|
||||||
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
|
console_devices_set(stdin, inputdev);
|
||||||
console_devices[stdin][0] = inputdev;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IS_ENABLED(CONFIG_SYS_CONSOLE_INFO_QUIET))
|
if (!IS_ENABLED(CONFIG_SYS_CONSOLE_INFO_QUIET))
|
||||||
|
|
Loading…
Add table
Reference in a new issue