From 71892ca3315233d3514275de83c7e5a0e3b4533f Mon Sep 17 00:00:00 2001 From: Ambroise Vincent Date: Thu, 18 Apr 2019 11:36:42 +0100 Subject: [PATCH 1/2] Console: Allow to register multiple times It removes the need to unregister the console on system suspend. Change-Id: Ic9311a242a4a9a778651f7e6380bd2fc0964b2ce Signed-off-by: Ambroise Vincent --- drivers/console/multi_console.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/console/multi_console.c b/drivers/console/multi_console.c index b5ff88b70..1ec81c3c6 100644 --- a/drivers/console/multi_console.c +++ b/drivers/console/multi_console.c @@ -20,8 +20,10 @@ int console_register(console_t *console) { /* Assert that the struct is not on the stack (common mistake). */ assert((console < stacks_start) || (console >= stacks_end)); - /* Assert that we won't make a circle in the list. */ - assert(!console_is_registered(console)); + + /* Check that we won't make a circle in the list. */ + if (console_is_registered(console) == 1) + return 1; console->next = console_list; console_list = console; From c9ac30a58a4bfb2392eeee3f2790c73709a95d18 Mon Sep 17 00:00:00 2001 From: Ambroise Vincent Date: Wed, 24 Apr 2019 10:34:17 +0100 Subject: [PATCH 2/2] Console: Remove Arm console unregister on suspend Change-Id: Ie649b3c367a93db057eeaee7e83fa3e43f8c2607 Signed-off-by: Ambroise Vincent --- plat/arm/common/arm_console.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/plat/arm/common/arm_console.c b/plat/arm/common/arm_console.c index 84886b470..580b2ee01 100644 --- a/plat/arm/common/arm_console.c +++ b/plat/arm/common/arm_console.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -80,9 +80,7 @@ void arm_console_runtime_end(void) { (void)console_flush(); -#if MULTI_CONSOLE_API - (void)console_unregister(&arm_runtime_console.console); -#else +#if !MULTI_CONSOLE_API console_uninit(); -#endif /* MULTI_CONSOLE_API */ +#endif /* !MULTI_CONSOLE_API */ }