Console: Allow to register multiple times
authorAmbroise Vincent <[email protected]>
Thu, 18 Apr 2019 10:36:42 +0000 (11:36 +0100)
committerAmbroise Vincent <[email protected]>
Wed, 24 Apr 2019 09:50:16 +0000 (10:50 +0100)
It removes the need to unregister the console on system suspend.

Change-Id: Ic9311a242a4a9a778651f7e6380bd2fc0964b2ce
Signed-off-by: Ambroise Vincent <[email protected]>
drivers/console/multi_console.c

index b5ff88b70a5eb53b01275839cb765b25fa4ed0a2..1ec81c3c6156f7af830d02d041312393e050f8f0 100644 (file)
@@ -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;