diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2020-02-03 15:31:26 +0200 |
---|---|---|
committer | Petr Mladek <pmladek@suse.com> | 2020-02-11 10:43:56 +0100 |
commit | 12825e6ba8ea8efbb6d81363b0cf6b5bf84c051a (patch) | |
tree | cda9bebe9efa76ef070cef57d8553d276044ffa9 /kernel/printk | |
parent | caa72c3bc584bc28b557bcf1a47532a7a6f37e6f (diff) | |
download | linux-12825e6ba8ea8efbb6d81363b0cf6b5bf84c051a.tar.bz2 |
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: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Diffstat (limited to 'kernel/printk')
-rw-r--r-- | kernel/printk/printk.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 51337ed426e0..d40a316908da 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2809,7 +2809,7 @@ EXPORT_SYMBOL(register_console); int unregister_console(struct console *console) { - struct console *a, *b; + struct console *con; int res; pr_info("%sconsole [%s%d] disabled\n", @@ -2825,11 +2825,10 @@ int unregister_console(struct console *console) if (console_drivers == console) { console_drivers=console->next; res = 0; - } else if (console_drivers) { - for (a=console_drivers->next, b=console_drivers ; - a; b=a, a=b->next) { - if (a == console) { - b->next = a->next; + } else { + for_each_console(con) { + if (con->next == console) { + con->next = console->next; res = 0; break; } |