diff mbox

[v2,01/14] console: don't use __flush_to_console() outside console.c

Message ID 1482213825-30448-2-git-send-email-oohall@gmail.com
State Superseded
Headers show

Commit Message

Oliver O'Halloran Dec. 20, 2016, 6:03 a.m. UTC
There is only one use of this function outside of console.c and that
usage is broken. As the name suggests this is an internal function that
is only safe when the console lock held is held. flush_console() will
aquire the lock for the caller so that should be used instead.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 core/console.c       | 2 +-
 hw/fsp/fsp-console.c | 2 +-
 include/console.h    | 1 -
 3 files changed, 2 insertions(+), 3 deletions(-)

Comments

Andrew Donnellan Dec. 20, 2016, 6:20 a.m. UTC | #1
Summary line should say __flush_console(), not __flush_to_console().

On 20/12/16 17:03, Oliver O'Halloran wrote:
> There is only one use of this function outside of console.c and that
> usage is broken. As the name suggests this is an internal function that
> is only safe when the console lock held is held. flush_console() will
> aquire the lock for the caller so that should be used instead.

acquire

>
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>

Otherwise looks good!

Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>

> ---
>  core/console.c       | 2 +-
>  hw/fsp/fsp-console.c | 2 +-
>  include/console.h    | 1 -
>  3 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/core/console.c b/core/console.c
> index f76ed402c48f..0e96bf4593eb 100644
> --- a/core/console.c
> +++ b/core/console.c
> @@ -114,7 +114,7 @@ void clear_console(void)
>   * Optionally can skip flushing to drivers, leaving messages
>   * just in memory console.
>   */
> -bool __flush_console(bool flush_to_drivers)
> +static bool __flush_console(bool flush_to_drivers)
>  {
>  	struct cpu_thread *cpu = this_cpu();
>  	size_t req, len = 0;
> diff --git a/hw/fsp/fsp-console.c b/hw/fsp/fsp-console.c
> index 0080d7326f50..46ac28bbd822 100644
> --- a/hw/fsp/fsp-console.c
> +++ b/hw/fsp/fsp-console.c
> @@ -751,7 +751,7 @@ void fsp_console_poll(void *data __unused)
>  				continue;
>  			}
>  			if (fs->log_port) {
> -				__flush_console(true);
> +				flush_console();
>  				opal_update_pending_evt(fs->irq, 0);
>  			} else {
>  #ifdef OPAL_DEBUG_CONSOLE_POLL
> diff --git a/include/console.h b/include/console.h
> index 5cb1227e21bd..f88547c7791e 100644
> --- a/include/console.h
> +++ b/include/console.h
> @@ -59,7 +59,6 @@ extern struct lock con_lock;
>  extern bool dummy_console_enabled(void);
>  extern void force_dummy_console(void);
>  extern bool flush_console(void);
> -extern bool __flush_console(bool flush_to_drivers);
>  extern void set_console(struct con_ops *driver);
>
>  extern void console_complete_flush(void);
>
diff mbox

Patch

diff --git a/core/console.c b/core/console.c
index f76ed402c48f..0e96bf4593eb 100644
--- a/core/console.c
+++ b/core/console.c
@@ -114,7 +114,7 @@  void clear_console(void)
  * Optionally can skip flushing to drivers, leaving messages
  * just in memory console.
  */
-bool __flush_console(bool flush_to_drivers)
+static bool __flush_console(bool flush_to_drivers)
 {
 	struct cpu_thread *cpu = this_cpu();
 	size_t req, len = 0;
diff --git a/hw/fsp/fsp-console.c b/hw/fsp/fsp-console.c
index 0080d7326f50..46ac28bbd822 100644
--- a/hw/fsp/fsp-console.c
+++ b/hw/fsp/fsp-console.c
@@ -751,7 +751,7 @@  void fsp_console_poll(void *data __unused)
 				continue;
 			}
 			if (fs->log_port) {
-				__flush_console(true);
+				flush_console();
 				opal_update_pending_evt(fs->irq, 0);
 			} else {
 #ifdef OPAL_DEBUG_CONSOLE_POLL
diff --git a/include/console.h b/include/console.h
index 5cb1227e21bd..f88547c7791e 100644
--- a/include/console.h
+++ b/include/console.h
@@ -59,7 +59,6 @@  extern struct lock con_lock;
 extern bool dummy_console_enabled(void);
 extern void force_dummy_console(void);
 extern bool flush_console(void);
-extern bool __flush_console(bool flush_to_drivers);
 extern void set_console(struct con_ops *driver);
 
 extern void console_complete_flush(void);