Commit 12825e6b authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Petr Mladek

console: Use for_each_console() helper in unregister_console()

We have rather open coded single linked list manipulations where we may
simple use for_each_console() helper with properly set exit conditions.

Replace open coded single-linked list handling with for_each_console()
helper in use.

Link: http://lkml.kernel.org/r/20200203133130.11591-3-andriy.shevchenko@linux.intel.com
To: linux-kernel@vger.kernel.org
To: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
Reviewed-by: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: default avatarPetr Mladek <pmladek@suse.com>
parent caa72c3b
...@@ -2809,7 +2809,7 @@ EXPORT_SYMBOL(register_console); ...@@ -2809,7 +2809,7 @@ EXPORT_SYMBOL(register_console);
int unregister_console(struct console *console) int unregister_console(struct console *console)
{ {
struct console *a, *b; struct console *con;
int res; int res;
pr_info("%sconsole [%s%d] disabled\n", pr_info("%sconsole [%s%d] disabled\n",
...@@ -2825,11 +2825,10 @@ int unregister_console(struct console *console) ...@@ -2825,11 +2825,10 @@ int unregister_console(struct console *console)
if (console_drivers == console) { if (console_drivers == console) {
console_drivers=console->next; console_drivers=console->next;
res = 0; res = 0;
} else if (console_drivers) { } else {
for (a=console_drivers->next, b=console_drivers ; for_each_console(con) {
a; b=a, a=b->next) { if (con->next == console) {
if (a == console) { con->next = console->next;
b->next = a->next;
res = 0; res = 0;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment