common/console.c: ensure GD_FLG_SILENT is set or cleared
RFC PATCH 1/1 common/console.c: ensure GD_FLG_SILENT is set or cleared
When CONFIG_SILENT_CONSOLE is defined and the default environment has silent=1 it is not possible for a user to make the console un-silent if the environment is not available when console_init_f() is called (for example because the environment is in SPI).
Add a new helper function console_update_silent() and call it from both console_init_f() and console_init_r().
---
common/console.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
common/console.c +13 -4
@@ -687,15 +687,22 @@ int console_assign(int file, const char *devname)return -1 ; } -/* Called before relocation - use serial functions */ -int console_init_f (void ) +static void console_update_silent (void ) { - gd->have_console =1 ; -#ifdef CONFIG_SILENT_CONSOLE if (getenv ("silent" ) !=NULL ) gd->flags |=GD_FLG_SILENT ; +else + gd->flags &= ~GD_FLG_SILENT ;#endif +} + +/* Called before relocation - use serial functions */ +int console_init_f (void ) +{ + gd->have_console =1 ; + +console_update_silent ();print_pre_console_buffer (PRE_CONSOLE_FLUSHPOINT1_SERIAL );
@@ -831,6 +838,8 @@ int console_init_r(void)struct list_head *pos;struct stdio_dev *dev; +console_update_silent (); +#ifdef CONFIG_SPLASH_SCREEN /* * suppress all output if splash screen is enabled and we have
Signature · 1 line
2.9.2.518.ged577c6.dirty
RFC PATCH 1/1 common/console.c: ensure GD_FLG_SILENT is set or cleared
Hi Chris,
Quoted 5 lines · Chris Packham
When
CONFIG_SILENT_CONSOLEis defined and the default environment has silent=1 it is not possible for a user to make the console un-silent if the environment is not available whenconsole_init_f()is called (for example because the environment is in SPI).
Quoted 8 lines
Add a new helper function
console_update_silent()and call it from bothconsole_init_f()andconsole_init_r().Signed-off-by Chris Packham <[email protected]>---
common/console.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
I'm not completely sure that this is the intended behaviour, but it seems reasonable. I'd really like to see docs in the README (or elsewhere) about the effect of the 'silent' env variable...
- Simon
Quoted 10 lines · Chris Packham
When
CONFIG_SILENT_CONSOLEis defined and the default environment has silent=1 it is not possible for a user to make the console un-silent if the environment is not available whenconsole_init_f()is called (for example because the environment is in SPI).Add a new helper function
console_update_silent()and call it from bothconsole_init_f()andconsole_init_r().Signed-off-by Chris Packham <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161008/8deb8f95/attachment.sig>