mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-06-23 23:22:02 +00:00
console: remove duplicated test on gd value
Reorder test on gd value and remove the duplicated test (!gd) in putc and puts function. This patch is a preliminary step for rework of this function. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
a4918b2310
commit
93cdb52b2a
1 changed files with 8 additions and 8 deletions
|
@ -517,22 +517,22 @@ static inline void print_pre_console_buffer(int flushpoint) {}
|
||||||
|
|
||||||
void putc(const char c)
|
void putc(const char c)
|
||||||
{
|
{
|
||||||
|
if (!gd)
|
||||||
|
return;
|
||||||
#ifdef CONFIG_SANDBOX
|
#ifdef CONFIG_SANDBOX
|
||||||
/* sandbox can send characters to stdout before it has a console */
|
/* sandbox can send characters to stdout before it has a console */
|
||||||
if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) {
|
if (!(gd->flags & GD_FLG_SERIAL_READY)) {
|
||||||
os_putc(c);
|
os_putc(c);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_DEBUG_UART
|
#ifdef CONFIG_DEBUG_UART
|
||||||
/* if we don't have a console yet, use the debug UART */
|
/* if we don't have a console yet, use the debug UART */
|
||||||
if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) {
|
if (!(gd->flags & GD_FLG_SERIAL_READY)) {
|
||||||
printch(c);
|
printch(c);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!gd)
|
|
||||||
return;
|
|
||||||
#ifdef CONFIG_CONSOLE_RECORD
|
#ifdef CONFIG_CONSOLE_RECORD
|
||||||
if ((gd->flags & GD_FLG_RECORD) && gd->console_out.start)
|
if ((gd->flags & GD_FLG_RECORD) && gd->console_out.start)
|
||||||
membuff_putbyte((struct membuff *)&gd->console_out, c);
|
membuff_putbyte((struct membuff *)&gd->console_out, c);
|
||||||
|
@ -565,15 +565,17 @@ void putc(const char c)
|
||||||
|
|
||||||
void puts(const char *s)
|
void puts(const char *s)
|
||||||
{
|
{
|
||||||
|
if (!gd)
|
||||||
|
return;
|
||||||
#ifdef CONFIG_SANDBOX
|
#ifdef CONFIG_SANDBOX
|
||||||
/* sandbox can send characters to stdout before it has a console */
|
/* sandbox can send characters to stdout before it has a console */
|
||||||
if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) {
|
if (!(gd->flags & GD_FLG_SERIAL_READY)) {
|
||||||
os_puts(s);
|
os_puts(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_DEBUG_UART
|
#ifdef CONFIG_DEBUG_UART
|
||||||
if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) {
|
if (!(gd->flags & GD_FLG_SERIAL_READY)) {
|
||||||
while (*s) {
|
while (*s) {
|
||||||
int ch = *s++;
|
int ch = *s++;
|
||||||
|
|
||||||
|
@ -582,8 +584,6 @@ void puts(const char *s)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!gd)
|
|
||||||
return;
|
|
||||||
#ifdef CONFIG_CONSOLE_RECORD
|
#ifdef CONFIG_CONSOLE_RECORD
|
||||||
if ((gd->flags & GD_FLG_RECORD) && gd->console_out.start)
|
if ((gd->flags & GD_FLG_RECORD) && gd->console_out.start)
|
||||||
membuff_put((struct membuff *)&gd->console_out, s, strlen(s));
|
membuff_put((struct membuff *)&gd->console_out, s, strlen(s));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue